ActiveX

I create a new project of "MFC ActiveX ControlWizard" to invoke CreateProcess() function to run an application setup program.
What bothers me is that when the setup is a 32bit program, it's no problem and when the setup is a 16bit program or setup invoke another 16bit program, the setup program will stop running but the system won't stop.
What's the matter? Pls help me!
seasky_tigerAsked:
Who is Participating?
 
shaigConnect With a Mentor Commented:
Please post the code of the ActiveX function.
0
 
shaigCommented:
How is this related with the ActiveX?
Try to work your code in a simple exe and see if it works.
0
 
seasky_tigerAuthor Commented:
shaiq:
It works very well in a simple exe.
But same codes in ActiveX will fail.
Why?
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
shaigCommented:
On same OS?  What OS is that?
Can you post the code?
0
 
seasky_tigerAuthor Commented:
Win98.
The code is very simple. Create a ActiveX according to "MFC ActiveX ControlWizard", and then add a method randomly invoking CreateProcess() function.

// code
STARTUPINFO StartupInfo;
PROCESS_INFORMATION ProcessInfo;

ZeroMemory( &StartupInfo, sizeof STARTUPINFO );
StartupInfo.cb = sizeof STARTUPINFO;
bRetCode = CreateProcess( lpAppPath, NULL, NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_CONSOLE, NULL, NULL, &StartupInfo, &ProcessInfo );

Just so, it works well in a simple exe.
0
 
shaigCommented:
1) How do you initialize lpApplicationName and lpCommandLine?

CreateProcess documandation says this:

Windows NT/2000: If the executable module is a 16-bit application, lpApplicationName should be NULL, and the string pointed to by lpCommandLine should specify the executable module as well as its arguments. A 16-bit application is one that executes as a VDM or WOW process.

Are you initializing the mentioned params according to the Win98 spec.?
Make sure your code knows in what OS it is running so it makes the relevant changes.

2) Does the thread running the ActiveX's method call CoInitialize()?

0
 
seasky_tigerAuthor Commented:
I note this. So I test it in two ways.
CreateProcess( lpAppPath, NULL, ... )
&
CreateProcess( NULL, lpAppPath, ... )
But both fail.

I call CreateThread() function to create a thread, not CoInitialize().
Is there any trouble?
0
 
shaigCommented:
The functions are complimentry.
The first thing the invoking thread should do is call CoInitialize(), and the last CoUninitialize().

If the thread is to perform COM calls, it has to be initialized for that purpose.
0
 
seasky_tigerAuthor Commented:
Why same codes have different results in ActiveX and EXE?
0
 
NickRepinCommented:
shaig, don't waste a time on this user. Have a look on his profile. The grading record is 3/21, ie only 3 of 21 questions were given a grade!
0
 
shaigCommented:
Maybe because you don't call CoInitialize()...

Do you have any intention on grading this anyway?
0
 
seasky_tigerAuthor Commented:
Adjusted points from 100 to 200
0
 
seasky_tigerAuthor Commented:
OK
0
 
shaigCommented:
Did you try my suggestions?
0
 
seasky_tigerAuthor Commented:
Yes, I have tried. But...
0
 
seasky_tigerAuthor Commented:
I have posted the code.
You can find it above.
0
 
seasky_tigerAuthor Commented:
Answer accepted
0
 
seasky_tigerAuthor Commented:
I of course will give you the scores, but my problem has not been solved.
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.