Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Start IE Maximized from VFP

Status
Not open for further replies.

mkrausnick

Programmer
Apr 2, 2002
766
US
How do I start IE from VFP in a maximized state instead of a normal window. This doesn't work:
Code:
oIE=CreateObject("InternetExplorer.Application")                       
oIE.Visible=.T.
oIE.WindowState=2
Neither does this:
Code:
oIE.Application.WindowState=2
In both cases, I get "Error 1426 - unknown name.

Thanks for your help.

Mike Krausnick
Dublin, California
 
Take a look at
faq 184-1770 by mgagnon
has the following code which will open in full window

LOCAL loHyperlink
loHyperlink = CREATEOBJECT("hyperlink")
loHyperlink.navigateto("
there is also other example that starts ie in a form
wjwjr
 
Mike,

You say you want to open IE from VFP. You didn't say you if you want to get an object reference for automation purposes.

If you simply want to launch IE, try this:

Code:
DECLARE INTEGER ShellExecute IN shell32.dll ; 
  INTEGER hndWin, ; 
  STRING cAction, ; 
  STRING cFileName, ; 
  STRING cParams, ;  
  STRING cDir, ; 
  INTEGER nShowWin

cFileName = "<any URL>" 
cAction = "open" 
ShellExecute(0,cAction,cFileName,"","",3)

The final parameter to ShellExecute determines the window state (3 = maximised).

If you don't want to open any specific URL, you could set cFileName to "about:blank".

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Thanks for the replies.

wjw: The statement "loHyperlink = CREATEOBJECT("hyperlink")
" creates opens the default browser, which in my case is Firefox. In this application I need to specifically open IE.

Mike: Unfortunately I do need a reference to the IE object. I am essentially doing automated data entry, so I'm plugging values into fields and clicking submit buttons.

Mike Krausnick
Dublin, California
 
Mike,

Unfortunately I do need a reference to the IE object.

I thought that might be the case.

One possibility to try:

Code:
oIE.TheaterMode =.T.

It's not quite what you want, but it might be worth trying.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Sadly I have researched and found that the facility to maximize an IE window does not exist through automation. It can't even be done via javascript. It can be done with HTML Applications (.HTA files) but that invokes lots of nasty security issues.

In addition to Mike's suggestion, I also tried full-screen mode but was unable to make that work in my case either, as I need the menubar and toolbar.

Sometimes you're the windshield and sometimes you're the bug.

Mike Krausnick
Dublin, California
 
Mkrusnik,
Have you researched news2news.com? Mike's example looks a lot like much of the code I find there.
wjwjr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top