473,382 Members | 1,749 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Program launches within Visual Stdui 2005, fails otherwise.

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.

Sep 22 '07 #1
3 1245
Al*********@yahoo.com wrote:
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.
This is off topic on comp.lang.c++ - try microsoft visual C++ group. As
an aside, what I usually do in a case like the one you described is I
put a sleep for 30 seconds as the first thing in main() and then I start
it and attach the debugger. It should then behave exactly the same but
this time in the debugger.
Sep 22 '07 #2
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.

joe
Sep 24 '07 #3
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
Sep 24 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Ben Voigt | last post by:
Under certain circumstances I get: First-chance exception at 0x7c812a5b (kernel32.dll) in LTMGUI.exe: 0xC0020001: The string binding is invalid. First-chance exception at 0x7c812a5b (kernel32.dll)...
0
amitpatel66
by: amitpatel66 | last post by:
There is always a requirement that in Oracle Applications, the Concurrent Program need to be execute programatically based on certain conditions/validations: Concurrent programs can be executed...
2
by: jenya56 | last post by:
I have a very large object. When I run my program first time it runs just fine. But if I want to re-run it it fails by saying that it is out of memory. Any suggestions? Perhaps, should I call...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.