Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

usergdi.c

Go to the documentation of this file.
00001 /****************************** Module Header ******************************\ 00002 * Module Name: timers.c 00003 * 00004 * Copyright (c) 1985 - 1999, Microsoft Corporation 00005 * 00006 * This module contains GDI-callable exports from user. No user code 00007 * should call any of these routines. 00008 * 00009 * History: 00010 * 3-Jun-1998 AndrewGo Created. 00011 \***************************************************************************/ 00012 00013 #include "precomp.h" 00014 #pragma hdrstop 00015 00016 /***************************************************************************\ 00017 * UserSetTimer() 00018 * 00019 * GDI-callable routine to enable a system timer on the RIT. 00020 * 00021 * 6/2/98 AndrewGo Created 00022 \***************************************************************************/ 00023 00024 UINT_PTR UserSetTimer(UINT dwElapse, PVOID pTimerFunc) 00025 { 00026 UINT_PTR id = 0; 00027 PTIMER ptmr; 00028 00029 /* 00030 * GDI may call during ChangeDisplaySettings, in which case the 00031 * critical section will already be held. GDI may also call during 00032 * CreateDC("Device"), in which case the critical section will not 00033 * already be held. 00034 */ 00035 BEGIN_REENTERCRIT(); 00036 00037 /* 00038 * If the RIT hasn't been started yet, let GDI know this by returning 00039 * failure. Once we've initialized the RIT, we'll let GDI know 00040 * that GDI can start its timers by calling GreStartTimers(). 00041 */ 00042 if (gptmrMaster) { 00043 00044 id = InternalSetTimer(NULL, 0, dwElapse, (TIMERPROC_PWND) pTimerFunc, TMRF_RIT); 00045 00046 /* 00047 * We don't want cleanup to be done on thread termination. Rather 00048 * than creating a new flag and adding more code to InternalSetTimer, 00049 * we disable cleanup by modifying the timer directly. 00050 */ 00051 if (id) { 00052 00053 ptmr = FindTimer(NULL, id, TMRF_RIT, FALSE); 00054 00055 UserAssert(ptmr); 00056 00057 ptmr->ptiOptCreator = NULL; 00058 } 00059 } 00060 00061 END_REENTERCRIT(); 00062 00063 return id; 00064 } 00065 00066 /***************************************************************************\ 00067 * UserKillTimer() 00068 * 00069 * 6/2/98 AndrewGo Created 00070 \***************************************************************************/ 00071 00072 VOID UserKillTimer(UINT_PTR nID) 00073 { 00074 /* 00075 * GDI may call during ChangeDisplaySettings, in which case the 00076 * critical section will already be held. GDI may also call any 00077 * time its PDEV reference counts go to zero, in which case the 00078 * critical section will not already be held. 00079 */ 00080 BEGIN_REENTERCRIT(); 00081 00082 KILLRITTIMER(NULL, nID); 00083 00084 END_REENTERCRIT(); 00085 }

Generated on Sat May 15 19:42:16 2004 for test by doxygen 1.3.7