Codejock Forums Homepage
Forum Home Forum Home > General > Code Snippets > Visual Basic Code Snippets
  New Posts New Posts RSS Feed - TaskDialog as Progress Indicator
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

TaskDialog as Progress Indicator

 Post Reply Post Reply
Author
Message
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Topic: TaskDialog as Progress Indicator
    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

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

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

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

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

Joined: 03 April 2008
Status: Offline
Points: 203
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lodep59 Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

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

Joined: 03 April 2008
Status: Offline
Points: 203
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lodep59 Quote  Post ReplyReply Direct Link To This Post 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)
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.141 seconds.