Module: D:\SOURCE\WORK\DLCTIMER\dlctimer.cpp Group: 'DGROUP' CONST,CONST2,_DATA,_BSS Segment: dlctimer_TEXT PARA 000002cb bytes #define STRICT #include #include "dlctimer.hpp" struct DLCTimer { HWND hWnd; UINT msg; WPARAM wParam; LPARAM lParam; BOOL post; LONG interval; LONG start; }; static DLCTimer __far timer[20]; static int __far timers=0; BOOL CALLBACK __export StartDLCTimer(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL post, LONG interval) { 0000 int far StartDLCTimer( HWND__ const near *, int unsigned, int unsigned, long, int, long ): 0000 1e push ds 0001 58 pop ax 0002 90 nop 0003 45 inc bp 0004 55 push bp 0005 89 e5 mov bp,sp 0007 1e push ds 0008 8e d8 mov ds,ax 000a 56 push si 000b 57 push di 000c 81 ec 02 00 sub sp,0002H if(timers==20) return FALSE; 0010 b8 00 00 mov ax,seg int far timers 0013 8e c0 mov es,ax 0015 26 83 3e 00 00 14 cmp word ptr es:int far timers,0014H 001b 75 08 jne L1 001d c7 46 f8 00 00 mov word ptr -8H[bp],0000H 0022 e9 f5 00 jmp L2 timer[timers].hWnd = hWnd; 0025 b8 00 00 L1 mov ax,seg int far timers 0028 8e c0 mov es,ax 002a 26 a1 00 00 mov ax,es:int far timers 002e bb 14 00 mov bx,0014H 0031 f7 eb imul bx 0033 89 c3 mov bx,ax 0035 b8 00 00 mov ax,seg DLCTimer far timer[] 0038 8e c0 mov es,ax 003a 8b 46 14 mov ax,+14H[bp] 003d 26 89 87 00 00 mov es:DLCTimer far timer[][bx],ax timer[timers].msg = msg; 0042 b8 00 00 mov ax,seg int far timers 0045 8e c0 mov es,ax 0047 26 a1 00 00 mov ax,es:int far timers 004b bb 14 00 mov bx,0014H 004e f7 eb imul bx 0050 89 c3 mov bx,ax 0052 b8 00 00 mov ax,seg DLCTimer far timer[] 0055 8e c0 mov es,ax 0057 8b 46 12 mov ax,+12H[bp] 005a 26 89 87 02 00 mov es:DLCTimer far timer[]+2H[bx],ax timer[timers].wParam = wParam; 005f b8 00 00 mov ax,seg int far timers 0062 8e c0 mov es,ax 0064 26 a1 00 00 mov ax,es:int far timers 0068 bb 14 00 mov bx,0014H 006b f7 eb imul bx 006d 89 c3 mov bx,ax 006f b8 00 00 mov ax,seg DLCTimer far timer[] 0072 8e c0 mov es,ax 0074 8b 46 10 mov ax,+10H[bp] 0077 26 89 87 04 00 mov es:DLCTimer far timer[]+4H[bx],ax timer[timers].lParam = lParam; 007c b8 00 00 mov ax,seg int far timers 007f 8e c0 mov es,ax 0081 26 a1 00 00 mov ax,es:int far timers 0085 bb 14 00 mov bx,0014H 0088 f7 eb imul bx 008a 89 c3 mov bx,ax 008c b8 00 00 mov ax,seg DLCTimer far timer[] 008f 8e c0 mov es,ax 0091 8b 46 0c mov ax,+0cH[bp] 0094 26 89 87 06 00 mov es:DLCTimer far timer[]+6H[bx],ax 0099 8b 46 0e mov ax,+0eH[bp] 009c 26 89 87 08 00 mov es:DLCTimer far timer[]+8H[bx],ax timer[timers].post = post; 00a1 b8 00 00 mov ax,seg int far timers 00a4 8e c0 mov es,ax 00a6 26 a1 00 00 mov ax,es:int far timers 00aa bb 14 00 mov bx,0014H 00ad f7 eb imul bx 00af 89 c3 mov bx,ax 00b1 b8 00 00 mov ax,seg DLCTimer far timer[] 00b4 8e c0 mov es,ax 00b6 8b 46 0a mov ax,+0aH[bp] 00b9 26 89 87 0a 00 mov es:DLCTimer far timer[]+0aH[bx],ax timer[timers].interval = interval; 00be b8 00 00 mov ax,seg int far timers 00c1 8e c0 mov es,ax 00c3 26 a1 00 00 mov ax,es:int far timers 00c7 bb 14 00 mov bx,0014H 00ca f7 eb imul bx 00cc 89 c3 mov bx,ax 00ce b8 00 00 mov ax,seg DLCTimer far timer[] 00d1 8e c0 mov es,ax 00d3 8b 46 06 mov ax,+6H[bp] 00d6 26 89 87 0c 00 mov es:DLCTimer far timer[]+0cH[bx],ax 00db 8b 46 08 mov ax,+8H[bp] 00de 26 89 87 0e 00 mov es:DLCTimer far timer[]+0eH[bx],ax timer[timers].start = GetTickCount(); 00e3 9a 00 00 00 00 call far GETTICKCOUNT 00e8 89 c1 mov cx,ax 00ea 89 d3 mov bx,dx 00ec b8 00 00 mov ax,seg int far timers 00ef 8e c0 mov es,ax 00f1 26 a1 00 00 mov ax,es:int far timers 00f5 be 14 00 mov si,0014H 00f8 f7 ee imul si 00fa 89 c6 mov si,ax 00fc b8 00 00 mov ax,seg DLCTimer far timer[] 00ff 8e c0 mov es,ax 0101 26 89 8c 10 00 mov es:DLCTimer far timer[]+10H[si],cx 0106 26 89 9c 12 00 mov es:DLCTimer far timer[]+12H[si],bx timers++; 010b b8 00 00 mov ax,seg int far timers 010e 8e c0 mov es,ax 0110 26 ff 06 00 00 inc word ptr es:int far timers return TRUE; 0115 c7 46 f8 01 00 mov word ptr -8H[bp],0001H } 011a 8b 46 f8 L2 mov ax,-8H[bp] 011d 8d 66 fa lea sp,-6H[bp] 0120 5f pop di 0121 5e pop si 0122 1f pop ds 0123 5d pop bp 0124 4d dec bp 0125 ca 10 00 retf 0010H BOOL CALLBACK __export StopDLCTimer(HWND hWnd) { 0128 int far StopDLCTimer( HWND__ const near * ): 0128 1e push ds 0129 58 pop ax 012a 90 nop 012b 45 inc bp 012c 55 push bp 012d 89 e5 mov bp,sp 012f 1e push ds 0130 8e d8 mov ds,ax 0132 56 push si 0133 57 push di 0134 81 ec 04 00 sub sp,0004H for(int t=0; t= timer[t].interval) { timer[t].start = dwTime; if(IsWindow(timer[t].hWnd)) { if(timer[t].post) PostMessage(timer[t].hWnd,timer[t].msg,timer[t].wParam,timer[t].lParam); else SendMessage(timer[t].hWnd,timer[t].msg,timer[t].wParam,timer[t].lParam); } else { for(int j=t; j