窗口置顶

转载请注明来源:https://www.cnblogs.com/hookjc/

< 新建一个VS2005 WinForm项目,在项目的.cs文件中加入以下代码:
1、引入命名空间:
using System.Runtime.InteropServices;
2、在窗口类中加入:
[DllImport("user32.dll")]
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hPos,
int x, int y, int cx, int cy, uint nflags);


3、在窗口的Load事件中加入:

置顶


IntPtr HWND_TOPMOST = new IntPtr(-1);
SetWindowPos(this.Handle, HWND_TOPMOST, 0, 0, 0, 0, 0x0001 | 0x0002);
 

取消置顶


IntPtr HWND_TOPMOST = new IntPtr(-2);
SetWindowPos(this.Handle, HWND_TOPMOST, 0, 0, 0, 0, 0x0001 | 0x0002);
if ($ != jQuery) { $ = jQuery.noConflict(); } var isLogined = false; var cb_blogId = 38104; var cb_entryId = 1956514; var cb_blogApp = "hyruur"; var cb_blogUserGuid = "4b3e420b-63cf-dd11-9e4d-001cf0cd104b"; var cb_entryCreatedDate = '2011/2/16 22:52:00';

来源:python脚本自动迁移

posted @ 2020-06-29 11:44  jiangcheng_15  阅读(143)  评论(0编辑  收藏  举报