Solved

Top most CDialog application - includes being over the taskbar

Posted on 2006-11-23
4
578 Views
Last Modified: 2013-11-20
I have a dialog application, my user wants to be able to drag the dialog anyway on the screen and for it to remain on top.

When they drag it over the taskbar/start bar, the dialog goes behind the bar - how can I get it to go over the bar (in the same way as the task manager does)?
0
Comment
Question by:ManAtNext
  • 2
  • 2
4 Comments
 
LVL 22

Accepted Solution

by:
mahesh1402 earned 250 total points
ID: 18002502
See Always on Top Window :http://www.codeproject.com/Purgatory/KeepWindowAlwaysOnTop.asp

You have to use SetWindowPos() with &Cwnd::wndTopMost

e.g
m_hwndDlg.SetWindowPos(&CWnd::wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);

-MAHESH
0
 

Author Comment

by:ManAtNext
ID: 18002686
That works really well, thank you.

However, my main dialog creates another window (derived from CWnd), when I do that your solution stops being effective. Also, I thought I'd try it out on the newly created CWnd derived class too - with that window it didn't work, the create process for that window looks like this:

    BOOL result = CreateEx(0,
        AfxRegisterWndClass(NULL, NULL, (HBRUSH)GetStockObject(NULL_BRUSH), NULL),
        _T(""), WS_POPUP | WS_BORDER,
        CRect (0, 0, Size, Size),
        &parentWnd, NULL, NULL);

Any ideas why?

PS: I will be awarding the points to you regardless is due course - your answer was spot on for my original question.
0
 
LVL 22

Expert Comment

by:mahesh1402
ID: 18003731
Well then have you tried calling SetWindowPos again for your dialog after creating new window ?

-MAHESH
0
 

Author Comment

by:ManAtNext
ID: 18003779
Found it - the process control returns to the parent dialog, and when it does, the window stops being top most - I've re-grabbed it WM_MOUSEMOVE (naughty I know, but it works for what I want).

Thanks again for your help.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 94
Expand macro to include alternate header placement and naming 5 66
Generic progress indicator 6 113
maxBlock challenge 30 112
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

895 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now