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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to open IE 6.0 with VFP 7.0 using ShellExecute?

Status
Not open for further replies.

anyhandle

Programmer
Dec 1, 2000
57
US
Hi,

So far I have the following code,

release objexec,pcfile
public objexec,pcfile
SW_SHOWNORMAL=1
pcfile="c:\program files\interent explorer\iexplore.exe"
&& not the best way but ok for now

objexec.ShellExecute(pcfile,"open","filename.html",.null.,.null,SW_SHOWNORMAL)
release objexec

The above was my attempt to convert from Visual C code. I get an error stating that a parameter is missing in line 14 of shellexecute. How should this line read in FoxPro?

Thanks
 
DECLARE INTEGER ShellExecute IN "Shell32.dll" ;
INTEGER hwnd, ;
STRING lpVerb, ;
STRING lpFile, ;
STRING lpParameters, ;
STRING lpDirectory, ;
LONG nShowCmd
* Open Word to edit the file "c:\mywordfile.doc"
=Shellexecute(0,"Open","c:\mywordfile.doc","","",0)
* Open the default browser and navigate to Universal Thread
=Shellexecute(0,"Open","* Open the default mail reader to address a letter to the VFP wish list
=Shellexecute(0,"Open","mailto:foxwish@microsoft.com?subject=A VFP Wish","","",0)
* Print the text file "c:\mytextfile.txt"
=Shellexecute(0,"Print","c:\mytextfile.txt","","",0)

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Thanks very much! I wouldn't have known this was necessary.
 
anyhandle

Thanks very much! I wouldn't have known this was necessary.

ShellExecute is an API that needs to be declared only once (In your main program), declare the following only once:
Code:
DECLARE INTEGER ShellExecute IN "Shell32.dll" ;
    INTEGER hwnd, ;
    STRING lpVerb, ;
    STRING lpFile, ;
    STRING lpParameters, ;
    STRING lpDirectory, ;
    LONG nShowCmd

And everytime you need to use it you only need the following:
Code:
=Shellexecute(0,"Print","c:\mytextfile.txt","","",0)

P.S. There are other ways to use Internet Explorer in VFP, faq184-1770 shows you two other ways and there is also this way:
Code:
oIE = createobject("internetexplorer.application")
oie.Navigate2("c:\filename.html")
oie.Visible = .t.



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top