Solved

ActiveX

Posted on 2000-04-27
18
285 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Question regarding Copy/Paste 16 96
FizzBuzz challenge 9 81
wordappend challenge 8 179
"Black Box" Testing of Control System Software 2 51
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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.

810 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