beginthread
解决方案 »
- 用多线程操作,从一个数据库里检索出数据导入到另一个库里的方法
- 想参加开源的项目
- 提个很多新手的问题:ADO与数据库的连接问题。
- TDBGrid内的内容怎样导如到editli面
- 找Delphi5开发人员指南附书源码!
- 没人敢作答的问题!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- 一个很菜的问题,大家帮帮我,谢谢各位!!
- MDI窗体当调用Application.CreateForm后,便执行窗体的Form_Active事件,怎样使它在调用Show之后执行?
- 请教各位关于编写自定义的事件处理函数的问题
- 除了Delphi还该不该会Vc?
- delphi:在Caption属性前加标“&”号设立加速键,我并没有发觉有什么不同,加速到底指的是什么???
- 帮翻译一段VC的代码,谢谢啊。
我再重申一下我的问题吧!我只想求一段 用DELPHI 可以向另一个程序中的文本框、下拉框和子窗口中的文本框 等输入自己想要的信息
这样一个小例子!
就这么简单!!
var
//Ret: LongInt;
//mText: PChar;
Buf: Integer;
begin
//GetMem(mText, Length(Text));
//StrCopy(mText, PChar(Text));
//try
Buf := LongInt(pchar(Text));
sendMessage(hWnd, WM_SETTEXT, 0, Buf);
sleep(20);
//finally
//FreeMem(mText,sizeof(text));
//end;
end;
procedure postText_cb(hWnd: HWND; Text: string); //组合框赋值
var
//Ret: LongInt;
//mText: PChar;
Buf: Integer;
begin
//GetMem(mText, Length(Text));
//StrCopy(mText, PChar(Text));
//try
Buf := LongInt(pchar(Text));
//sendMessage(hWnd, CB_SELECTSTRING, -1, Buf);
sendMessage(hWnd, CB_SELECTSTRING, -1, Buf);
sleep(20);
//finally
//FreeMem(mText,sizeof(text));
//end;
end;
function EnumChildWindowsPro(Handle:HWND;ConInfor:LPARAM):boolean;stdcall; //遍历窗口
begin
if not (Handle > 0) then
begin
result := false;
exit;
end;
mypro[i_win]:=handle;
i_win:=i_win+1;//转换参数 result := true; end; function FindControl(Parent:HWND;ClassName,ControlName:String):HWND;
//方便调用EnumChildWindows函数
var
tConInfor:ControlInfor;
begin
tConInfor.ClassName:=ClassName;
tConInfor.ControlName:=ControlName;
EnumChildWindows(Parent,@EnumChildWindowsPro,LongInt(@tConInfor));
Result:=hControl;
end;//数字
function posttext2(mhd:hwnd;mstring:string):integer; //另一个文本框赋值函数
var
s:string;
hd1:hwnd;
ch: byte;
i: Integer;
pcText:array[0..254] of char;
begin
s:=mstring;
hd1:=mhd;
//全选文本框
//sendmessagea(hd1, EM_SETSEL, 0, -1);
postmessagea(hd1, EM_SETSEL, 0, -1);
Sleep(25);
postmessagea(hd1, WM_CLEAR, 0, 0);
Sleep(25);
//开始发送
lstrcpy(pcText,PChar(s));
i := 0;
while i<=254 do
begin
if pcText[i]<>#0 then
begin
ch := byte(pctext[i]);
if Windows.IsDBCSLeadByte(ch) then
begin
postmessagea(hd1, WM_CHAR, ch, 0);
Inc(i);
sleep(20);
postmessagea(hd1, WM_CHAR, byte(pctext[i]), 0);
Sleep(20);
end
else
postmessagea(hd1, WM_CHAR, Word(ch), 0);
Sleep(20);
Inc(i);
end
else break;
end;
result:=1;
end;//文本赋值 与上面的区别在sendmessagea函数
function posttext1(mhd:hwnd;mstring:string):integer;
var
s:string;
hd1:hwnd;
ch: byte;
i: Integer;
pcText:array[0..254] of char;
begin
s:=mstring;
hd1:=mhd;
//全选文本框
sendmessagea(hd1, EM_SETSEL, 0, -1);
Sleep(25);
sendmessagea(hd1, WM_CLEAR, 0, 0);
Sleep(25);
//开始发送
lstrcpy(pcText,PChar(s));
i := 0;
while i<=254 do
begin
if pcText[i]<>#0 then
begin
ch := byte(pctext[i]);
if Windows.IsDBCSLeadByte(ch) then
begin
sendmessagea(hd1, WM_CHAR, ch, 0);
Inc(i);
sleep(25);
sendmessagea(hd1, WM_CHAR, byte(pctext[i]), 0);
Sleep(25);
end
else
sendmessagea(hd1, WM_CHAR, Word(ch), 0);
Sleep(25);
Inc(i);
end
else break;
end;
result:=1;
end;//建议用前三个函数处理赋值。中间的两个函数用来遍历窗体。