Results 1 to 7 of 7

Thread: How to run timer events when a CommonDialog Control is open

Hybrid View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    23

    How to run timer events when a CommonDialog Control is open

    I've got an application with a timer that runs in the background. Every minute it counts and after 5 minutes of inactivity it shuts the app down.

    But I've noticed that if a user leaves a FileOpen CommonDialog control on the screen that the timer doesn't work anymore.

    Anyone know of a way I can do this?

    Thanks,
    Lance

  2. #2
    Member
    Join Date
    Mar 2007
    Posts
    44

    Re: How to run timer events when a CommonDialog Control is open

    You could try CreateThread to create a new thread in you application, so far as I knon, none of other method can do it.

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: How to run timer events when a CommonDialog Control is open

    Creating a new thread will still not work as VB is not a true multithreaded environment. The dialog is modal so all processing on the parent form comes to a hault. However timers are not supossed to be affected by this. In the IDE it will apear to stop but if you compile an exe the timer should function.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    23

    Re: How to run timer events when a CommonDialog Control is open

    Well, it kinda works when I compile.

    The timer counts correctly and but the "end" statement only goes active when I close the Dialog box.

    Lance

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to run timer events when a CommonDialog Control is open

    What end statement?

    Please tell me you are not using the End Keyword.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    23

    Re: How to run timer events when a CommonDialog Control is open

    Here is my code. The timer interval is 60,000.

    Code:
    Private Sub ShutDown_Timer()
    
        ShutDownCount = ShutDownCount + 1
        
        If ShutDownCount >= 5 Then
            End
        End If
    End Sub

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: How to run timer events when a CommonDialog Control is open

    Thats because the dialog is modal and End should never be used in a project with classes and forms. Use Unload Me instead.

    The timer event continues to fire but the code may not until the modal dialog is dismissed. You may want to see if you can use some APIs to programmatically close the dialog in the Timer event when time is up..
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width