Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to find a name of Default mail client
Message
From
23/12/2002 15:55:12
Fabian Belo
Independent Developer
Argentina
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00735378
Message ID:
00735505
Views:
20
This message has been marked as a message which has helped to the initial question of the thread.
Well. I just found this small routine which gets the default email client NAME and launchs the application. (Original in spanish by Jose Enrique Llopis)
Enjoy.
****************************** StrtMail.prg*************************
*** StartMail


#DEFINE HKEY_CLASSES_ROOT           -2147483648  && (( HKEY )
0x80000000 )
#DEFINE HKEY_CURRENT_USER           -2147483647  && (( HKEY )
0x80000001 )
#DEFINE HKEY_LOCAL_MACHINE          -2147483646  && (( HKEY )
0x80000002 )
#DEFINE HKEY_USERS                  -2147483645  && (( HKEY )
0x80000003 )


FUNCTION StartMail

	LOCAL lcOpenCommand

	oControlRegistry1 = CREATEOBJECT("ControlRegistry")


************************************************************************
**** getting th default email client NAME! **********	
	lcMailClient = ;

oControlRegistry1.ReadRegistryString(HKEY_LOCAL_MACHINE,;
        "Software\Clients\Mail",;
		"")

	IF EMPTY(lcMailClient)
		Aviso("No email client installed")
		RETURN
	ENDIF

	DO CASE
		CASE lcMailClient = "Exchange"
		CASE lcMailClient = "Internet Mail and News"
		CASE lcMailClient = "Outlook Express"
		CASE lcMailClient = "Microsoft Outlook"
		OTHERWISE
			Aviso("Client not supported")
	ENDCASE

	*** Gets the command to launch
	lcString =
"Software\Clients\Mail\"+ALLTRIM(lcMailClient)+"\shell\open\command"

	lcOpenCommand = ;

oControlRegistry1.ReadRegistryString(HKEY_LOCAL_MACHINE,;
        lcString,;
		"")


	IF EMPTY(lcOpenCommand)
		RETURN .F.
	ENDIF


	ON ERROR DO Nothing

	IF !EMPTY(lcOpenCommand)
		RUN /N1 &lcOpenCommand
	ENDIF
	
	DO ..\Progs\ErrHand.prg
	
	RETURN .T.
	
ENDFUNC



FUNCTION Nothing

	&& Just that...nothing

ENDFUNC
"Since I've read that alcohol is bad... I quit reading."
Me


http://www.fabianbelo.com.ar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform