Runtime Error 5 running external program from VB5 in VISTA

drleewood
drleewood used Ask the Experts™
on
How do I run an external exe from my VB5 program running under VISTA with UAC enabled on. I use the standard,

X=Shell(Program.exe)

The external program runs fine if User Access Control is turned off.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
I can try this instead of the VB shell function,  but will it solve the problem of Vista not running an exe file if UAC is turned on?
As far as I know, yes
11/26 Forrester Webinar: Savings for Enterprise

How can your organization benefit from savings just by replacing your legacy backup solutions with Acronis' #CyberProtection? Join Forrester's Joe Branca and Ryan Davis from Acronis live as they explain how you can too.

Author

Commented:
It will take me a little while to test it out.  Will let you know.  Thank you.

Author

Commented:
That seems to work.  Thank you.  Is there a similar function for ending an exe program?

Author

Commented:
Is there a similar function for closing an EXE program?
You mean terminating a process? Try TerminateProcess API,

OpenProcess
GetExitCode
TerminateProcess

3 APIs you have to call one by one...

Author

Commented:
I have a server running the same exe,  each one started in it's own folder.  I want to write a VB program to close all the programs.  It uses the code

    lngHwnd = FindWindow(vbNullString, strExeCaption)
    If lngHwnd <> 0 Then
        lngRetVal = PostMessage(lngHwnd, WM_CLOSE, 0&, 0&)
    End If

It works but if there are any open files,  I get VB error 75,  path not found.  Then I have to manually close each program from the task bar.  Was thinking maybe another type of function that terminated the program would close the open files as well.
Yes, instead of PostMessage, as I said try OpenProcess, GetExitCode, TerminateProcess, see internet for samples

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial