Capture The Print Event of Word

I want a program to be a  kind of service. The Program is sitting on the memory, try to capture the Print Dialog Event  when we choose Print from
file menu inside Word2000.
May be we need to some API function call.
Who is Participating?
afzaljConnect With a Mentor Commented:
Easy, hook window / dialog creation. Use
SetWindowsHookEx(WH_CALLWNDPROC, (HOOKPROC){hookproc}, NULL, 0) to hook windows where {hookproc} is your hook procedure.
(You could scan the window created for it's title name as it will be a specified title like "Print"). I know it's a bit dodgy, but it'll work.:)
chenhuazhenAuthor Commented:
Could you E-mail me some source code about how to use SetWindowsHookEx(), I will really be happy. My email address is

Could I use some API functin derectly to capture if the print object is working and who use that?

Anyway, thank you very much!

chenhuazhenAuthor Commented:
SetWindowsHookEx(WH_CALLWNDPROC, (HOOKPROC){hookproc}, NULL, 0)? NULL and 0 can be used at same time.  If the dwThreadId parameter is zero(track all thread), the lpfn parameter must point to a hook procedure in a dynamic-link library (DLL).
I built DLL, but I can't debug. If I run that, program dies. How to debug the global hook functions. Another isue, should I create a thead to deal with it?
All Courses

From novice to tech pro — start learning today.