Bok Geen

Hello,

I was just testing my application out on Vista build 5364, but there seems like a problem with the MsgWaitForMultipleObjects function.

I have simple function in my appliction that just launches a setup.exe from a specified path. I have a function, launchVIAShellExecute() which uses the ShellExecuteEx function launch this "setup.exe".

The problem is in the do-while loop shown below. It seems like the my application gets stuck inside the loop. Manually stepping through the code, it seems like MsgWaitForMultipleObjects hangs. The setup.exe gets launched but also gets stuck.

Note: This chunk of code works fine on Windows XP

Is there something different with messenging in Vista Is a access/privledge right problem I am out of ideas.

Would anyone have insight into this problem or how I can debug this further

Thanks,

SAMPLE CODE:

MSG msg;

HANDLE myProcess = launchVIAShellExecute(lpProgram,lpArgs);

do{

while(PeekMessage(&msg, NULL,0,0)>0){

TranslateMessage(&msg);

DispatchMessage(&msg);

}

status = MsgWaitForMultipleObjects(1, &myProcess, false, INFINITE, QS_ALLINPUT);

}

while(WAIT_OBJECT_0 + 1 == status)



Re: General Windows Vista Development Issues MsgWaitForMultipleObjects gets stuck?

quinthar

Hi there, I'm having a similar problem. I have the following line of code:

MsgWaitForMultipleObjects( 0, 0, FALSE, 250, QS_ALLINPUT );

And it works fine under XP as a way to pause the thread up to 250ms until there is some kind of input, and then do a PeekMessage( ). Unfortunately, under Vista this line just seems to terminate the entire process. No errors, no exceptions, no warning dialogs, just gone. Other threads are likewise destroyed.

Even stranger -- it appears to work for a bit (perhaps it works when there are messages in the queue ), but then after a few calls it just kills the process.

Did you ever resolve this issue

-david




Re: General Windows Vista Development Issues MsgWaitForMultipleObjects gets stuck?

quinthar

Oops, I figured it out. Actually, MsgWaitForMultipleObjects isn't the problem.

Rather, MsgWaitForMultipleObjects is the first place in my code where the OS context switches to another thread, it's my thread that was crashing. Specifically, when initializing a new thread I did the crazy Visual Studio hack that named the thread in the debugger as follows:

// Set the thread name
_RSThreadNameInfo info;
info.dwType = 0x1000;
info.szName = name;
info.dwThreadID = GetCurrentThreadId( );
info.dwFlags = 0;
__try { RaiseException( 0x406D1388, 0, sizeof(info)/sizeof(DWORD), (DWORD*)&info ); }
__except(EXCEPTION_CONTINUE_EXECUTION) { }

Unfortunately that hard crashed my entire application, without any exception or anything. Regardless, once I removed this code, it worked like a charm. Good luck!

-david

PS: Vista is the absolute worst operating system I have ever, ever used. It is so atrocious, so utterly abysmal, I don't even know where to start complaining. Why does it move my files around when I edit them to some secret VirtualStore folder Why does it prompt me to just press "OK" constantly, offering absolutely no security whatsoever with ridiculous nuisances I've been a long fan of the Windows line, and I think Microsoft has just shot itself in the head with this. Were I not a Windows programmer, I'd be on a Mac today




Re: General Windows Vista Development Issues MsgWaitForMultipleObjects gets stuck?

backwater

I am facing similar problelm. Are you able to solve this problem

Thanks.