Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Opening a Web Site via Modi Menu
Message
From
18/08/2004 12:16:45
 
 
To
18/08/2004 11:34:07
Freddie Rodrigues
Bitrun Business Solutions
Mumbai, India
General information
Forum:
Visual FoxPro
Category:
Menus & Menu designer
Miscellaneous
Thread ID:
00934137
Message ID:
00934158
Views:
25
>How could I open a web page such as "Visual Foxpro on the Web" as in the Help of Visual Foxpro, using a menu pad of the MODI MENU.
>
>Thanks,
>Freddie Rodrigues


I suggest you call a prg. Below you find an example of such a prg.

Suppose this is the content of the file VisitViafox.prg:
local lcExec

lcExec = ExecutableFound( "htm" )
if not empty( lcExec )
	StartExecutable( lcExec, "http://www.viafox.nl" )
else
	wait window "No Internet connection available" nowait
endif

RETURN

*	ExecutableFound() will return the reference to the present executable for the file extension.
*	An empty return value indicates that there's no executable for that extension present.
*	We're not interested in the cause of a failure. However, that info *could* be given.

* Parameters:
*	tcExtension		Obliged parameter. File extension that triggers the executable. E.g. "htm", "txt", "app"

* Result:
*	lcBrowserExec	The reference (path+file) to the executable. An empty string indicates that there's 
*					no executable for that extension present.

* Changes:
*	22/sep/2003 pdv Created.

FUNCTION ExecutableFound
	lparameter tcExtension
	
	local lnResult, lcBrowserExec, lcFileName, lcFileDir, llFound

	lcBrowserExec = space( 255 )
	lcFileName    = sys( 2023 ) + sys( 3 ) + "." + m.tcExtension
	lcFileDir     = ""
	
	strtofile( m.tcExtension, m.lcFileName )

	declare integer FindExecutable in shell32.dll string, string, string

	*	Find the application associated with the extension.
	lnResult = FindExecutable( @lcFileName, @lcFileDir, @lcBrowserExec )

	lcBrowserExec = iif( m.lnResult >= 32, trim( m.lcBrowserExec ), '' )

	*!*		*	Error messages if the return value is < 32
	*!*		DO CASE
	*!*		case lnResult >= 32		&& ok 
	*!*		CASE lnResult = 2 
	*!*			Wait wind "Bad association, oops!" 
	*!*		CASE lnResult = 31
	*!*			Wait wind "No association, oops!" 
	*!*		CASE lnResult = 29 
	*!*			Wait wind "Can't start the application, oops!" 
	*!*		CASE lnResult = 30 
	*!*			Wait wind "The application is already started, oops!" 
	*!*		ENDCASE

	delete file ( m.lcFileName )

	clear dlls FindExecutable
	
	RETURN m.lcBrowserExec
	
* * * * * * * * * * * *
*	StartExecutable() will start an executable with the Shell32.ShellExecute("open") command.
*	You should have tested for the existence of the executable beforehand!

* Parameters:
*	tcExec		Name of the executable. It should be retrieved with ExecutableFound() beforehand.
*	tcParm		Parameter for the executable.

* Result:
*	Whether or not it succeeded in starting the executable with the parameter.

* E.g.:
*	lcExec = ExecutableFound( "htm" )
*	if not empty( lcExec )
*		StartExecutable( lcExec, "http://www.viafox.nl" )
*	endif

* Changes:
*	22/sep/2003 pdv Created.

FUNCTION StartExecutable
	lparameter tcExec, tcParm

	local lnResult

	declare integer ShellExecute in shell32.dll ;
		integer nWinHandle, ;
		string  cOperation, ;
		string  cFileName, ;
		string  cParameters, ;
		string  cDirectory, ;
		integer nShowWindow 

	lnResult = ShellExecute( 0, "Open", m.tcExec, m.tcParm, "", 1 ) 

	clear dlls ShellExecute

	RETURN ( m.lnResult >= 32 )
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Previous
Reply
Map
View

Click here to load this message in the networking platform