Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Default Browser
Message
De
11/08/2001 17:13:57
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
11/08/2001 02:32:07
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Divers
Thread ID:
00542144
Message ID:
00542670
Vues:
29
This message has been marked as the solution to the initial question of the thread.
>Hi Hilmar
>
>That does indeed work and its completely new to me. Very interesting. A small problem with it though is the DOS box that comes up when loading. Be nice if that could go. Is 'Start' a dos command?

Yes, START is a DOS command.

OK, I found it. Use the following function, that uses the Windows API, to open any document with its default extension. If that is what you want, you don't need to find out which actually IS the default browser.
********************************************************************************
* Copied (and adapted) from the UniversalThread (FAQ#7656, by Gérald Santerre)
* According to the author, opens an HTML document or mail.
* Actually helps to open *any* document with its default association.

FUNCTION RunDoc(tlDocument)
local lnResult

DECLARE INTEGER ShellExecute ;
	IN SHELL32.dll ;
	INTEGER nWinHandle, ;
	STRING cOperation, ;
	STRING cFileName, ;
	STRING cParameters, ;
	STRING cDirectory, ;
	INTEGER nShowWindow

**retreive the main VFP window handle (this handle is used by ShellExecute)

DECLARE INTEGER FindWindow ;
	IN WIN32API ;
	STRING cNull, ;
	STRING cWinName

lnResult=ShellExecute(FindWindow( 0, _SCREEN.caption), "Open", tlDocument, "", "c:\temp\", 1)

**Error messages if the return value is < 32
IF lnResult < 32
	DO CASE
	CASE lnResult=2
		Wait wind "Asociación inválida, o URL inválido."
	CASE lnResult=31
		Wait wind "Falta la asociación."
	CASE lnResult=29
		Wait wind "No se puede iniciar la aplicación."
	CASE lnResult=30
		Wait wind "La aplicación ya está abierta."
	ENDCASE
ENDIF
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform