标签:
1.定位窗口
fHwnd:=FindWindow(nil,‘短信中心‘);
if fHwnd=0 then
begin showmessage(‘请先登录飞信2013短信中心‘); exit; end;
{ application.CreateForm(Tpanel,fHwnd);
panel3:= Tpanel.Create(application);
panel3.ParentWindow:=panel2.ParentWindow;
panel3.Dock(panel2,Boundsrect); 2013-3-23 }
if fHwnd>0 then SendMessage(fHwnd,WM_SYSCOMMAND,SC_RESTORE,0);// 窗口最大化
Feition(g_tel,Memo1.text);
2.发送。Postmessage的运用
//author:吴chyuan 2013.1.2
procedure Feition(tel:string;fetionmsg:string);
var
i:integer;
pj:string;
fHwnd:THandle;
cHwnd3,cHwnd2,cHwnd1,cHwnd:HWND;
begin
pj:=fetionmsg; fHwnd:=FindWindow(nil,‘短信中心‘);
if fHwnd=0 then
begin showmessage(‘请先登录飞信2013短信中心‘); exit; end;
if fHwnd>0 then begin
Postmessage(FindWindow(nil,‘开班管理系统‘),WM_DATA,1,2);{2-通知主窗体调整TOP}
// SendMessage(fHwnd,WM_SYSCOMMAND,SC_MAXIMIZE,0); //最大化 SC_MAXIMIZE SC_MINIMIZE //PostMessage(fHwnd,WM_SYSCOMMAND, SC_CLOSE,0);
cHwnd:=FindWindowEx(fHwnd,0,‘FxRichEdit‘,nil);
if cHwnd>0 then
begin
sendmessage(cHwnd,messages.WM_LBUTTONDOWN ,0,$0180017A); {按下鼠标左键}
sendmessage(cHwnd,messages.WM_LBUTTONUP ,0, $0180017A);
{抬起鼠标左键}
SendMessage(cHwnd,WM_SETTEXT,0,0); {清空电话框}
for i := 1 to length(tel) do
SendMessage(cHwnd,WM_CHAR,Integer(tel[i]),0);
// SendMessage(cHwnd,WM_CHAR,Integer(#13),0); {回车}
SendMessage(chWnd, WM_KEYDOWN, VK_RETURN, 0);
SendMessage(chWnd, WM_KEYUP, VK_RETURN, 0);
end;
cHwnd1:=FindWindowEx(fHwnd,cHwnd,‘FxRichEdit‘,nil);
cHwnd2:=FindWindowEx(fHwnd,cHwnd1,‘FxRichEdit‘,nil);
cHwnd3:=FindWindowEx(fHwnd,cHwnd2,‘FxRichEdit‘,nil);
if cHwnd1>0 then
begin
// showmessage(‘请先在上面的电话点击鼠标左键确定,再点ok‘);
//MycloseWin; {2013-3-23去掉,可以不要点电话自动加信息}
SendMessage(cHwnd3,WM_SETTEXT,0,0); {清空信息框}
for i := 1 to length(pj) do
BEGIN
SendMessage(cHwnd3,WM_CHAR,Integer(pj[i]),0);
END;
end;
end;
end;
标签:
原文地址:http://www.cnblogs.com/realhope/p/4263898.html