来自:qince, 时间:2004-1-31 15:51:00, ID:2428711<br>1、声明回调函数,function CalBack(aa: Hwnd; bb: LPARAM): Boolean; stdcall;<br> function CalBack(aa: Hwnd; bb: LPARAM): Hwnd; stdcall;<br> var<br> aClassName, ComponetName: array[0.255] of Char;<br> S: String;<br> begin<br> Result := 0;<br> GetClassName(aa, aClassName, 255); // 得到控件类名<br> GetWindowText(aa, ComponetName, 255); // 得到控件标题<br> <br> // 根据标题判断是不是你要找的combobox<br> if (StrComp(aClassName, PChar('TCombobox')) = 0) and (aa <> 0) then<br> if (StrComp(ComponetName, PChar('Combobox1')) then<br> begin<br> Result := aa;<br>[blue] S := '插入的内容';<br> SendMessage(aa, CB_ADDSTRING, 0, Longint(PChar(S)));[/blue]<br> end;<br> end;<br><br>2、用FindWindow得到句柄<br> DestHwnd := FindWindow(......)<br>3、注册calback,等待回应,呵呵,到此就可以了!<br> function TForm1.Start();<br> begin<br> EnumChildWindows(DestHwnd, @CalBack, 0);<br> SetActiveWindow(DestHwnd);<br> end; <br>不知道讲明白了没,如果还有不明之处,看看DELPHI5开发人员指南,写得很清楚。