?
Solved

Global Dialog in MFC for WinCe 5.0

Posted on 2009-12-21
9
Medium Priority
?
551 Views
Last Modified: 2013-12-27
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!
0
Comment
Question by:Anthony2000
  • 4
  • 3
  • 2
9 Comments
 
LVL 33

Accepted Solution

by:
pgnatyuk earned 1000 total points
ID: 26096084
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.
 
0
 
LVL 45

Assisted Solution

by:AndyAinscow
AndyAinscow earned 1000 total points
ID: 26096332
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.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26096453
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.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Author Comment

by:Anthony2000
ID: 26096628
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?
0
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 26096665
That is rather a different matter than a top most dialog.
0
 
LVL 8

Author Comment

by:Anthony2000
ID: 26096736
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?


0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26096738
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.
 
 
0
 
LVL 8

Author Comment

by:Anthony2000
ID: 26096742
If it will help, I can assign points and open a new question?
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26096779
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.
 
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

As the title indicates, I have done this before. It chills me everytime I update the OS on my phone, (http://www.experts-exchange.com/articles/18084/Upgrading-to-Android-5-0-Lollipop.html) because one time I did this and I essentially had a bricked …
In this article we will discuss all things related to StageFright bug, the most vulnerable bug of android devices.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses
Course of the Month14 days, 15 hours left to enroll

839 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