該方法能夠監控到form 外面的滑鼠移動情況,無需dll實現
unit unit1;
inte***ce
uses
windows, messages, sysutils, variants, classes, graphics, controls, forms,
dialogs, stdctrls;
type
tform1 = class(tform)
button1: tbutton;
procedure button1click(sender: tobject);
procedure formclose(sender: tobject; var action: tcloseaction);
private
procedure hook(en: boolean = true);
public
end;
varform1: tform1;
hhook: longword;
xy: tpoint;
implementation
function hookproc(icode: integer; wparam: wparam; lparam: lparam): lresult; stdcall;
begin
result := 0;
if(peventmsg(lparam)^.message = wm_lbuttondown) or
(peventmsg(lparam)^.message = wm_lbuttonup) or
(peventmsg(lparam)^.message = wm_lbuttondblclk) or
(peventmsg(lparam)^.message = wm_mousemove) or
(peventmsg(lparam)^.message = wm_rbuttondown) or
(peventmsg(lparam)^.message = wm_rbuttonup) or
(peventmsg(lparam)^.message = wm_rbuttondblclk) or
(peventmsg(lparam)^.message = wm_mbuttondown) or
(peventmsg(lparam)^.message = wm_mbuttonup) or
(peventmsg(lparam)^.message = wm_mbuttondblclk)
then
begin
getcursorpos(xy);
form1.caption := inttostr(xy.x) + ' ' + inttostr(xy.y);
end;
result := callnexthookex(hhook, icode, wparam, lparam);
end;
procedure tform1.button1click(sender: tobject);
begin
hook;
end;
procedure tform1.hook(en: boolean);
begin
if en then
hhook := setwindowshookex(wh_journalrecord, hookproc, hinstance, 0)
else
unhookwindowshookex(hhook);
end;
procedure tform1.formclose(sender: tobject; var action: tcloseaction);
begin
hook(false);
end;
end.
全排列的實現
在c 的模板中,有一對專門用於實現數字或字元全排列的模板 next permutation biter,biter 和prev permutation biter,biter 前者實現向後排列,後者實現向前排列,即前者在原順序上依次產生較大的排列,後者則相反。舉個例子 假設需要產生以 354 為基礎...
全排列的實現
程式設計思路如下 擷取自 erlang程式設計 3.8 除錯的 include include include using namespace std void insert string str,char ch,vector aa void fun string array,vector a st...
PHP iFrame實現頁面無需重新整理的非同步檔案上傳
說到iframe,現在用它的人是越來越少了,並且很多人都相信它應該被ajax所取代,的確如此,因為ajax太出色了。不過有一種情況的實現我還是選擇了iframe,這就是本文要說的檔案的非同步上傳,感興趣的可以試試,如果用原生的ajax來實現應該是要複雜的多。先來給初學者補補基礎知識 1.在ifram...
wifi共享dll的實現
現在筆記本建立wifi熱點的軟體比比皆是,那我們也來自己做一個試試看。using system using system.collections.generic using system.linq using system.text using system.diagnostics using sy...
dll匯出類的實現
首先是在dll中實現類得宣告 新增inc.h標頭檔案 cpp view plain copy class declspec dllexport cpreson 在dllmain.cpp中或自定義個個inc.cpp檔案實現類 cpp view plain copy cpreson cpreson cp...