Home > Back-end >  How Delphi Hook handle to specify the form of news
How Delphi Hook handle to specify the form of news

Time:09-17

Now do a small program, need to monitor play page of PPT, namely after the PPT page to inform the main program, I saw, with spy++ PPT page with news, excuse me, how to intercept the message? (I am currently using memory method is to use threads read data, but also good powerpoint is 32-bit, address is found, if is a 64 - bit address haven't caught, and unstable, all from the aspects of intercepting messages,) learned a few examples of hook, all don't succeed

CodePudding user response:

Obtains the window handle to the thread ID, because SetWindowsHOOK parameter is the thread ID

CodePudding user response:

Don't quite understand, hook my blog to one thousand the examples do global can intercept the mouse or keyboard hooks, but intercept specified form, can intercept, the program can't intercepted PPT form hooks:=setWindowsHookEx (WH_cat, proc, HInstance, 0); Or hook:=setWindowsHookEx (WH_cat, proc, HInstance, PPPTPid); All this,

CodePudding user response:

DLL code, under the great god give directions, do not enter the callback function
 
The function HookProc (nCode: Integer; WParam: wParam; LParam: lParam) : LRESULT; Stdcall;
The begin
{
Case wParam of
WM_MOUSEMOVE: info:='mouse position;
WM_LBUTTONDOWN: info:='press';
WM_LBUTTONUp: info:='let go';
end;
Info:=Format (" % s: % d, % d ", [info, PMouseHookStruct (lParam) ^. Pt. X, PMouseHookStruct (lParam) ^. Pt. Y]);
}
{through the message data is passed to the specified window}
Info:=IntToStr (wParam);
PostMessage (h, WM_MyMessage, 0, an Integer (PChar (info)));

Result:=CallNextHookEx (hook, nCode wParam, lParam);
end;

The function SetHook: Boolean; Stdcall;
Const
WH_MOUSE_LL=14;
Var h: HWND; Id: the Cardinal;
The begin
//powrpointView window handle to find
H:=FindWindow (' PPTFrameClass 'nil);
H:=FindWindowEx (h, 0, 'MDIClient, nil);
H:=FindWindowEx (h, 0, 'mdiClass, nil);
H:=FindWindowEx (h, 0, 'paneClassDC, nil);
Id=GetWindowThreadProcessId (h, nil);
Hook:=SetWindowsHookEx (WH_CALLWNDPROC, @ HookProc HInstance, id);
Result:=hook & lt;> 0;
end;

CodePudding user response:

Use spy++ grab news is

CodePudding user response:

Do global mouse hook or keyboard hook, should be process in the memory space can't visit each other,
Must be injected into dynamic link library own programs and other programs share a memory blocks to get information from another program,

CodePudding user response:

Do not understand... if you are convenient, can write a simple demo, thanks a lot

CodePudding user response:

Hook window procedure, WH_CALLWNDPROC this Hook will check all message processing
You can directly replace the window procedure, to deal with authority, then the SetWindowLong replace the window procedure

CodePudding user response:

If just monitor the pages, I think you can change the way of thinking, using OLE programming, direct call PowerPoint to the corresponding API can not, only to EXCEL, for the operation of the PowerPoint didn't

CodePudding user response:

Or you write in a Powerpoint a VB code, the news directly to also can

CodePudding user response:

PPT page turns, the window does not change, only change the content (page),

CodePudding user response:

references 9 f nebula845026 response:
or you write a VB code in Powerpoint, the news come to also can be directly to the


Because the user environment is different, PPT version and file need not, unable to insert the vba scripts, PPT

CodePudding user response:

http://download.csdn.net/download/sololie/6271981
  • Related