1 Attachment(s)
Menu - Run exe file error
Is this still the command to load an exe from the menu?
Code:
Option Explicit
'Constants for use in 'shellexecute'
Const SW_NORMAL = 1
Const SW_SHOW = 5
'The shell execute API declarations
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
'window thingy
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40
'declare API
Private Declare Sub SetWindowPos Lib "user32" (ByVal hWnd As Long, _
ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal Y As Long, _
ByVal cX As Long, ByVal cY As Long, ByVal wFlags As Long)
Code:
Shell "Update.exe"
Unload Me
This worked for me long before Windows 10, however when I run this command, I now get an error
Attachment 187015
Did I miss something?
Re: Menu - Run exe file error
If you declared "ShellExecute" then why not use it to open the external app?
Code:
ShellExecute Me.hWnd, vbNullString, "Update.exe", vbNullString, vbNullString, SW_NORMAL
Re: Menu - Run exe file error
Use the ShellExecute API instead of Shell.
Re: Menu - Run exe file error
Thank you. When did this change? Working now so thank you to you both.