Here is it :<br>
<br>
Private Declare Function GetDesktopWindow Lib "user32" () As Long<br>
<br>
Private Declare Function ShellExecute Lib "shell32.dll" _<br>
Alias "ShellExecuteA" _<br>
(ByVal hwnd As Long, ByVal lpOperation As String, _<br>
ByVal lpFile As String, ByVal lpParameters As String, _<br>
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long<br>
<br>
Private Const SW_SHOWNORMAL As Long = 1<br>
Private Const SW_SHOWMAXIMIZED As Long = 3<br>
Private Const SW_SHOWDEFAULT As Long = 10<br>
<br>
<br>
Public Sub RunShellExecute(sTopic As String, sFile As Variant, _<br>
sParams As Variant, sDirectory As Variant, _<br>
nShowCmd As Long)<br>
<br>
Dim hWndDesk As Long<br>
Dim success As Long<br>
Const SE_ERR_NOASSOC = &H31<br>
<br>
'the desktop will be the<br>
'default for error messages<br>
hWndDesk = GetDesktopWindow()<br>
<br>
'execute the passed operation<br>
success = ShellExecute(hWndDesk, sTopic, sFile, sParams, sDirectory, nShowCmd)<br>
<br>
'This is optional. Uncomment the three lines<br>
'below to have the "Open With.." dialog appear<br>
'when the ShellExecute API call fails<br>
'If success = SE_ERR_NOASSOC Then<br>
' Call Shell("rundll32.exe shell32.dll,OpenAs_RunDLL " & sFile, vbNormalFocus)<br>
'End If<br>
<br>
End Sub<br>
<br>
<br>
Private Sub cmdApps_Click(Index As Integer)<br>
<br>
Dim sTopic As String<br>
Dim sFile As String<br>
Dim sParams As Variant<br>
Dim sDirectory As Variant<br>
<br>
Select Case Index<br>
Case 0: 'open doc file with associated app<br>
sTopic = "Open"<br>
sFile = "c:\My Documents\Resources.doc"<br>
sParams = 0&<br>
sDirectory = 0&<br>
<br>
Case 1: 'open txt file with associated app<br>
sTopic = "Open"<br>
sFile = "c:\My Documents\rundll.txt"<br>
sParams = 0&<br>
sDirectory = 0&<br>
<br>
Case 2: 'open wav file with associated app<br>
sTopic = "Open"<br>
sFile = "c:\win\media\Notify.wav"<br>
sParams = 0&<br>
sDirectory = 0&<br>
<br>
Case 3: 'play wav file with associated app<br>
sTopic = "Play"<br>
sFile = "c:\win\media\Notify.wav"<br>
sParams = 0&<br>
sDirectory = 0&<br>
<br>
Case 4: 'open autoexec.bat with notepad<br>
sTopic = "Open"<br>
sFile = "C:\win\notepad.exe"<br>
sParams = "C:\Autoexec.bat"<br>
sDirectory = 0&<br>
<br>
Case 5: 'play avi file with associated app<br>
sTopic = "Play"<br>
sFile = "E:\VB Graphics\avi\Cogs.avi"<br>
sParams = 0&<br>
sDirectory = 0&<br>
Case Else<br>
End Select<br>
<br>
Call RunShellExecute(sTopic, sFile, sParams, sDirectory, SW_SHOWNORMAL)<br>
<br>
End Sub<br>
<br>
<br>
Private Sub cmdBrowser_Click(Index As Integer)<br>
<br>
Dim sTopic As String<br>
Dim sFile As String<br>
Dim sParams As Variant<br>
Dim sDirectory As Variant<br>
<br>
Select Case Index<br>
Case 0: 'send email to address using default email app<br>
sTopic = "Open"<br>
sFile = "mailto:<A HREF="mailto:vbg.be@vbgrpup.nl">vbg.be@vbgrpup.nl</A>"<br>
sParams = 0&<br>
sDirectory = 0&<br>
<br>
Case 1: 'open default browser to specified site<br>
sTopic = "Open"<br>
sFile = "<A HREF="
TARGET="_new">
sParams = 0&<br>
sDirectory = 0&<br>
<br>
Case 2: 'open specified browser to specified site<br>
sTopic = "Open"<br>
sFile = "C:\Program Files\Internet Explorer\iexplore.exe"<br>
sParams = "<A HREF="
TARGET="_new">
sDirectory = 0&<br>
<br>
Case Else<br>
End Select<br>
<br>
Call RunShellExecute(sTopic, sFile, sParams, sDirectory, SW_SHOWNORMAL)<br>
<br>
End Sub<br>
<br>
<br>
Private Sub cmdExplorer_Click(Index As Integer)<br>
<br>
Dim sTopic As String<br>
Dim sFile As String<br>
Dim sParams As Variant<br>
Dim sDirectory As Variant<br>
<br>
Select Case Index<br>
Case 0: 'explorer - rooted, normal view<br>
sTopic = "Open"<br>
sFile = "explorer.exe"<br>
sParams = "/root,c:\program files"<br>
sDirectory = 0&<br>
<br>
Case 1: 'explorer - rooted, explorer view<br>
sTopic = "Open"<br>
sFile = "explorer.exe"<br>
sParams = "/e,/root,c:\program files"<br>
sDirectory = 0& <br>
<br>
Case 2: 'explorer - explorer view, with specified folder<br>
sTopic = "Open"<br>
sFile = "explorer.exe"<br>
sParams = "/e,c:\program files"<br>
sDirectory = 0&<br>
<br>
Case 3: 'explorer - explorer view, with specified drive<br>
sTopic = "Open"<br>
sFile = "explorer.exe"<br>
sParams = "/e,c:\"<br>
sDirectory = 0&<br>
<br>
Case 4: 'explorer - explorer view, current drive<br>
sTopic = "Open"<br>
sFile = "explorer.exe"<br>
sParams = "/e,\"<br>
sDirectory = 0&<br>
<br>
Case 5: 'recycle bin<br>
sTopic = "Open"<br>
sFile = "explorer.exe"<br>
sParams = "/root,::{645FF040-5081-101B-9F08-00AA002F954E}"<br>
sDirectory = 0&<br>
<br>
Case Else<br>
End Select<br>
<br>
Call RunShellExecute(sTopic, sFile, sParams, sDirectory, SW_SHOWNORMAL)<br>
<br>
End Sub<br>
<br>
<br>
Eric De Decker