Home All Groups Group Topic Archive Search About

Shell( ) inconsistency with actual windows interfac

Author
10 Dec 2006 9:41 AM
David Kanter
Hi,

I have some VB scripts which start by opening an application, in this case
it is a game called FEAR (some of you may be familiar).  I am using Visual
Studio 2005 Professional Edition running on Windows XP x64.  I am using the
script on the same system.

I can open FEAR manually on the system; I just double click the short cut
and everything is good.  However, the following line in my application does
not appear to produce the same results:

ProcID = Shell("C:\Program Files (x86)\Sierra\FEAR\FEAR.exe",
AppWinStyle.NormalFocus)

AFAIK, this should do the trick.  However, it gives me a strange error
(something about being unable to initialize because it cannot get some game
resources).

Does anyone have any ideas why the shell command is giving me different
results than simply opening the app manually?  I've never seen that before. 
Could it be the result of some funky copy protection on the game?

Thanks in advance,


David

Author
10 Dec 2006 11:59 AM
Robinson
Yes, the "working directory" of the process expects to be in \FEAR but it is
actually the directory of your program.  Use the "Process" object to launch
it, setting the working directory (via. the StartInfo property).
Author
12 Dec 2006 10:32 AM
David Kanter
"Robinson" wrote:

>
> Yes, the "working directory" of the process expects to be in \FEAR but it is
> actually the directory of your program.  Use the "Process" object to launch
> it, setting the working directory (via. the StartInfo property).

Your diagnosis definitely appears to be right; I moved the .exe to the /fear
directory and it worked like a charm.

I'm using Shell because it returns the PID.  Does "Process" also return the
PID, or could I just call an attached function to retrieve it?

Thanks,

David