procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean);
var
setINI: Tinifile;
oldPoint, newPoint: TPOINT;
begin
if Msg.message = WM_CLOSE then {//判断是否关闭消息} begin
if Msg.HWND = Form1.handle then Form1.Close;
if Msg.HWND = Form1.WebBrowser2.handle then begin //验证消息是否WebBrowser发来的
Form1.WebBrowser2.Navigate('about:blank');
Form1.HomePage.ActivePageIndex := 0;
end;
Handled := true;
end;orm
//若是是Webbrowser,则不准使用右键菜单
if IsChild(Form1.WebBrowser2.handle, Msg.HWND) and ((Msg.message = WM_RBUTTONDOWN) or (Msg.message = WM_RBUTTONUP)) then beginit
GetCursorPos(oldPoint); //保存当前鼠标位置。
Form1.edtx.Text := IntToStr(oldPoint.X);
Form1.edty.Text := IntToStr(oldPoint.Y);
//鼠标位置写到配置文件
setINI := Tinifile.Create(GetCurDir + 'renyuansoft.ini');
setINI.WriteInteger('SET', 'x1', strtoint(Form1.edtx.Text));
setINI.WriteInteger('SET', 'y1', strtoint(Form1.edty.Text));
x1 := strtoint(Form1.edtx.Text);
y1 := strtoint(Form1.edty.Text);
setINI.Free;
Handled := true;
end;
end;io