pb:
string ls_Classname,ls_WindowName
ulong ll_winhandle
uint li_result
setnull(ls_ClassName)
ls_WindowName ="Form1" //Delphi程序窗口名稱
ll_winhandle = findwindow(ls_ClassName,ls_WindowName)
if ll_winhandle>0 then //撥通
li_result = RegisterWindowMessage('1111') //注冊系統消息,返回系統唯一消息號
post(ll_winhandle,li_result,0,0)
messagebox("提示","知道")
else
messagebox("提示","沒有找到")
end if
======================================
Delphi:
聲明部分:
private
Msg: LongInt;
hWndC : THandle;
{ Private declarations }
protected
procedure WndProc(var Message: TMessage); override;
procedure TForm1.FormCreate(Sender: TObject);
begin
Msg := RegisterWindowMessage('1111');//返回系統唯一消息號,1111為自定義消息內容
Self.BringToFront;
end;
procedure TForm1.WndProc(var Message: TMessage);
var
mypt:Tpoint;
s:string;
begin
if Message.msg = msg then begin
ShowMessage(inttostr(message.lparam) );
end ;
inherited;
end;