Results 1 to 4 of 4

Thread: Menu - Run exe file error

  1. #1

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    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

    Name:  error.jpg
Views: 172
Size:  5.0 KB

    Did I miss something?

  2. #2
    PowerPoster VanGoghGaming's Avatar
    Join Date
    Jan 2020
    Location
    Eve Online - Mining, Missions & Market Trading!
    Posts
    2,644

    Question 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

  3. #3
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,667

    Re: Menu - Run exe file error

    Use the ShellExecute API instead of Shell.

  4. #4

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    Re: Menu - Run exe file error

    Thank you. When did this change? Working now so thank you to you both.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width