Click here to Skip to main content
15,895,709 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: "_ _cplusplus" tag error? Not VC++6 compatible? Pin
ThatsAlok7-Mar-05 23:37
ThatsAlok7-Mar-05 23:37 
GeneralRe: "_ _cplusplus" tag error? Not VC++6 compatible? Pin
Axonn Echysttas8-Mar-05 3:37
Axonn Echysttas8-Mar-05 3:37 
GeneralRe: "_ _cplusplus" tag error? Not VC++6 compatible? Pin
ThatsAlok8-Mar-05 18:48
ThatsAlok8-Mar-05 18:48 
GeneralRe: "_ _cplusplus" tag error? Not VC++6 compatible? Pin
Axonn Echysttas9-Mar-05 1:54
Axonn Echysttas9-Mar-05 1:54 
Generalcustomizing MS Word Menubar Pin
rjnl7-Mar-05 11:29
rjnl7-Mar-05 11:29 
GeneralRe: customizing MS Word Menubar Pin
Sujan Christo7-Mar-05 17:46
Sujan Christo7-Mar-05 17:46 
Generalusing GetOpenFileName in service Pin
TheGreatAndPowerfulOz7-Mar-05 11:22
TheGreatAndPowerfulOz7-Mar-05 11:22 
GeneralShellExecuteEx and WaitForSingleObject Pin
lulacapixaba7-Mar-05 10:51
lulacapixaba7-Mar-05 10:51 
In the article http://www.codeproject.com/system/newbiespawn.asp[^] the following code is given as a solution for launching a process and waiting for it to finish.

SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = "c:\\MyProgram.exe";
ShExecInfo.lpParameters = "";
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);

The problem I found with this code is that ShellExecuteEx, in some cirsumstances, may not create a different process. For example, if in the lpFile you specify a URL and there is one instance of IE already running, this existing instance will be used. The documentation says that, in this case, ShellExecuteEx will return NULL in the hProcess. I found that this is not true. It returns a handle for the existing process. The problems is that the process is "signaled" already. Therefore, WaitForSingleObject does not block waiting for the process to finish and returns immediately. Confused | :confused:

The only difference between my code and the above is that in mine, I've added the flag SEE_MASK_FLAG_DDEWAIT to the fMask so the DDE exchange is guaranteed to be finished before ShellExecuteEx return.

Does anybody know how to solve this problem?

Lula Capixaba
GeneralRe: ShellExecuteEx and WaitForSingleObject Pin
TheGreatAndPowerfulOz7-Mar-05 11:33
TheGreatAndPowerfulOz7-Mar-05 11:33 
GeneralRe: ShellExecuteEx and WaitForSingleObject Pin
lulacapixaba7-Mar-05 22:38
lulacapixaba7-Mar-05 22:38 
GeneralRe: ShellExecuteEx and WaitForSingleObject Pin
TheGreatAndPowerfulOz8-Mar-05 3:32
TheGreatAndPowerfulOz8-Mar-05 3:32 
GeneralRe: ShellExecuteEx and WaitForSingleObject Pin
lulacapixaba8-Mar-05 4:08
lulacapixaba8-Mar-05 4:08 
Questionhow to detect system's idle state? Pin
Kamis7-Mar-05 9:45
Kamis7-Mar-05 9:45 
AnswerRe: how to detect system's idle state? Pin
David Crow7-Mar-05 10:42
David Crow7-Mar-05 10:42 
GeneralRe: how to detect system's idle state? Pin
Kamis7-Mar-05 11:03
Kamis7-Mar-05 11:03 
GeneralTabControl Dialog Pin
aman20067-Mar-05 7:12
aman20067-Mar-05 7:12 
Questionhow to display propertysheet tabs on left rather than on top? Pin
Amyvad7-Mar-05 6:21
Amyvad7-Mar-05 6:21 
AnswerRe: how to display propertysheet tabs on left rather than on top? Pin
David Crow7-Mar-05 10:44
David Crow7-Mar-05 10:44 
GeneralPrintout Bmp image Pin
Larsson7-Mar-05 6:10
Larsson7-Mar-05 6:10 
GeneralRe: Printout Bmp image Pin
Sujan Christo7-Mar-05 17:56
Sujan Christo7-Mar-05 17:56 
QuestionProblem with different size of dialog in resource editor to that on screen? Pin
RichardNN7-Mar-05 5:21
RichardNN7-Mar-05 5:21 
AnswerRe: Problem with different size of dialog in resource editor to that on screen? Pin
Maximilien7-Mar-05 5:44
Maximilien7-Mar-05 5:44 
GeneralRe: Problem with different size of dialog in resource editor to that on screen? Pin
RichardNN7-Mar-05 6:44
RichardNN7-Mar-05 6:44 
GeneralDevice Context Pin
Pazzuzu7-Mar-05 5:07
Pazzuzu7-Mar-05 5:07 
GeneralRe: Device Context Pin
Blake Miller7-Mar-05 10:39
Blake Miller7-Mar-05 10:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.