Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mailto-link in Vusal Basic 6 form 2

Status
Not open for further replies.

Perra

Technical User
Dec 28, 2000
38
SE
Hello!

How do you create a mailto-link in a Visual Basic form?

Grateful for tips!

/Perra Swedish programmer
 
ret = ShellExecute(0&, vbNullString, "mailto:" & Email, vbNullString, "C:\", 1)
 
Hello again!

I just got a helpful tips about opening the default e-mail-program by calling the function Shell("c:\Program\Microsoft Office\Office\outlook.exe")

But what if the user/customer doesn´t have the default mail-client on that "hard-coded" path.

How can you make the application dynamically set the path
for each and every different system??


Is it about creating DLL's or something?

/Perra Swedish programmer
 
Do like CIMD suggests and call ShellExecute with a "mailto:" link. This will automatically open the default email program, whether it's Outlook Express, Eudora, or whatever.

What happens is the shell recognizes that it's an email link, and looks in the registry to find what program is registered to respond. It then calls that program, which ought to open up a new message form with the destination address already filled in (some might not).

Chip H.
 
If you want to open te default mail-client just declare the shellExecute API and call it:
Sub Email()
ret = ShellExecute(0&, vbNullString, "mailto: Perra@perra.es" ,vbNullString, "C:\", 1)
endSub
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
 
l = ShellExecute(0&, vbNullString, " vbNullString, vbNullString, vbNormalFocus)

Easy

or

l = ShellExecute(0&, vbNullString, "mywordfile.doc", vbNullString, vbNullString, vbNormalFocus)


and so on Peter Meachem
peter@accuflight.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top