So why am I suggesting to do it this way when we can do the same via Shell.Explorer? Well, it is not quite the same actually. Shell.Explorer for one adjusts the site to the basic design without CSS applied. So the display you will see will not be entirely the same when you open it via a browser. Sometimes also, JavaScript hampers its execution especially with the new OS now in place. Now, opening the browser itself will ensure that it has the latest features, based on your browser version.
The reason I created this entry is because there is a question inside Foxite forum that if we do it this way, then how to position IE inside our form at specific coordinates and not as a full screen filling the entire form? So I am showing here how we can achieve that, as a guide. Improve it further based on your needs. Codes follow:
Declare Integer GetWindowLong In User32 Integer HWnd, Integer nIndex
Declare Integer SetWindowLong In user32 Integer HWnd,;
INTEGER nIndex, Integer dwNewLong
Declare Integer SetParent In user32;
INTEGER hWndChild,;
INTEGER hWndNewParent
loTest = Createobject("Form1")
loTest.Show(1)
Read Events
Define Class Form1 As Form
Caption
= 'IE inside a VFP
Form'
AutoCenter = .T.
Height = 500
Width = 1000
ShowWindow = 2
oIE = .F.
Procedure Init
Local
lcURL, lnStyle, loHWnd, loIE As internetexplorer.Application
lcURL = 'https://www.mediwaresas.it/news'
loIE = Createobject("InternetExplorer.Application")
Thisform.oIE = m.loIE
Wait Window 'Please wait,
loading site...' Nowait
With
loIE
.Visible = .F.
.Silent = .T.
.AddressBar=.F.
.MenuBar=.F.
.Toolbar=.F.
.StatusBar=.F.
.Resizable=.F.
.Width = 500
* Load URL
.Navigate2(m.lcURL)
Do While .ReadyState <> 4
Enddo
loHWnd = .HWnd
lnStyle = GetWindowLong(m.loHWnd, -16)
SetWindowLong(m.loHWnd, -16, Bitxor(lnStyle, 0x00400000))
SetParent(m.loHWnd,Thisform.HWnd)
.ClientToWindow(.Width,.Height)
This._Resize()
.Visible = .T.
Wait Clear
Endwith
Bindevent(This,'Resize',This,'_Resize')
Endproc
Procedure
_Resize
With Thisform.oIE
.Left = Thisform.Width - 710
.Top = 100
.Height = Thisform.Height - 120
Endwith
Endproc
Procedure
Destroy
Clear
Events
This.oIE.Quit
This.oIE = Null
Endproc
Procedure
KeyPress
Lparameters
nKeyCode, nShiftAltCtrl
If m.nKeyCode = 27
Thisform.Release
Endif
Endproc
Enddefine
Hi, Jun. If I need Word or Notepad in VFP Form, How can I do it?
ReplyDeleteSee this: https://sandstorm36.blogspot.com/2014/05/3rd-party-apps-from-within-our-forms.html
DeleteLa suscripcion es pago mensula o Ășnico. Saludos
ReplyDeleteUnico (single payment)
Delete