我现在得到一个窗口的handle,我自己有一个myform的窗口,怎么把myform的父窗口指定为句柄为hangle的窗口,
myform.parent:=???

解决方案 »

  1.   


    setparent(我现在得到一个窗口的handle);  你既然得到窗口HANDLE了 直接设置就是了
      

  2.   

    The SetParent function changes the parent window of the specified child window. HWND SetParent(    HWND hWndChild, // handle of window whose parent is changing
        HWND hWndNewParent  // handle of new parent window
       );
      

  3.   

    不过你是取得的窗口句柄么  比如  hwd:=findwindow("xxx",XXX)  
      

  4.   

    var
        h:THandle;
    begin
      h:=findwindow(nil,'XXXXX');
      if h <> 0 then
      begin
        with TForm2.Create(Owner) do
        begin
           ParentWindow:=h;
           show;
        end;
      end;
    end;
      

  5.   

    myform.parent和ParentWindow:=h;
    有什么区别吗?
      

  6.   

    myform.parent是Twinctontrol类型
    ParentWindow是句柄
      

  7.   

    句柄是LongWord型,不能直接附值给myform.parent
      

  8.   

    MyForm.Parent := FindControl(Handle);