Solved

Top most CDialog application - includes being over the taskbar

Posted on 2006-11-23
4
583 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
modThree challenge 4 98
haveThree challenge 22 121
wordmultiple challenge 12 142
Work with App store 7 68
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

828 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