Click here to Skip to main content
15,888,351 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Font heights Pin
Johan Rosengren13-Jul-04 20:47
Johan Rosengren13-Jul-04 20:47 
GeneralRe: Font heights Pin
0v3rloader13-Jul-04 21:27
0v3rloader13-Jul-04 21:27 
Generalabout MPEG4. Pin
Grrrr13-Jul-04 16:37
Grrrr13-Jul-04 16:37 
Generalgethostbyname() in win32 Pin
edosdonkey13-Jul-04 15:45
edosdonkey13-Jul-04 15:45 
GeneralAn MFC project Pin
sagsag13-Jul-04 13:41
sagsag13-Jul-04 13:41 
GeneralRe: An MFC project Pin
mystro_AKA_kokie13-Jul-04 19:20
mystro_AKA_kokie13-Jul-04 19:20 
Generalfree GMail account to first person who can give working solution Pin
JeromeKJerome13-Jul-04 11:26
JeromeKJerome13-Jul-04 11:26 
GeneralRe: free GMail account to first person who can give working solution Pin
Antti Keskinen13-Jul-04 11:47
Antti Keskinen13-Jul-04 11:47 
I have no use for the "much sought after" GMail account, but perhaps I can solve your problem.

I assume that you are talking about an System Tray area icon that is created and maintained by the program. Now, it seems that after you end the dialog by clicking the Ok-button, you also destroy the dialog window. This window is also marked as the parent of the tray area icon (it's message map has a hander for the tray notification). When the window is destroyed, the tray area icon has no window attached to it, and it will start to behave irrationally.

The way to fix this is to move the adding of the tray area icon INSIDE the dialog's main initialization code (to CDialog::OnInitDialog, for example). Then you should create a supplementary function (call it, for example, CBotDlg::DestroyTrayIcon). This function is responsible for removing the icon from the tray area.

Now go through your code. Everywhere where you are calling CDialog::EndDialog, you should add a call to CBotDlg::DestroyTrayIcon before the EndDialog call. This makes sure that once the dialog window is destroyed, the tray area icon no longer exists, and can no longer cause irrelevant behaviour.

If your idea is to create and upkeep the tray area icon AFTER the dialog has been destroyed, then you need to create another window that is responsible for handling messages sent by the tray icon. The basic idea is that the tray area icon is always bound to an existing window. If this window gets destroyed with the tray area icon still there, it will lead to unpredictable behaviour.

UPDATE: After reading more of your code sample, it became apparent that your problem is in the dialog window. The tray area icon is bound to the dialog window, but you're destroying the window when EndDialog is called. This leads the tray icon to stop responding. Fixing it is easy: instead of ending the dialog, use ShowWindow to hide the window from sight (minimize to tray), or create a dummy window with no other purpose than to answer to the tray area notifications.

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
GeneralRe: free GMail account to first person who can give working solution Pin
JeromeKJerome13-Jul-04 14:14
JeromeKJerome13-Jul-04 14:14 
GeneralRe: free GMail account to first person who can give working solution Pin
naveen_vi13-Jul-04 11:50
naveen_vi13-Jul-04 11:50 
GeneralRe: free GMail account to first person who can give working solution Pin
JeromeKJerome13-Jul-04 14:15
JeromeKJerome13-Jul-04 14:15 
GeneralRe: free GMail account to first person who can give working solution Pin
naveen_vi13-Jul-04 11:53
naveen_vi13-Jul-04 11:53 
GeneralRe: free GMail account to first person who can give working solution Pin
Ryan Binns13-Jul-04 18:17
Ryan Binns13-Jul-04 18:17 
GeneralRe: free GMail account to first person who can give working solution Pin
JeromeKJerome14-Jul-04 15:42
JeromeKJerome14-Jul-04 15:42 
GeneralRe: free GMail account to first person who can give working solution Pin
ThatsAlok13-Jul-04 20:21
ThatsAlok13-Jul-04 20:21 
GeneralRe: free GMail account to first person who can give working solution Pin
JeromeKJerome14-Jul-04 15:36
JeromeKJerome14-Jul-04 15:36 
GeneralRe: free GMail account to first person who can give working solution Pin
ThatsAlok14-Jul-04 21:15
ThatsAlok14-Jul-04 21:15 
QuestionWhat is WINAPI macro??? Pin
naveen_vi13-Jul-04 10:54
naveen_vi13-Jul-04 10:54 
AnswerRe: What is WINAPI macro??? Pin
palbano13-Jul-04 11:13
palbano13-Jul-04 11:13 
AnswerRe: What is WINAPI macro??? Pin
Jeremy Falcon13-Jul-04 11:27
professionalJeremy Falcon13-Jul-04 11:27 
GeneralStream interfaces Pin
pankajdaga13-Jul-04 9:08
pankajdaga13-Jul-04 9:08 
GeneralRe: Stream interfaces Pin
palbano13-Jul-04 9:17
palbano13-Jul-04 9:17 
GeneralRe: Stream interfaces Pin
pankajdaga13-Jul-04 12:14
pankajdaga13-Jul-04 12:14 
GeneralRe: Stream interfaces Pin
Chris Losinger13-Jul-04 15:50
professionalChris Losinger13-Jul-04 15:50 
GeneralRe: Stream interfaces Pin
palbano13-Jul-04 17:48
palbano13-Jul-04 17:48 

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.