Global Dialog in MFC for WinCe 5.0

I have a multi-window application. There can be several windows all one on top of another.
I would like a dialog to pop up when an event is set and have this dialog be the top most window.  This dialog will ask the user if they wish to shutdown the device (this is why I want to be able to show up as the topmost window).

Can someone point me to some sample code as to how to do this? I am sensing the event in a thread. Or even explain the steps to do this?

Thanks in advance!
Who is Participating?
pgnatyukConnect With a Mentor Commented:
To bring an existing window to the top you may use SetForegroundWindow function. I do not remember why but I use it in this way:
SetForegroundWindow((HWND)(((ULONG)hWnd | 0x01));
Probably I took the code from an SDK sample.
You can create new window with WS_EX_TOP extended style.
Check youself how you can modify your dialog - I do not see your code. I'd try the first way with SetForegroundWindow.
You can modify window style in OnInitDialog too.
AndyAinscowConnect With a Mentor Freelance programmer / ConsultantCommented:
Resource editor, select the dialog, display the properties - there should be one Topmost.  Usually it is set to false, change it to true.  Recompile and see if it behaves how you want.
It's Windows CE. I do not think they use the resource editor and have separate resources for each dialog - usually it works too slow.
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Anthony2000Author Commented:
What I am not sure about is how do I put up the dialog up when the thread wakes up from the event. Can you point me to an example where the thread can create a dialog and display it?
AndyAinscowFreelance programmer / ConsultantCommented:
That is rather a different matter than a top most dialog.
Anthony2000Author Commented:
Hi Andy, I accidentally removed that part of the description that explained that I have a thread that is blocked waiting for an event that is set via interrupt. I would like this thread to create the window. Sorry. I know how to make a dialog the top most window. I do this already with other dialogs.

I just don't know how to do this from a thread? Maybe I have to create a special MFC thread? I am just using CreateThread?

Oh. It will be a long discussion. To make it show, I'd propose to you to give more details about this dialog - probably this is a standard MFC dialog created from a resource; is there any other dialog using the same resource? is there another dialog calling a method from this dialog?
Also it sounds as one more question.
I have a working case, where I created a top-most window from the thread. But this window is just a popup and do not interact with other parts of the application. So I have a thread and inside, when an event comes, I create the window with the mentioned extended style.
You can find here few recent threads about such problem.
Anthony2000Author Commented:
If it will help, I can assign points and open a new question?
as you wish. I'm just afraid to participate in the threads about the question you are asking now. :)
So I'm leaving with or without points.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.