R
rqj
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.newBar1Click(Sender: TObject);var h:HWND; ThreadID:THandle; buffer:array[0..255] of char;begin h:= FindWindow(nil,pchar(Fcontrol.FromName)); if h<>0 then Begin EnumChildWindows(h,@EnumChildWindowsProc,Longint(@buffer[0]));// ShowMessage(StrPas(buffer)); End Else Begin ShowMessage('窗体'+Fcontrol.FromName+'句柄没有找到!'); Exit; End;end;function EnumChildWindowsProc(hwnd,lparam:Integer):Boolean;var WndCaption: array[0..255] of Char; ulpClassName : array[0..255] of Char; i : integer ;begin Result:=True; windows.GetWindowText(hwnd, WndCaption, 256); windows.GetClassName(hwnd, ulpClassName, 256); //if (WndCaption[0]<>chr(0)) then begin showmessage(StrPas(WndCaption)+':'+StrPas(ulpClassName)); //如果ulpClassName是'TEdit'(Delphi/BCB程序)或'Edit'(VC/VB程序)则用FindWindowEx找到控件句柄 end;end;为什么我取道的值都是空的呢 showmessage(StrPas(WndCaption)+':'+StrPas(ulpClassName)); 为空