Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Top most CDialog application - includes being over the taskbar

Posted on 2006-11-23
4
Medium Priority
?
593 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 1000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

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 …
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 Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
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.

885 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