Click to See Complete Forum and Search --> : ExitWindowsEx does not work with Multithreading ?


AlionSolutions
June 5th, 2003, 04:45 AM
Hi,
again a strange problem / behaviour on which I need your help:

In an application I have to shut down the computer. I tried to use ExitWindowsEx and did the whole process of retrieving and adjusting the privilege under WinNT.

Ok, but to my surprise, the shutdown didn't work as usual. In fact it didn't work anyway.

So I thought about reasons for this, and had the idea, that it might be something with the multithreaded architecture of the application. The ExitWindowsEx-call is NOT made from the main-thread of the application, it is made by some other thread.

So I put exactly the code-part with the ExitWindowsEx-call in the WinMain of a freshly constructed project without threads and yepp it works.

So my question to you is: Has anybody any information about the behaviour described above ? Is there a way, to get this call working within multithreading ?

Thanx in advance

Juergen

rsmemphis
June 5th, 2003, 05:26 AM
What does GetLastError say?
Or does the function return a non-zero value?

One other thought that I have: Maybe your application gets an exit windows message, but fails to end the thread, and therefore your program "stops" the shutdown process.

AlionSolutions
June 5th, 2003, 05:39 AM
I tried it again and it worked... mysterious Windows ;o)

filthy_mcnasty
June 5th, 2003, 05:28 PM
perhaps try the EXW_FORCE flag, always worked for me