Solved

ActiveX

Posted on 2000-04-27
18
286 Views
Last Modified: 2013-11-20
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!
0
Comment
Question by:seasky_tiger
  • 10
  • 7
18 Comments
 
LVL 3

Expert Comment

by:shaig
ID: 2755838
How is this related with the ActiveX?
Try to work your code in a simple exe and see if it works.
0
 

Author Comment

by:seasky_tiger
ID: 2758383
shaiq:
It works very well in a simple exe.
But same codes in ActiveX will fail.
Why?
0
 
LVL 3

Expert Comment

by:shaig
ID: 2758410
On same OS?  What OS is that?
Can you post the code?
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:seasky_tiger
ID: 2761655
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
 
LVL 3

Expert Comment

by:shaig
ID: 2763224
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
 

Author Comment

by:seasky_tiger
ID: 2763257
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
 
LVL 3

Expert Comment

by:shaig
ID: 2764570
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
 

Author Comment

by:seasky_tiger
ID: 2764950
Why same codes have different results in ActiveX and EXE?
0
 
LVL 15

Expert Comment

by:NickRepin
ID: 2784614
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
 
LVL 3

Expert Comment

by:shaig
ID: 2785193
Maybe because you don't call CoInitialize()...

Do you have any intention on grading this anyway?
0
 

Author Comment

by:seasky_tiger
ID: 2790758
Adjusted points from 100 to 200
0
 

Author Comment

by:seasky_tiger
ID: 2790759
OK
0
 
LVL 3

Expert Comment

by:shaig
ID: 2791353
Did you try my suggestions?
0
 

Author Comment

by:seasky_tiger
ID: 2821692
Yes, I have tried. But...
0
 
LVL 3

Accepted Solution

by:
shaig earned 200 total points
ID: 2822055
Please post the code of the ActiveX function.
0
 

Author Comment

by:seasky_tiger
ID: 2828108
I have posted the code.
You can find it above.
0
 

Author Comment

by:seasky_tiger
ID: 2855594
Answer accepted
0
 

Author Comment

by:seasky_tiger
ID: 2855595
I of course will give you the scores, but my problem has not been solved.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
has77  challenge 9 93
pre4 challenge 19 104
Increment column based of a FK 8 32
I could not set window to top 4 23
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question