delphi 常用的将窗口置前的函数
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;
delphi 常用的将窗口置前的函数的更多相关文章
- [Winform]只允许运行一个exe,如果已运行则将窗口置前
摘要 接着介绍项目中用到的一些方法,在winform中,打好包,有时并不允许运行多个客户端,要保证只有一个客户端运行.如果已经运行了,则弹出已运行的窗口,使其展示. 方法 判断是否有相同的进程 /// ...
- (C++)窗口置前SetForegroundWindow(pThis->hwndWindow);
一段代码主要是创建一个Window,然后将其置顶显示.奇怪的是这个功能有时候无效. pThis->bWindowDisplayed = SetForegroundWindow(pThis-> ...
- 解析Delphi 窗口置顶,及非主窗口置顶
方法一: procedure TForm1.Button2Click(Sender: TObject);begin Form2.Show; Application.NormalizeTopMosts; ...
- C# Windows程序窗口置前台的几种方法
这个是从别的地方看来的,放我这里 第一种:SetForegroundWindow,这个方法时灵时不灵.有人说,在自己的程序里把自己的窗口之前一般就不灵,而置前其它程序的窗口就灵.我觉得这是有原因的:当 ...
- Delphi 窗口置顶的方法
有几种窗口置顶的方法,简单的有: ShowWindow(窗口句柄,sw_ShowNormal); SetWindowPos(窗口句柄,HWND_NOTOPMOST,0,0,0,0,SWP_NOMOV ...
- Scrapy——5 下载中间件常用函数、scrapy怎么对接selenium、常用的Setting内置设置有哪些
Scrapy——5 下载中间件常用的函数 Scrapy怎样对接selenium 常用的setting内置设置 对接selenium实战 (Downloader Middleware)下载中间件常用函数 ...
- Delphi让所有的窗口的标题和图标显示在任务栏上
Delphi:让所有的窗口的标题和图标显示在任务栏上在Delphi中,除了主窗口之外,当其它的窗口显示或切换到焦点时.默认情况下,窗口标题和图标并不会显示在任务栏中,为了实现像主窗口一样,每当窗口显示 ...
- (转载)delphi 常用函数(数学)
delphi 常用函数(数学) Delphi中怎么将实数取整? floor 和 ceil 是 math unit 里的函数,使用前要先 Uses Math.trunc 和 round 是 system ...
- QT窗口置顶/真透明/背景模糊/非矩形/跳过任务栏分页器/无边框/无焦点点击/焦点穿透
qt 窗口置顶/真透明/背景模糊/非矩形/跳过任务栏分页器/无边框/无焦点点击/焦点穿透 窗口置顶qt 里是 setWindowFlags(Qt::WindowStaysOnTopHint)kde 里 ...
随机推荐
- java 构造方法
class MyTestClass { public int Value; public boolean equals(MyTestClass obj){ return obj.Value ==thi ...
- bzoj 2761: [JLOI2011]不重复数字
#include<cstdio> #include<iostream> #include<cstring> #include<algorithm> #d ...
- 二模 (15)day2
第一题:Alice和Bob两个人正在玩一个游戏,游戏有很多种任务,难度为p的任务(p是正整数),有1/2p 的概率完成并得到2p−1分,如果完成不了,得0分.一开始每人都是0分,从Alice开始轮流做 ...
- iOS8定位问题解决方案
原文 http://blog.csdn.net/nextstudio/article/details/40050095 1.修改info 新增Key: NSLocationAlwaysUsageDe ...
- sql中replace函数与like结合达到提换的效果
create table ts ( idd varchar() , co1 varchar() , co2 varchar() , co3 varchar() , gai varchar() ); i ...
- JavaScript基础--小案例:在网页指定位置弹出错误信息(十二)
案例分析:点击按钮后,在网页上指定区域,提示错误信息!5秒后,错误信息提示自动消失! <script languag="javascript" type="text ...
- poj1502 spfa最短路
//Accepted 320 KB 16 ms //有n个顶点,边权用A表示 //给出下三角矩阵,求从一号顶点出发到各点的最短路的最大值 #include <cstdio> #includ ...
- bsp STEP
Web开发不仅现在比较流行,将来也会.我来谈一下最近bsp application项目的体会吧,属初学者,请各位多多指教. SAP 的web开发方法有很多种,bsp只是其中一种,而bsp开发有可以分 ...
- 期望DP
BZOJ 1415 #include <iostream> #include <cstring> #include <algorithm> #include < ...
- Interproscan, xml文件转化为tsv
将interproscan的结果转化格式 很奇怪 tsv格式里没有go, kegg, inter-domain信息,但是xml文件里面却有,tsv文件比较好处理,所以先将xml文件转化为tsv.用软件 ...