Print Page | Close Window

How to detect that a modeless TaskDialog is closed

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=17699
Printed Date: 15 May 2024 at 4:21am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to detect that a modeless TaskDialog is closed
Posted By: cpede
Subject: How to detect that a modeless TaskDialog is closed
Date 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 (22.1.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)



Replies:
Posted By: cpede
Date 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 (22.1.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)


Posted By: rdhd
Date 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.


Posted By: cpede
Date 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 (22.1.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)


Posted By: rdhd
Date Posted: 24 January 2011 at 10:27am
Sorry, I was thinking modal not modeless.


Posted By: jimmy
Date Posted: 24 January 2011 at 8:37pm
Hi,

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

  Jimmy



Posted By: rdhd
Date 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.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net