[comp.windows.ms.programmer] How can I intercept application calls to Windows?

dsims@uceng.UC.EDU (david l sims) (05/18/91)

Remember in the good old days of DOS where we could intercept calls to the
operating system by changing a vector in the interrupt vector table?

Well, how can I do the equivalent in Windows?  I would like to write an
experimental program that would simply count the number of times a
particular Windows procedure was called.  If I could intercept these
calls, I could maintain a counter and then proceed to call the real
Windows procedure after I update my counter.

Any ideas?

Also, what about intercepting Windows messages?  I believe the program
POSTMAN does this.  Any ideas on that?

David Sims...dsims@uceng.uc.edu

cadsi@ccad.uiowa.edu (CADSI) (05/19/91)

From article <8516@uceng.UC.EDU>, by dsims@uceng.UC.EDU (david l sims):
> Remember in the good old days of DOS where we could intercept calls to the
> operating system by changing a vector in the interrupt vector table?
> 
> Well, how can I do the equivalent in Windows?  I would like to write an
> experimental program that would simply count the number of times a
> particular Windows procedure was called.  If I could intercept these
> calls, I could maintain a counter and then proceed to call the real
> Windows procedure after I update my counter.
> 
> Any ideas?
> 

SetWindowsHook() is the function you should look at.

|----------------------------------------------------------------------------|
|Tom Hite					|  The views expressed by me |
|Manager, Product development			|  are mine, not necessarily |
|CADSI (Computer Aided Design Software Inc.	|  the views of CADSI.       |
|----------------------------------------------------------------------------|