Results 1 to 2 of 2

Thread: Code Timer and Window Module

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 1999
    Posts
    46

    Question

    Hello, i have two question for you:

    1)How to create timer in code only?
    When i use the Control timer i can only get upto 10000 ms and it's not enough to me.
    I like to now how can i create a timer class in code only without any controls so i can use it in module or other class without a form object.

    2)How can i find the window Module (File Name)?
    I need to know how can i find the window module (the file that execute this window or thread).
    When i use GetWindowLong and pass to it Public Const GWL_HINSTANCE = (-6) and then use the API function GetModuleFileName i not always get the right file name.

    Please try to help me.
    Thank you,
    Kiron.

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    First let me say that I already answered your 1st question... Search the forum before you ask such simple things. However, here's the code:
    Code:
    'In module:
    Public Declare Function GetTickCount Lib "kernel32" Alias "GetTickCount" () As Long
    
    'Your timer
    Dim Interval as Long
    Dim NextTick as Long
    Dim Temp as Long
    
    Interval = 1000 'Also in ms
    Temp = GetTickCount()
    
    If NextTick < Temp Then
       NextTick = ( Temp + Interval )
    
       'Code here
    Endif

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