zoukankan      html  css  js  c++  java
  • 窗体前置

    下面是我在项目中常用的将窗口置前的函数,你试下:

    Delphi/Pascal code
    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;

  • 相关阅读:
    inndo 表与存储逻辑_1
    msyql master thread
    redo log重做日志缓冲
    redo log 重做日志
    Latex 写算法伪代码
    Just for test
    ASP.NET Web API 2 OData v4教程
    MVC系统过滤器 OutputCacheAttribute
    MVC系统过滤器、自定义过滤器
    .NET如何从配置文件中获取连接字符串
  • 原文地址:https://www.cnblogs.com/blogpro/p/11446833.html
Copyright © 2011-2022 走看看