Ignore:
Timestamp:
May 16, 2003, 12:59:28 PM (22 years ago)
Author:
sandervl
Message:

Handle WM_(SYS)TIMER timer calls in DispatchMessageA/W

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/timer.cpp

    r10102 r10104  
    1 /* $Id: timer.cpp,v 1.15 2003-05-16 09:21:00 sandervl Exp $ */
     1/* $Id: timer.cpp,v 1.16 2003-05-16 10:59:27 sandervl Exp $ */
    22
    33/*
     
    3232#endif
    3333
    34 #define WM_TIMER_W    0x0113
    35 #define WM_SYSTIMER_W 0x0118
    36 typedef VOID (CALLBACK *TIMERPROC)(HWND hwnd, UINT msg, UINT id, DWORD dwTime);
    37 
    3834typedef struct tagTIMER
    3935{
     
    6864}
    6965
    70 BOOL TIMER_GetTimerInfo(HWND PMhwnd,ULONG PMid,PBOOL sys,PULONG id)
     66BOOL TIMER_GetTimerInfo(HWND PMhwnd,ULONG PMid,PBOOL sys,PULONG id, PULONG proc)
    7167{
    7268  int i;
    7369  TIMER *pTimer;
    7470
     71  EnterCriticalSection ();
    7572  for (i = 0, pTimer = TimersArray; i < NB_TIMERS; i++, pTimer++)
    7673      if (pTimer->inUse && (pTimer->PMhwnd == PMhwnd) && (pTimer->PMid == PMid))
    7774          break;
     75  LeaveCriticalSection();
    7876
    7977  if (i == NB_TIMERS)  /* no matching timer found */
     
    8280  *sys = pTimer->inUse == TIMER::SystemTimer;
    8381  *id  = pTimer->id;
     82  *proc = (ULONG)pTimer->proc;
    8483
    8584  return TRUE;
    8685}
     86
     87/***********************************************************************
     88 *           TIMER_IsTimerValid
     89 */
     90BOOL TIMER_IsTimerValid( HWND hwnd, UINT id, ULONG proc )
     91{
     92    int i;
     93    TIMER *pTimer;
     94    BOOL ret = FALSE;
     95
     96    EnterCriticalSection ();
     97
     98    for (i = 0, pTimer = TimersArray; i < NB_TIMERS; i++, pTimer++)
     99        if ((pTimer->hwnd == hwnd) && (pTimer->id == id) && (pTimer->proc == (TIMERPROC)proc))
     100        {
     101            ret = TRUE;
     102            break;
     103        }
     104
     105    LeaveCriticalSection();
     106    return ret;
     107}
     108
    87109
    88110BOOL TIMER_HandleTimer (PQMSG pMsg)
     
    93115    ULONG PMid   = (ULONG)(pMsg->mp1);
    94116
     117    EnterCriticalSection ();
    95118    for (i = 0, pTimer = TimersArray; i < NB_TIMERS; i++, pTimer++)
    96119        if (pTimer->inUse && (pTimer->PMhwnd == PMhwnd) && (pTimer->PMid == PMid))
    97120            break;
     121    LeaveCriticalSection();
    98122
    99123    if (i == NB_TIMERS)  /* no matching timer found */
Note: See TracChangeset for help on using the changeset viewer.