On 2007-09-24 14:09, Joe Greer wrote:
Al*********@yahoo.com wrote in news:1190472424.506355.161160@
19g2000hsx.googlegroups.com:
>Hi all. I recently made a program to retreive the process ID of a
process. It is written in C/C++ and works fine when I launch it from
Visual Studio 2005. However, when i launch it from a command prompt or
from explorer, it only returns a new line for the process ID.
GetLastError() returns 0. I dont understand why this happens seeing as
how it works fine from VS. I would like to know how to fix this.
Thanks in advance.
Generally, this is because there is some assumption made about an
uninitialized variable. The IDE tends to initialize things to a known
value, whereas this doesn't happen normally.
We are getting off-topic here but I'd just like to point out that the
IDE does not do anything but launch the executable and attach the
debugger. However it might be possible that the executable launched by
the OP is the release version while he/she launched the debug version,
which do initialise variables, from the IDE.
--
Erik Wikström