Hello,<br>
<br>
I know now how it's work:<br>
<br>
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<br>
<br>
dim result, File<br>
<br>
File = "C:\weiss.bat"<br>
<br>
result = ShellExecute(0, "OPEN", File, "", App.Path & "\", 0)<br>
<br>
Now my new question:<br>
<br>
I want to do this syncron! Can some help me and say me the right parameter?<br>
<br>
thanks<br>
<br>
aweiss
I don't think it's a parameter.<br>
<br>
The only way I know how to do it is a bit involved but it is in a module and quite easy to use. I can email you the code if you like - drop me a line<br>
<br>
-ml <p>Mike Lacey<br><a href=mailto:Mike_Lacey@Cargill.Com>Mike_Lacey@Cargill.Com</a><br><a href=
What do you actually want to do with it. <br>
Open a particular file with a particular editor or something else ? <p>Ravi Kochher<br><a href=mailto:rkochher@ssius.com>rkochher@ssius.com</a><br><a href= > </a><br>
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="
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.