1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57:
| var dts,serv,user,pass,pack,but,dts2,but2:hwnd; s,u,p,pk:string;
function Starte(appname: string): boolean; var StartupInfo: TStartupInfo; ProcessInfo: TProcessInformation; begin FillChar(StartupInfo, SizeOf(TStartupInfo),0); StartupInfo.cb:=SizeOf(TStartupInfo); if CreateProcess(nil, PChar(appname), nil, nil, false, NORMAL_PRIORITY_CLASS, nil, nil, startupinfo, ProcessInfo) then begin try waitforinputidle(processinfo.hProcess, INFINITE); finally CloseHandle(ProcessInfo.hProcess); CloseHandle(ProcessInfo.hThread); end; result:=true; end else result:=false; end;
begin if Starte('E:\dts\Release\dts.exe') then begin sleep(10); label1.caption:=''; s:='HAL42';u:='sa';p:='just4fun';pk:='NDS'; dts:=FindWindow(nil,'DTS');
if dts=0 then showmessage('0');
serv:=FindWindowEx(dts,0,'Edit',nil); Sendmessage(serv,WM_SETTEXT,0,Integer(@s[1]));
user:=FindWindowEx(dts,serv,'Edit',nil); Sendmessage(user,WM_SETTEXT,0,Integer(@u[1]));
pass:=FindWindowEx(dts,user,'Edit',nil); Sendmessage(pass,WM_SETTEXT,0,Integer(@p[1]));
pack:=FindWindowEX(dts,pass,'Edit',nil); SendMessage(pack,WM_SETTEXT,0,Integer(@pk[1]));
SetActiveWindow(dts);
but:=FindWindowEx(dts,0,'Button',nil); SendMessage(but,BM_CLICK,0,0);
dts2:=FindWindow(nil,'dts');but2:=FindWindowEx(dts2,0,'Button',nil); SendMessage(but2,BM_CLICK,0,0); end; end; |