Solved

Top most CDialog application - includes being over the taskbar

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

759 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

18 Experts available now in Live!

Get 1:1 Help Now