ShellExecuteEx

Everything else that doesn't fall into one of the other PB categories.
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

ShellExecuteEx

Post by SFSxOI »

Does anyone have any problems with using the ShellExecuteEx API on 64 bit Windows Vista or Windows 7 systems?
The advantage of a 64 bit operating system over a 32 bit operating system comes down to only being twice the headache.
lexvictory
Addict
Addict
Posts: 1027
Joined: Sun May 15, 2005 5:15 am
Location: Australia
Contact:

Re: ShellExecuteEx

Post by lexvictory »

what problems are you having? it works fine here on Win 7
Demonio Ardente

Currently managing Linux & OS X Tailbite
OS X TailBite now up to date with Windows!
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Re: ShellExecuteEx

Post by SFSxOI »

lexvictory wrote:what problems are you having? it works fine here on Win 7
not really a problem, just a slightly different operation behavior in a 64 bit system that sort of suprised me. In "sketching" out some code today for a project I used this:

Code: Select all

Procedure Elevated_Cmd(app_dir.s, app_name.s)
AppVerb$ = "runas"
AppName$ = app_name
AppDir$ = app_dir

shExecInfo.SHELLEXECUTEINFO 
shExecInfo\cbSize=SizeOf(SHELLEXECUTEINFO) 
shExecInfo\fMask=#Null 
shExecInfo\hwnd=#Null 
shExecInfo\lpVerb=@AppVerb$
shExecInfo\lpFile=@AppName$ 
shExecInfo\lpDirectory=@AppDir$
shExecInfo\nShow=#SW_NORMAL

exe.i = ShellExecuteEx_(@shExecInfo)

ProcedureReturn exe

EndProcedure
In experimenting some while working out a few things i accidently passed the full path to the .exe to the above procedure, and it worked. Before today I had worked on things using that with just 32 bit, but this project was intended to operate on 64 bit and 32 bit. In the past 32 bit usage in Vista and Windows 7 I passed just the .exe name to the app_name.s parameter and it worked fine, but when I pass just the app name here it didn't work in the 64 bit Windows 7, but when I passed the full path (accidently) it worked fine. So I was just wondering, seeing as I had not messed with doing anything with 64 bit in mind before, if there was some sort of difference i'm not aware of that would cause this behavior.
The advantage of a 64 bit operating system over a 32 bit operating system comes down to only being twice the headache.
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Re: ShellExecuteEx

Post by Rescator »

Depends on the exe you try to run.
For example a 32bit program can run a 32it or 64bit exe.
but I'm not so sure if a 64bit program will call a 32bit exe as I assume that 64bit windows does not search the 32bit exe system path?
But it will let search the 32bit and 64bit system paths on 32bit for compatibility reasons I assume?
Just a guess though, ever really tested such behavior.
Post Reply