Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HTML to run prg
Message
From
31/01/2011 20:33:58
Mike Sue-Ping
Cambridge, Ontario, Canada
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Miscellaneous
Thread ID:
01498033
Message ID:
01498077
Views:
71
>Could someone give me an example of HTML code I can put in a web page, running locally in the MS Browser control, that will call a program with parameters? I can already create the HTML and display it in the browser control. Now I need the HTML code so when the user clicks on a link it will call my local PRG with a parameter.

In your html code for the link you need to put a "special href", something like the following:
<a href="VFPS://myprogram(parameters)">Run my VFP program...</a>
Then in the MS Browser control, you need to intercept the browser's default behavior to want to navigate to the new URL. In the BeforeNavigate2 method of the control, put code something like this:
*** ActiveX Control Event ***
LPARAMETERS pdisp, url, FLAGS, targetframename, postdata, headers, CANCEL

DO CASE
	CASE LEFT(UPPER(url),7) = "VFPS://"
		m.lcProgram2Run = SUBSTR(url,8)
		DO (m.lcProgram2Run)

		CANCEL = .T.  && don't want to actually go to the lcUrl
ENDCASE
It is important to set the CANCEL parameter to .T. to avoid having the browser doing its default navigation to your url. I highly recommend that you read Rick Strahl's excellent white paper at http://www.west-wind.com/presentations/shellapi/shellapi.asp It may be old but its GOLD!! Pay particular attention to the section entitled "The Web Browser Control". It should be enough for you to get started and the stuff you'll be able to do with it is amazing. I'm running jQuery scripts from within my VFP app to add some extra pizazz!!
Previous
Reply
Map
View

Click here to load this message in the networking platform