Print Page | Close Window

TaskDialog as Progress Indicator

Printed From: Codejock Forums
Category: General
Forum Name: Visual Basic Code Snippets
Forum Description: Visual Basic Code Snippets
URL: http://forum.codejock.com/forum_posts.asp?TID=14843
Printed Date: 03 December 2024 at 12:27pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: TaskDialog as Progress Indicator
Posted By: jpbro
Subject: TaskDialog as Progress Indicator
Date Posted: 27 July 2009 at 6:12pm
The CJ TaskDialog is pretty neat, but it was lacking some features that I required (or at least that I thought would be nice to have) for creating a standard progress dialog for my applications. So I got to work and fought with the control a bit and got things working as I needed myself. The biggest problem was that the TaskDialog control doesn't expose and Hwnd property, and I wanted to add features like auto-dismiss after a time period or at 100% progress, the ability to dismiss the dialog at will, the ability to show no buttons, etc...

Here's the complete feature list:

  • AutoDismissAfterMilliseconds - automatically close a progress dialog box after X milliseconds
  • AutoDismissAt100Percent - automatically close a progress dialog box when the progress % = 100%.
  • EnableButtonsAfterMilliseconds - This will ensure that the buttons are disabled until X milliseconds has passed. This helps prevent accidental button clicks when the dialog pops up unexpectedly.
  • Dismiss - You can call this to dismiss (close) the dialog any time
  • The control also automatically disables the buttons when it does no have focus. This also helps prevent accidental clicks when you are working on another window and click off that window.
  • Dismissed Event - You now get a notification when the dialog has been closed.
  • Timer Event - I added TotalMS (since dialog shown) in addition to the original parameters.
  • RequestProgressPercent event - This event fires every 200MS or so to request updates to the progress percentage.
  • BeforeClose event - gives you a chance to cancel the dismissal of the dialog box.
  • ShowMarquee method  - Shows the dialog in Marquee (scrolling) mode
  • ShowProgress method - Shows the dialog in Progress percentage mode.
Here's the code:

uploads/20090729_133003_ProgressDialog.zip - uploads/20090729_133003_ProgressDialog.zip

Feel free to use it for any kind of project...no warranty of course. Bug reports and new ideas are welcome.


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6




Replies:
Posted By: jpbro
Date Posted: 29 July 2009 at 1:33pm
SOURCE UPDATED IN TOP POST

Fixed a bug that was causing the TotalMS to be miscalculated.

Also, I've added the ability to start the progress bar with an EventCode and then use the EventCode and associated StateCodes in the Timer event to allow for easy state tracking and updating. The sample will demonstrate this clearer than I can explain it, but if you have any questions, please ask here.

Also added the ability to Start/Stop the Marquee (even when in progress mode).


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: Lodep59
Date Posted: 18 August 2009 at 12:51am
Thank you for that (and for overs snippets :)).
I really needed it
 
Great job.


-------------
Product: Xtreme SuitePro (ActiveX) last version
Platform: Windows 7 Ultimate
Language: VB6 SP6 (FR)


Posted By: jpbro
Date Posted: 18 August 2009 at 11:47am
I'm glad you have found some use for the code!

If you find any bugs, or have any questions or ideas for extending the features, feel free to get back to me.


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: Lodep59
Date Posted: 19 August 2009 at 3:20am
I'll let you know. No Problem.

-------------
Product: Xtreme SuitePro (ActiveX) last version
Platform: Windows 7 Ultimate
Language: VB6 SP6 (FR)



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