C++ ProcessShellCommand(params) issue with exception as "Unhandled exception at 0x7771b9bc (KernelBase.dll)". How to fix?

Hi there;

After converting my project from VS2008 to VS2010, my C++ program crashes in the very line;
ProcessShellCommand(params), simply crashes and when ignore during debugging, I end up with CInvalidArgException Class exception with the following message.

Unhandled exception at 0x7771b9bc (KernelBase.dll) in MyProgram.exe: Microsoft C++ exception: CInvalidArgException at memory location 0x0018f564..

What should I do? How can I fix this problem?

Kind regards.

P.S.
Addition;
The stack trace for this is as:

First-chance exception at 0x7771b9bc (KernelBase.dll) in MyProgram.exe: Microsoft C++ exception: CInvalidArgException at memory location 0x0018f564..
Unhandled exception at 0x7771b9bc (KernelBase.dll) in MyProgram.exe: Microsoft C++ exception: CInvalidArgException at memory location 0x0018f564..
The thread 'Win32 Thread' (0xfb4) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x26a0) has exited with code 0 (0x0).
Detected memory leaks!
LVL 12
jazzIIIloveAsked:
Who is Participating?
 
ZoppoConnect With a Mentor Commented:
Hi jazzIIIlove,

there are some cases which cause a CInvalidArgException being thrown, i.e. accessing a MFC container (like i.e. CArray) with an index which is out of bounds or a file/socket operation with a NULL pointer or an empty file name string or COM error when accessing a none initialized interface or passing wrong parameters to AfxLoadString, ...

I guess a good way to find where you app crashs might be to set a breakpoint in the function AfxThrowInvalidArgException which is located near the end of <Program path>\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc\except.cpp. I guess this function is called whenever a CInvalidArgException is thrown.

If this doesn't help I agree with jkr: Please post parts of the relevant code and the paramters you pass to ProcessShellCommand ... even helpful might be the calling stack shown in the debugger when the exception is thrown.

ZOPPO
0
 
jkrCommented:
Well, what are the arguments that are being processed?
0
 
jazzIIIloveAuthor Commented:
Hi jkr, thanks for the interest:

Just, command line arguments as the program needs a command line argument indicating the path of the file that program uses during startup.

Kind regards.
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
jkrCommented:
Hm, that I assumed somehow ;o)

And in detail?
0
 
jazzIIIloveAuthor Commented:
What other details do you need? The window is created after the parameter passing to ProcessShellCommand. Is this the case?

Kind regards.
0
 
jkrCommented:
Um, what would be nice is

- the actual parameters
- the snippet of code in question

Sorry, but my chrystal ball is on repair ;o)
0
 
jazzIIIloveAuthor Commented:
lol, u are absolutely right. I will check what i can for the code. The params is just a path to a configuration file for that C++ application.

Note that before conversion, it was OK.

I suspect as i draw the GUI for the program after passing param to that function. Could it be a reason for the crash?

Regards.
0
 
jkrConnect With a Mentor Commented:
I actually suspect just some minor, yet hidden detail...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.