Click here to Skip to main content
15,893,588 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalderived class, but want base class function Pin
ns7-Oct-02 3:06
ns7-Oct-02 3:06 
GeneralRe: derived class, but want base class function Pin
jhwurmbach7-Oct-02 3:23
jhwurmbach7-Oct-02 3:23 
GeneralRe: derived class, but want base class function Pin
ns7-Oct-02 3:48
ns7-Oct-02 3:48 
GeneralRe: derived class, but want base class function Pin
Daniel Lohmann7-Oct-02 3:49
Daniel Lohmann7-Oct-02 3:49 
GeneralBitmap Problem Pin
Renjith Ramachandran7-Oct-02 2:59
Renjith Ramachandran7-Oct-02 2:59 
GeneralRe: Bitmap Problem Pin
Renjith Ramachandran7-Oct-02 4:11
Renjith Ramachandran7-Oct-02 4:11 
GeneralRe: Bitmap Problem Pin
Renjith Ramachandran7-Oct-02 4:36
Renjith Ramachandran7-Oct-02 4:36 
QuestionHow to determine the last active windows from a tray icon notification handler Pin
Daniel Lohmann7-Oct-02 2:56
Daniel Lohmann7-Oct-02 2:56 
Hi,

I am almost an expert on system programming, so I hope this GUI related question is easy to one of you:

I have an app that installs an icon in the system tray. If the user clicks on the icon a dialog appears. Now the user may switch to some other app, so the dialog maybe active (has the focus) and in the foreground or somewhere in the background.

If the user now clicks again the tray icon, I want to do the following:
  1. If the dialog is not active, I want to activate it and bring it to front.
  2. If the dialog is active, I want to dismiss it.
My problem is to determine inside the tray notification handler if the dialog has been active or not. I already tried the following:
  • GetForegroundWindow() returns the handle of the system tray window. (Well, this makes sense, it is the active window during the execution of the notification handler...)
  • GetFocus() always returns NULL
  • GetActiveWindow() also returns NULL
  • Same for GetLastActivePopup()
It seems that if you click on a tray icon, the system calls the notification handler and afterwards silently reactivates the window that was active before. That's the reason why GetForegroundWindow() always returns the system tray window, but the "visibly active window" seems not to loose its focus. However, I need to know which window was active <it>before the icon was clicked.

Any ideas Confused | :confused:

--

Daniel Lohmann

http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there Big Grin | :-D )
AnswerRe: How to determine the last active windows from a tray icon notification handler Pin
Andreas Saurwein7-Oct-02 6:38
Andreas Saurwein7-Oct-02 6:38 
GeneralRe: How to determine the last active windows from a tray icon notification handler Pin
Daniel Lohmann7-Oct-02 10:11
Daniel Lohmann7-Oct-02 10:11 
GeneralRetrieve Disk volume from a targetId of a scsi device Pin
Chrish1207-Oct-02 2:50
Chrish1207-Oct-02 2:50 
GeneralRe: Retrieve Disk volume from a targetId of a scsi device Pin
Mike Nordell8-Oct-02 4:56
Mike Nordell8-Oct-02 4:56 
GeneralRe: Retrieve Disk volume from a targetId of a scsi device Pin
Chrish12015-Oct-02 6:37
Chrish12015-Oct-02 6:37 
GeneralGetting the MSDOS name in the Application Pin
abhinarulkar7-Oct-02 2:53
abhinarulkar7-Oct-02 2:53 
GeneralRe: Getting the MSDOS name in the Application Pin
Daniel Lohmann7-Oct-02 4:43
Daniel Lohmann7-Oct-02 4:43 
GeneralCSplitterWnd question Pin
alex.barylski7-Oct-02 2:49
alex.barylski7-Oct-02 2:49 
GeneralIncrediBuild software Pin
Cris7-Oct-02 2:42
Cris7-Oct-02 2:42 
GeneralRe: IncrediBuild software Pin
Victor Rubinstein10-Oct-02 11:44
Victor Rubinstein10-Oct-02 11:44 
GeneralHiding vertical scrollbar in CListCtrl Pin
mishgun7-Oct-02 0:38
mishgun7-Oct-02 0:38 
GeneralRe: Hiding vertical scrollbar in CListCtrl Pin
Jon Hulatt7-Oct-02 1:02
Jon Hulatt7-Oct-02 1:02 
GeneralRe: Hiding vertical scrollbar in CListCtrl Pin
mishgun7-Oct-02 1:49
mishgun7-Oct-02 1:49 
GeneralRe: Hiding vertical scrollbar in CListCtrl Pin
Yaron Nir21-Oct-02 5:06
Yaron Nir21-Oct-02 5:06 
QuestionHow to insert pictures into .mdb database? Pin
Wenrich7-Oct-02 0:06
Wenrich7-Oct-02 0:06 
Generaldouble value from ini file Pin
Raphael Kindt6-Oct-02 22:56
Raphael Kindt6-Oct-02 22:56 
GeneralRe: double value from ini file Pin
Raphael Kindt6-Oct-02 23:11
Raphael Kindt6-Oct-02 23:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.