Have successfully used this code on my own & one of my client's machines to elevate privileges in Window 7. A UAC pops up and the program (a VFP compiled batch file which copies and registers some DLL's) runs.
#define SW_SHOWNORMAL 1
#define SW_SHOWMINIMIZED 2
#define SW_SHOWMAXIMIZED 3
DECLARE INTEGER ShellExecute IN "shell32" INTEGER, STRING, ;
STRING, STRING, STRING, INTEGER
m.lnOwnerHWND = 0
m.lcCommand = "runas"
m.lcTarget = "Some VFP Exe"
m.lcDirectory = ""
ShellExecute(m.lnOwnerHWND, m.lcCommand, m.lcTarget, m.lcParams, m.lcDirectory, SW_SHOWNORMAL)
However for one of my clients (logged in as Domain Administrator):
1.The UAC pops up
2.The User answers Yes
3.There is a brief screen flash (looks like VFP starts) and then nothing..
Think that there is a problem Copying to the Windows System folder (in this case C:\WINDOWS\sysWOW64 folder).
The program will run correctly if the User has previously attempted a manual Copy to the C:\WINDOWS\sysWOW64 folder and answered another UAC box.
Any experiences/suggestions anyone?