请教一下:用什么api函数可以获得一个MDI窗口的子窗口的handle,
请举个例子,最好把参数说明一下,谢谢

解决方案 »

  1.   

    procedure TMain_f.OpenModule(ModuleFormName: string);
    var
      iLoop: integer;
      iCount: integer;
      aHandle: THandle;
      aFormClass: TFormClass;
      aTempForm: TForm;
    begin
      iCount := 0;
      for iLoop := 0 to main_f.MDIChildCount-1 do
      begin
        if UpperCase(main_f.MDIChildren[iLoop].ClassName)=UpperCase(ModuleFormName) then
        begin
          inc(iCount);
          aHandle := main_f.MDIChildren[iLoop].Handle;
          SendMessage(aHandle,WM_SYSCOMMAND,SC_MAXIMIZE,0);//找到了
          Break;
        end;
      end;
      if iCount=0 then
      begin
        aFormClass := TFormClass(GetClass(ModuleFormName)); );//沒有找到
        if aFormClass<>nil then
        begin
          aTempForm := aFormClass.Create(Application);
          aTempForm.WindowState := wsMaximized;
        end;
      end;
    end;
    //
    OpenModule('TFormName');//打開MDI窗口