delphi查找窗体句柄,显示窗体问题

changpingcao 2013-03-06 09:47:38
我通过代码:
handle:= FindWindow(nil,PChar('PC应用程序'));
ShowWindow(handle, SW_SHOW);

窗体显示出来后结果右上角的最小化、大化按钮不能使用了,求高手解决 谢谢
...全文
287 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
changpingcao 2013-03-06
  • 打赏
  • 举报
回复
引用 2 楼 warrially 的回复:
Delphi/Pascal code?1SetWindowLong()
这个要怎么使用?在哪里用? 麻烦指导下,谢谢
changpingcao 2013-03-06
  • 打赏
  • 举报
回复
引用 1 楼 feiba7288 的回复:
试下:ShowWindow(handle, SW_RESTORE)
窗体无法弹出了
爱蹄子的羊头 2013-03-06
  • 打赏
  • 举报
回复

SetWindowLong() 
feiba7288 2013-03-06
  • 打赏
  • 举报
回复
试下:ShowWindow(handle, SW_RESTORE)
feiba7288 2013-03-06
  • 打赏
  • 举报
回复
下面是我在项目中常用的将窗口置前的函数,你试下:
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;

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧