In a VFP app, I am calling up IE and navigating it to a relevant website connected to the app.
So, starting IE with:
oBrowser = Createobject("InternetExplorer.Application")
oBrowser.Visible = .T.
After I run this, the browser is sometimes behind the VFP window. How can I bring the IE window to the front so the user will see it?
Thanks,
David.
David
In Help Builder where I use a Web Browser for live preview I had those same problems, so I decided to ditch Internet Explorer application object in an external browser and instead use a Web Browser Control in a top level window. This allows much more control over the window and also works around some of the problem of using the IE object in your app (like IE doesn't release and you can only bring up so many instances before it won't work anymore).
+++ Rick ---
This is not a WestWind question, but maybe someone could help:
In a VFP app, I am calling up IE and navigating it to a relevant website connected to the app.
So, starting IE with:
oBrowser = Createobject("InternetExplorer.Application")
oBrowser.Visible = .T.
After I run this, the browser is sometimes behind the VFP window. How can I bring the IE window to the front so the user will see it?
Thanks,
David.
West Wind Technologies
Making waves on the Web
from Maui
Thanks for that info. I think I will demo to my client as it is, and if they like the general principle, I will then investigate a Web browser control in a top-level window.
David.
Yup I've run into this myself in Help Builder. It's messy and there's no easy solution to this - you basically would have to use the Windows API functions to find the window by name then force it to the top of the Window stack. There are functions in wwAPI that can help with most of that but it takes quite a bit of trial and error.
In Help Builder where I use a Web Browser for live preview I had those same problems, so I decided to ditch Internet Explorer application object in an external browser and instead use a Web Browser Control in a top level window. This allows much more control over the window and also works around some of the problem of using the IE object in your app (like IE doesn't release and you can only bring up so many instances before it won't work anymore).
+++ Rick ---
This is not a WestWind question, but maybe someone could help:
In a VFP app, I am calling up IE and navigating it to a relevant website connected to the app.
So, starting IE with:
oBrowser = Createobject("InternetExplorer.Application")
oBrowser.Visible = .T.
After I run this, the browser is sometimes behind the VFP window. How can I bring the IE window to the front so the user will see it?
Thanks,
David.
David
o = CREATEOBJECT("InternetExplorer.Application")
o.Visible = .t.
? o.ParentDO wwAPI
Winapi_sleep(2000)
?o.Parent.HWND
ActivateWindow(o.Parent.HWND)
ActivateWindow looks like this:
************************************************************************
* wwAPI :: WinApi_ActivateWindow
****************************************
*** Function: Activates the
*** Assume:
*** Pass: lcTitle - Exact Window Title or Window Handle Number
*** Return:
************************************************************************
FUNCTION ActivateWindow(lcTitle,lnParentHandle)IF VARTYPE(lcTitle) = "C"
IF EMPTY(lnParentHandle)
lnParentHandle = 0
ENDIF
DECLARE INTEGER FindWindow ;
IN WIN32API ;
STRING cNull,STRING cWinNamelnHandle = FindWindow(lnParentHandle,lcTitle)
ELSE
lnHandle = lcTitle
ENDIFDECLARE INTEGER SetForegroundWindow ;
IN WIN32API INTEGERSetForegroundWindow(lnHandle)
RETURN
ENDFUNC
Seems to work - you just have to make sure that the window is indeed visible.
+++ Rick ---
Hi Rick,
Thanks for that info. I think I will demo to my client as it is, and if they like the general principle, I will then investigate a Web browser control in a top-level window.
David.
Yup I've run into this myself in Help Builder. It's messy and there's no easy solution to this - you basically would have to use the Windows API functions to find the window by name then force it to the top of the Window stack. There are functions in wwAPI that can help with most of that but it takes quite a bit of trial and error.
In Help Builder where I use a Web Browser for live preview I had those same problems, so I decided to ditch Internet Explorer application object in an external browser and instead use a Web Browser Control in a top level window. This allows much more control over the window and also works around some of the problem of using the IE object in your app (like IE doesn't release and you can only bring up so many instances before it won't work anymore).
+++ Rick ---
This is not a WestWind question, but maybe someone could help:
In a VFP app, I am calling up IE and navigating it to a relevant website connected to the app.
So, starting IE with:
oBrowser = Createobject("InternetExplorer.Application")
oBrowser.Visible = .T.
After I run this, the browser is sometimes behind the VFP window. How can I bring the IE window to the front so the user will see it?
Thanks,
David.
West Wind Technologies
Making waves on the Web
from Maui
I have wwApi with your Client Tools, so am calling ActivateWindows there - and it works.
David.
So I looked at my old code you can do somehting like this:
o = CREATEOBJECT("InternetExplorer.Application")
o.Visible = .t.
? o.ParentDO wwAPI
Winapi_sleep(2000)
?o.Parent.HWND
ActivateWindow(o.Parent.HWND)
ActivateWindow looks like this:
************************************************************************
* wwAPI :: WinApi_ActivateWindow
****************************************
*** Function: Activates the
*** Assume:
*** Pass: lcTitle - Exact Window Title or Window Handle Number
*** Return:
************************************************************************
FUNCTION ActivateWindow(lcTitle,lnParentHandle)IF VARTYPE(lcTitle) = "C"
IF EMPTY(lnParentHandle)
lnParentHandle = 0
ENDIF
DECLARE INTEGER FindWindow ;
IN WIN32API ;
STRING cNull,STRING cWinNamelnHandle = FindWindow(lnParentHandle,lcTitle)
ELSE
lnHandle = lcTitle
ENDIFDECLARE INTEGER SetForegroundWindow ;
IN WIN32API INTEGERSetForegroundWindow(lnHandle)
RETURN
ENDFUNC
Seems to work - you just have to make sure that the window is indeed visible.
+++ Rick ---
Hi Rick,
Thanks for that info. I think I will demo to my client as it is, and if they like the general principle, I will then investigate a Web browser control in a top-level window.
David.
Yup I've run into this myself in Help Builder. It's messy and there's no easy solution to this - you basically would have to use the Windows API functions to find the window by name then force it to the top of the Window stack. There are functions in wwAPI that can help with most of that but it takes quite a bit of trial and error.
In Help Builder where I use a Web Browser for live preview I had those same problems, so I decided to ditch Internet Explorer application object in an external browser and instead use a Web Browser Control in a top level window. This allows much more control over the window and also works around some of the problem of using the IE object in your app (like IE doesn't release and you can only bring up so many instances before it won't work anymore).
+++ Rick ---
This is not a WestWind question, but maybe someone could help:
In a VFP app, I am calling up IE and navigating it to a relevant website connected to the app.
So, starting IE with:
oBrowser = Createobject("InternetExplorer.Application")
oBrowser.Visible = .T.
After I run this, the browser is sometimes behind the VFP window. How can I bring the IE window to the front so the user will see it?
Thanks,
David.
David