Skip to content

Planet-Source-Code/luis-cantero-open-default-email-client-browser-to-your-address__1-969

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

Open default email client/browser to your address

Description

Sometimes in the about box of your program you want to put your email address, and web site address, wouldn't it be great if at one click the default email client would open with your address in it?, or the default web browser to your address?, and a plus!, open any file to its association, all of this with no declarations, no APIs, and with ONE line of code? Sounds impossible? here's how:

More Info

Email address or Web site address or File name to open with path.

Returns nothing, the good thing, it doesn't generate errors, if an association is not found it does nothing, just stays quiet, instead of crying "ERROR!, I don't know what to do!".

Submitted On
By Luis Cantero
Level Beginner
User Rating 5.0 (5 globes from 1 user)
Compatibility VB 4.0 (32-bit), VB 5.0, VB 6.0
Category Internet/ HTML
World Visual Basic
Archive File

Source Code

'Instead of writing declarations and everything to open a web browser to your page try this:
Shell "Start.exe " & "www.LCen.com", 0
'The program start.exe executes the shell for any program in windows95, try this:
Shell Start.exe " & "mailto:dummydummy111@dummyserver.com", 0
'The line above will open the default mail client with your address on it, also:
Shell "Start.exe " & "mailto:abcd@usa.com?Subject=Hello", 0
'With the subject "Hello" already filled.
'The following line will open an html file with the default browser:
Shell "Start.exe " & "c:\hellopage.htm", 0
'If you have a program with a filelist box, try this to open the shell of a file with a double click event:
Shell "Start.exe " & """" & Filelist1.Path & Filelist1 & """", 0
'Or try this, specially for WinNT (2000/XP, etc.):
Shell "Explorer.exe " & "www.LCen.com", 0
'The possibilities are endless, have fun!
<BR>
'Start.exe however doesn't work on WinNt/2000/XP, so use the following API which will always work:
Private Declare Function ShellExecute Lib "shell32" 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
'Sample call:
ShellExecute hWnd, vbNullString, "mailto:dummydummy111@dummyserver.com?body=hello%0a%0world", vbNullString, vbNullString, vbNormalFocus
'In order to be able to put carriage returns or tabs in your text, replace vbCrLf and vbTab with the following HEX codes:
%0a%0d = vbCrLf
%09 = vbTab
'These codes also work when sending URLs to a browser (GET, POST, etc.)
'Luis Cantero
L.C. Enterprises
http://LCen.com

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published