关于如何截获程序消息的问题

来源:百度知道 编辑:UC知道 时间:2024/06/03 21:24:25
想截获某一个程序的菜单上的一个功能,使这个功能失效,该如何编写啊
知道使用钩子函数,但不知如何截获这个菜单消息,如何在操作系统中捕获它,希望高手指点,最好给出源代码
急用
请知道的人帮忙啊

Win98se+delphi7,我自己编写的,不过对qq没有测试过,我自己写了个象qq的界面接收发送消息的窗口,用来测试的,给你吧,写的不好.看看对你的问题是否有提示。
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;

type
TForm1 = class(TForm)
BitBtn1: TBitBtn;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure FormCreate(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
function GetWndText(hWnd:HWND):string;
procedure SetWndText(hWnd:HWND;szText:string);
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
hMouse:HHook;
hKey:HHook;
const
sendStr='就让我面对冰冷的电脑,想象你的笑容......';
implementation

{$R *.dfm}

function TForm1.GetWndText(hWnd: HWND): string;
var
bufTemp:pchar;
b