Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Controls
  New Posts New Posts RSS Feed - How to detect that a modeless TaskDialog is closed
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to detect that a modeless TaskDialog is closed

 Post Reply Post Reply
Author
Message
cpede View Drop Down
Senior Member
Senior Member


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 668
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpede Quote  Post ReplyReply Direct Link To This Post Topic: How to detect that a modeless TaskDialog is closed
    Posted: 17 December 2010 at 8:16am
I'm running a modeless TaskDialog using the create method.
 
My question is: "How do I detect that the dialog is closed ?" When I press a button the TaskDialog closes automatically, but the class of cause still lives. I was expecting that I could test the GetSafeHwnd() of the TaskDialog, but it seems that this is not set to NULL after it is closed ?
 
I'm not able to process the OnButtonClicked callbacks, since I'm running inside another windows message.
 
-cpede
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)
Back to Top
cpede View Drop Down
Senior Member
Senior Member


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 668
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpede Quote  Post ReplyReply Direct Link To This Post Posted: 20 December 2010 at 3:49am
OK I can check the ::IsWindowsVisible, and then I can continue.
 
But isn't it a little strange that the dialog is closed, and the handle is still valid?
 
-cpede
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 890
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 23 January 2011 at 11:48am
It seems strange that you would be calling Create on a dialog you want to be modeless. I assume you are calling DoModal, in which case calling Create is not necessary. If you call Create, you need to call DestroyWindow.
Back to Top
cpede View Drop Down
Senior Member
Senior Member


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 668
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpede Quote  Post ReplyReply Direct Link To This Post Posted: 24 January 2011 at 3:36am
What do you mean? It is normal to call the Create method to make a dialog modeless, whereas the DoModal makes is modal?
But on standard dialogs, closing the dialog means calling destroy, and then the window handle becomes NULL. This is somehow different on the TaskDialog, and that was what I was asking about; "if IsWindowVisible was the correct and recommended way to detect if a TaskDialog is closed"?
 
-cpede
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 890
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 24 January 2011 at 10:27am
Sorry, I was thinking modal not modeless.
Back to Top
jimmy View Drop Down
Senior Member
Senior Member


Joined: 11 November 2003
Location: Austria
Status: Offline
Points: 515
Post Options Post Options   Thanks (0) Thanks(0)   Quote jimmy Quote  Post ReplyReply Direct Link To This Post Posted: 24 January 2011 at 8:37pm
Hi,

How do you create the instance ?
With new, global, ???

  Jimmy

Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 890
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 25 January 2011 at 10:25am
I have not worked with this particular class but I would assume you create a window the same way you create any window in Windows.
 
When a modeless window is created, the call to destroy the window depends on the design. Some windows destroy themselves on close. Some windows are "global" and remain valid until some other code destorys the window.
 
If this window is not destorying itself and you want that behavior, subclass the window and when the close event occurs, call DestroyWindow.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.187 seconds.