delphi怎么发送回车键到另外一个程式的Edit窗口上? 请高手门指教! 谢谢啦 !
3个回答
展开全部
var
FormHandle, EditHandle: Integer;
Buf: Array [0..255] of Char;
begin
FormHandle := FindWindow(nil, 'Form1'); //假设另一个程序的窗口标题是Form1
if FormHandle <> 0 then
begin
EditHandle := Findwindowex(FormHandle, 0, 'TEdit', 'Edit1'); //假设另一个程序的Edit是Edit1
if EditHandle <> 0 then
PostMessage(EditHandle, WM_KEYDOWN, VK_RETURN, 0);
end;
end;
FormHandle, EditHandle: Integer;
Buf: Array [0..255] of Char;
begin
FormHandle := FindWindow(nil, 'Form1'); //假设另一个程序的窗口标题是Form1
if FormHandle <> 0 then
begin
EditHandle := Findwindowex(FormHandle, 0, 'TEdit', 'Edit1'); //假设另一个程序的Edit是Edit1
if EditHandle <> 0 then
PostMessage(EditHandle, WM_KEYDOWN, VK_RETURN, 0);
end;
end;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询