Results 1 to 2 of 2

Thread: Hwnd substitute &0

  1. #1
    Stryker
    Guest

    Hwnd substitute &0

    I've been looking about for a way to get a timer going without using a timer on a form.

    I got some intersting info from a few other posts ... but mainly this one.

    So ... I can get the timer working in a module, and thats fine ... but someone made a reference to substituting the hwnd of a form for the value &0.

    Is it just me ... or is it that if I start the timer this way, I am unable to stop it.

    Any advice?

  2. #2
    Stryker
    Guest
    It might help if you knew what I was doing huh?

    Ok ... heres specifiacally what I am working with.

    Code:
    'In a module
    
    Public Declare Function SetTimer Lib "user32" (ByVal hwnd As _ 
    Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal _ 
    lpTimerFunc As Long) As Long
    
    Public Declare Function KillTimer Lib "user32" (ByVal hwnd As _ 
    Long, ByVal nIDEvent As Long) As Long
    
    Public Sub TimerProc(ByVal hwnd As Long, ByVal uMsg As _
    Long, ByVal idEvent As Long, ByVal dwTime As Long)
    
    'Code here
    
    End Sub
    
    'In a form
    
    Private Sub Form_Load()
    
    SetTimer Me.hwnd, 1, 1000, AddressOf TimerProc
    
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
    
    KillTimer Me.hwnd, 1
    
    End Sub
    What I want to do is have the timer be started and killed by the module, not the form.

    Thanks again.

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