我通过代码:
handle:= FindWindow(nil,PChar('PC应用程序'));
ShowWindow(handle, SW_SHOW);窗体显示出来后结果右上角的最小化、大化按钮不能使用了,求高手解决 谢谢delphi窗体句柄FindWindowShowWindow

解决方案 »

  1.   

    试下:ShowWindow(handle, SW_RESTORE)
      

  2.   

    下面是我在项目中常用的将窗口置前的函数,你试下:function BringWindowToTopEx(hWnd: HWND): Boolean;
    begin
      if IsIconic(hWnd) then
        ShowWindow(hWnd, SW_RESTORE);
      if GetForegroundWindow <> hWnd then
        SetForegroundWindow(hWnd);//enabled
        //BringWindowToTop(hWnd);//not enabled
        //ForceForegroundWindow(hWnd);//enabled
        {SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE);
        SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE);//enabled}
        //SwitchToThisWindow(hWnd, True);//enabled
      Result := GetForegroundWindow = hWnd;
    end;function BringWindowToTopMost(hWnd: HWND; bTopMost: Boolean): Boolean;
    begin
      if IsIconic(hWnd) then
        ShowWindow(hWnd, SW_RESTORE);
      if bTopMost then
        SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE)
      else
        SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE);
    end;function BringWindowToTopXY(hWnd: HWND; X, Y: Integer;
      hWndInsertAfter: HWND): Boolean;
    begin
      Result := BringWindowToTopEx(hWnd);
      Result := SetWindowPos(hWnd, hWndInsertAfter, X, Y, 0, 0, SWP_NOSIZE)
        and Result;
    end;