阅读:1949回复:15
谁帮我解决这个问题,我嫁给他
用的是DELPHI 7.0
前面用 SetwindowsHookEx(WH_CALLWNDPROC,HookProc,HInstance,0); 挂钩 钩子函数: function HookProc(icode:integer;wparam:wparam;lparam:lparam):lresult;stdcall;export; type Msg = ^CWPSTRUCT; var p : Msg; begin if icode<0 then begin result:=callnexthookex(nexthookproc,icode,wparam,lparam); exit; end; p := Msg(lParam); if p^.message = WM_SPOOLERSTATUS then // BEGIN showmessage(inttostr(lParam)); ///不会触发 END; result:=0; end; 无法截获打印队列变化,所发出的消息,请指教 我是美女哦!!!!!!!! [编辑 - 1/10/05 by qiaiduo] |
|
沙发#
发布于:2005-01-10 12:59
声明:俺不想娶你:-) 这么....,一定是嫁(得/不)出去,嘿嘿
I think you are a new hand! now, you can reference the following information I provided to you(You may find you can't intercept messages by your meanings), and you can get the idea how to modify your program, best wishes to you: [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_3zub.asp [/url] WM_SPOOLERSTATUS The WM_SPOOLERSTATUS message is sent from Print Manager whenever a job is added to or removed from the Print Manager queue. A window receives this message through its WindowProc function. LRESULT CALLBACK WindowProc( HWND hwnd, // handle to window UINT uMsg, // WM_SPOOLERSTATUS WPARAM wParam, // job status LPARAM lParam // number of jobs remaining ); Parameters wParam Specifies the PR_JOBSTATUS flag. lParam The low-order word specifies the number of jobs remaining in the Print Manager queue. Return Values An application should return zero if it processes this message. Remarks This message is for informational purposes only. This message is advisory and does not have guaranteed delivery semantics. Applications should not assume that they will receive a WM_SPOOLERSTATUS message for every change in spooler status. Note The WM_SPOOLERSTATUS message is not supported after Windows XP. To be notified of changes to the print queue status, use FindFirstPrinterChangeNotification and FindNextPrinterChangeNotification. The following code outlines how this might be done. HANDLE chgObject; DWORD *pdwChange; BOOL fcnreturn; chgObject = FindFirstPrinterChangeNotification( hPrinter, PRINTER_CHANGE_JOB, 0, NULL); WaitForSingleObject(chgObject, INFINTE); fcnreturn = FindNextPrinterChangeNotification(chgObject, pdwChange, NULL, NULL); if (fcnreturn) { // check value of *pdwChange and deal with the indicated change Requirements Windows NT/2000/XP: Included in Windows NT 3.1 and later. Windows 95/98/Me: Included in Windows 95 and later. Header: Declared in Winuser.h; include Windows.h. See Also Printing and Print Spooler Overview, Printing and Print Spooler Messages, LOWORD, FindFirstPrinterChangeNotification and FindNextPrinterChangeNotification |
|
|
板凳#
发布于:2005-01-10 15:10
我用的是windows2000应该支持这个消息的,没道理啊,请楼上的朋友详细说说好吗?谢了。
|
|
地板#
发布于:2005-01-10 18:13
Please read the related help file before, then ask questions to me and others. OK?
Oh, you can search the related topic in the google.com, there are lots of source code about printing. BRGs to you! |
|
|
地下室#
发布于:2005-01-10 19:49
真的嫁人吗??
:P :P :P |
|
|
5楼#
发布于:2005-01-11 08:44
不好意思,我搜索了一下,关于这个消息的介绍很少,还没有解决问题,请楼上几位好心人帮帮忙,老板不停地吵,电话不停地闹,你们忍心看我这个小丫头被炒了吗?
|
|
6楼#
发布于:2005-01-11 10:28
不好意思,我搜索了一下,关于这个消息的介绍很少,还没有解决问题,请楼上几位好心人帮帮忙,老板不停地吵,电话不停地闹,你们忍心看我这个小丫头被炒了吗? 不要在这里装酷了,你要嫁给人家,人家有老婆了还怎么敢回答呀 还不如直接给分,另外这里不是讨论DELPHI的地方,如果是VC应用开发可到别的主题去,DELPHI 可到那些专业讨论DELPHI 的网站,这样可能会更好些哦 |
|
|
7楼#
发布于:2005-01-13 19:44
哦, 没pp不回答
|
|
8楼#
发布于:2005-01-16 13:29
嫁出去了吗 :D :P
|
|
|
9楼#
发布于:2005-01-17 13:31
你家里同意吗?
|
|
10楼#
发布于:2005-01-17 14:02
jgw2008 说得对
|
|
11楼#
发布于:2005-01-17 15:43
楼主的这种方法只能在9x下有效,但我试了一下,居然也没有成功。
|
|
12楼#
发布于:2005-01-17 19:45
嫁出去了吗 :D :P :D :D :D |
|
|
13楼#
发布于:2005-01-18 14:02
showmessage(inttostr(lParam)); ///不会触发
首先我认为你的意思是这句代码不执行,我认为实际上是执行的, 因为你要通过DLL输出,所以不能用string 的类型,如果用到了String就要加一个在系统目录上加BORLNDMM.DLL,解决办法是, 在用到String的字符的时候全部强制转成pchar类型的,你用 showmessage(pchar(inttostr(lParam))); 这样看看能不能执行。 |
|
|
14楼#
发布于:2005-01-19 10:39
你好!
你是要做打印监控吗? 我也是在做同样的东西! 你要保留打印的内容吗? 可以交流交流! QQ:439694036 |
|
|
15楼#
发布于:2005-01-22 21:53
想嫁人?考虑一下我吧
|
|