Author | Topic: Shell and Internet Explorer Controls | |
---|---|---|
Bengt Ovelius | Shell and Internet Explorer Controls on Fri, 14 May 2004 21:57:04 +0200 Interesting and simple idea: Using the Windows Shell API and Internet Explorer Controls http://www.west-wind.com/presentations/shellapi/shellapi.asp This interesting article is about FoxPro, but the same should be possible in XBASE ALASKA XBASE Example: This command works and opens Internet Explorer and the file WEB.HTM RUNSHELL("/C WEB.HTM") In this article, a very useful function GoUrl() is created Can anyone tell how to write the same GoUrl() in XBASE ????? In foxpro it is basically 2 lines of code that does the basic job: FUNCTION GoUrl(tcUrl, tcAction, tcDirectory, tcParms) RETURN ShellExecute(FindWindow(0,_SCREEN.caption), tcAction,tcUrl, tcParms, tcDirectory,1) (see the link for details!) With this only function, you can *open websites *access FTP *open doc's *open zip's *send emails *display HTM-files etc...... from FoxPro Syntax examples GoUrl("ftp://www.west-wind.com/") GoUrl("d:\articles\fpa\shellexecute.doc") GoUrl("mailto:xxx@yyy-zzz.com") This function can be quite useful, here an example how to show a map based on state and zip GoUrl("http://www.mapquest.com/maps/map.adp?country=" + ; lcCountry + "&addtohistory=&address=" + ; UrlEncode(lcStreet) + ; "&city=" + UrlEncode(lcCity) + "&state=" + ; UrlEncode(lcState) + "&zipcode=" + ; UrlEncode(lcZip) + "&homesubmit=Get+Map&size=big") Can anyone tell how to write the same GoUrl() in XBASE ????? It should be possible to get a lot of functionality with only a single line of code, after these principles. Best regards Bengt Ovelius | |
Anand Gupta | Re: Shell and Internet Explorer Controls on Sat, 15 May 2004 16:14:41 +0530 LoadFromURL() in ASINET Anand "Bengt Ovelius" <picotech@telia.com> wrote in message news:vzJRu2eOEHA.6512@S15147418... > Interesting and simple idea: > > Using the Windows Shell API and Internet Explorer Controls > http://www.west-wind.com/presentations/shellapi/shellapi.asp > This interesting article is about FoxPro, but the same should be possible in > XBASE > <snip> | |
Scott Smith | Re: Shell and Internet Explorer Controls on Sat, 15 May 2004 06:40:34 -0700 /*************************************************************************** *** Procedure ....: OpenURL Description ..: open URL / run windows program/file Parameters ...: string : URL */ PROCEDURE OpenURL( cURL ) LOCAL hWnd IF AppType() == APPTYPE_VIO this next line should be cleaned up because the window may not have focus... but works for now... hWnd := DllCall( "USER32.DLL", DLL_STDCALL, "GetForegroundWindow" ) DllCall("SHELL32.DLL",DLL_STDCALL,"ShellExecuteA",hWnd,"Open",cURL,Nil,CurDi r(),SW_RESTORE) ELSE DllCall("SHELL32.DLL",DLL_STDCALL,"ShellExecuteA",AppDeskTop():getHWnd(),"Op en",cURL,Nil,CurDir(),SW_RESTORE) ENDIF RETURN | |
Scott Smith | Re: Shell and Internet Explorer Controls on Sat, 15 May 2004 06:44:59 -0700 Not sure why this didn't show up... 2nd attempt... /*************************************************************************** *** Procedure ....: OpenURL Description ..: open URL / run windows program/file Parameters ...: string : URL */ PROCEDURE OpenURL( cURL ) LOCAL hWnd IF AppType() == APPTYPE_VIO hWnd := DllCall( "USER32.DLL", DLL_STDCALL, "GetForegroundWindow" ) DllCall("SHELL32.DLL",DLL_STDCALL,"ShellExecuteA",hWnd,"Open",cURL,Nil,CurDi r(),SW_RESTORE) ELSE DllCall("SHELL32.DLL",DLL_STDCALL,"ShellExecuteA",AppDeskTop():getHWnd(),"Op en",cURL,Nil,CurDir(),SW_RESTORE) ENDIF RETURN | |
Phil Ide | Re: Shell and Internet Explorer Controls on Mon, 17 May 2004 09:57:46 +0100 Hi Bengt, > Can anyone tell how to write the same GoUrl() in XBASE ????? > It should be possible to get a lot of functionality with > only a single line of code, after these principles. Aside from the 'ShellExcuteA' examples peple have already posted, you could take a look at my printerAPI, which contains this function: WinAPIOpen(cFile, cParms, cDirectory, nOpenMode ) -> lOk Parameters: cFile - the name of the document/file to print cParms - string containing any additional parameters passed to the application cDirectory - directory to be used as current when running the 'open' application nOpenMode - minimised/maximised etc. (just use the default) Returns: lOk - TRUE if no errors encountered launching application (note, this does not mean the application doesn't get any errors once it is running). To open a URL, just do this: WinAPIOpen( 'http://www.idep.org.uk/xbase' ) Regards, Phil Ide You're the reason our kids are so ugly | |
Bengt Ovelius | Re: Shell and Internet Explorer Controls on Mon, 17 May 2004 13:18:52 +0200 Hi Phil, after searching and finding these two libs: 1998-06-17 01:00 1 103 672 UUID.LIB 1998-05-13 01:00 44 858 WINSPOOL.LIB the PrinterAPI TEST.PRG works great ! (Hope they are the right versions) To integrate this into an existing project, I tried just to link in the PrinterApi.LIB But it doesn't work. What is your suggestion, to access WinAPIOpen(cFile, cParms, cDirectory, nOpenMode ) easily, without having to recompile/relink all the components in PrinterApi each time and change the XPJ of each project ? Best regards Bengt Ovelius | |
Phil Ide | Re: Shell and Internet Explorer Controls on Mon, 17 May 2004 13:09:09 +0100 Bengt, > What is your suggestion, to access > WinAPIOpen(cFile, cParms, cDirectory, nOpenMode ) > easily, > without having to recompile/relink all the components > in PrinterApi each time > and change the XPJ of each project ? Try this in a new sourcefile: Function WinAPIOpen(cFile, cParms, cDirectory, nOpenMode ) DEFAULT nOpenMode to SW_SHOWNORMAL,; SW_HIDE,; cDirectory TO CurDir() Return ShellExecuteA( AppDesktop():GetHWND(), "open", cFile,; cParms, CurDir(), nOpenMode ) > 32 DLLFUNCTION ShellExecuteA( nHWND, cOperation, cFile, cParms,; cDirectory, nOpenMode ) USING OSAPI FROM SHELL32.DLL Regards, Phil Ide Fish are so hard to toilet train. |