看看一下代码:<br>function CalBack(aa: Hwnd; bb: LPARAM): Boolean; stdcall;<br>var<br> aClassName, ComponetName: array[0..255] of Char;<br>begin<br> Result:=True;<br> GetClassName(aa, aClassName, 255); //依次得到子窗体所有控件类名<br> GetWindowText(aa, ComponetName, 255); //依次得到子窗体所有控件标题<br>// ShowMessage(aClassName);<br>// '(&S)保存MPEG文件'<br>// '(&L)装入VCD文件'<br>// '(&S)停止转换'<br>// '(&B)开始转换'<br> with FrmMain do<br> begin<br> if (StrComp(ComponetName, PChar('(&B)开始转换')) = 0) and (aa <> 0) then<br> hwndBtnStart := aa;<br> if (StrComp(aClassName, PChar('TEdit')) = 0) and (aa <> 0) then<br> begin<br> Inc(p_nEditNum);<br> case p_nEditNum of<br> 1: hwndEdtGetVcd := aa;<br> 2: hwndEdtSaveMpeg := aa;<br> end;<br> end;<br> if (StrComp(aClassName, PChar('TProgressBar')) = 0) and (aa <> 0) then<br> hwndPrgrsbr := aa;<br> end;<br>end;<br><br><br>// 以下是注册句柄<br> { find the exist game window }<br> HWndRuningApp := FindWindow(nil, PChar('VCD转换成为MPEG'));<br> if HWndRuningApp <> 0 then<br> begin<br> EnumChildWindows(HWndRuningApp, @CalBack, 0);<br> SetActiveWindow(HWndRuningApp);<br> btnFindMpeg.Enabled := True;<br> btnChoseSaveDir.Enabled := True;<br> btnVcd2Mpeg.Enabled := True;<br> end;<br>