Solved

ActiveX

Posted on 2000-04-27
18
283 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
 

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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
if loop error 4 77
Expand macro to include alternate header placement and naming 5 60
if loop in java 3 114
Not needed 13 57
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

758 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now