![]() |
![]() |
||
|
[Return]
|
|||
;add this extra function to the external declarations... EXTRN POSTMESSAGE:FAR ; .CODE ;put in the usual WINMAIN() function ...;followed by a callback ... PUBLIC DPMICALLBACK DPMICALLBACK PROC WINDOWS PASCAL FAR \ hWnd:WORD,msgtype:WORD,wParam:WORD, lParam:DWORD ;put in the usual CASE structure to process messages, ;but with some additions ... mov ax,msgtype cmp ax,WM_CREATE je xcreate cmp ax,WM_DESTROY je xdestroy cmp ax,WM_USER je xuser ...etc ... ... ;here is the handling of the WM_CREATE case ... xcreate: ;whatever you want, plus ... call installint ;hooks the vector. jmp xexit ;here is the handling of the WM_USER case ... xuser: push ax push dx mov ah,2 ;write char to scrn mov dl,07 ;beep int 21h pop dx pop ax jmp xexit xdestroy: call POSTQUITMESSAGE PASCAL,0 ;unhook the int-51h... push dx push ds mov dx,offsetint ;this is the old INT-51 vector mov ds,selectorint ; / mov ax,2551h ;before quitting, we are restoring it. int 21h pop ds pop dx jmp xexit ;whatever else you want here ... ... xexit: sub ax,ax ;returns 0 in DX:AX. cwd ;return a 32-bit (long) value). ret DPMICALLBACK ENDP
Copyright © 1997, R&D Books, an imprint of Miller Freeman, Inc. All rights reserved. Last updated: 10/09/97