Delphi 中关于窗口的问题!
我想了解这几个函数的用处!和朋友能不能给一些详细的解释和举例findwindowHWNDFindWindow(LPCTSTRlpClassName,LPCTSTRlpWi...
我想了解这几个函数的用处!和朋友能不能给一些详细的解释和举例
findwindow
HWND FindWindow(
LPCTSTR lpClassName,
LPCTSTR lpWindowName
);
findwindowex
HWND FindWindowEx(
HWND hwndParent,
HWND hwndChildAfter,
LPCTSTR lpszClass,
LPCTSTR lpszWindow
);
sendmessage
LRESULT SendMessage(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
); 展开
findwindow
HWND FindWindow(
LPCTSTR lpClassName,
LPCTSTR lpWindowName
);
findwindowex
HWND FindWindowEx(
HWND hwndParent,
HWND hwndChildAfter,
LPCTSTR lpszClass,
LPCTSTR lpszWindow
);
sendmessage
LRESULT SendMessage(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
); 展开
展开全部
FindWindow:根据窗口类和窗口名来查找窗口句柄.
FindWindowEx:在主窗口内根据窗口类和窗口名来查找窗口句柄.
SendMessage:根据窗口句柄发送消息给该窗口.
//以下示例发送一条消息给Windows记事本.
procedure TForm1.Button1Click(Sender: TObject);
var
s:string;
hnb:HWND;
begin
s:='test';
hnb:=FindWindow('Notepad',nil);
hnb:=FindWindowEx(hnb,0,'Edit',nil);
sendmessage(hnb,WM_SETTEXT,0,longint(pchar(s)));
end;
FindWindowEx:在主窗口内根据窗口类和窗口名来查找窗口句柄.
SendMessage:根据窗口句柄发送消息给该窗口.
//以下示例发送一条消息给Windows记事本.
procedure TForm1.Button1Click(Sender: TObject);
var
s:string;
hnb:HWND;
begin
s:='test';
hnb:=FindWindow('Notepad',nil);
hnb:=FindWindowEx(hnb,0,'Edit',nil);
sendmessage(hnb,WM_SETTEXT,0,longint(pchar(s)));
end;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询