Example of implementing the interface follows the mouse movement

xiaoxiao2021-03-06  40

Unit UNIT_MOUSE;

Interface

Uses Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Stdctrls, Menus

{================================================================================================================================================================================================================ ====== Design By: Good moon / jade noodles Date: 2005-01-30 Site: http://www.eastrise.cn/quick2004 blog: http://blog.9cbs.net/jackie168 email: Joe -lu@163.com

The article is the author original. Please contact him before reprinting, reprint, please indicate the article, retain the author information, thank you for your support! ============================================================================================================================================================================================================= =====}

TYPUPM1 = Class (TFORM) PopupMenu1: TPopupmenu; N1: TMenuItem; Procedure N1Click (sender: TOBJECT); private {private declarations}

Var Form1: TFORM1; I: Integer; // Global Variable IMPLEMENTATION

{$ R * .dfm} // self-contained functions Function Proc (Icode: integer; wparam: wparam; lparam: lparam): LRESULT; stdcall; valuevtmsg: teventmsg; begin evtmsg: = peventmsg (lparam) ^; form1.left: = Mouse.cursorpos.x 10; form1.top:=mouse.cursorpos.y 10; if evtmsg.Message = WM_RBUTTONUP THEN FORM1.N1.CLICK; END;

procedure TForm1.N1Click (Sender: TObject); begin N1.Checked: = not N1.Checked; if N1.Checked then i: = setwindowshookex (WH_JOURNALRECORD, proc, hinstance, 0) else unhookwindowshookex (i); Top: = (screen . HEIGHT-HEIGHT) DIV 2; Left: = (Screen.width - Width-55) Div 2; End;

转载请注明原文地址:https://www.9cbs.com/read-62654.html

New Post(0)