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