C# 使用WIN32API设置外部程序窗口无边框


使用代码

 var wnd = win32.FindWindowA(null, "窗口标题");
 Int32 wndStyle = win32.GetWindowLong(wnd, win32.GWL_STYLE);
 wndStyle &= ~win32.WS_BORDER;
 wndStyle &= ~win32.WS_THICKFRAME;
 win32.SetWindowLong(wnd, win32.GWL_STYLE, wndStyle);

用到的常量

const int WS_THICKFRAME = 262144; 
const int WS_BORDER = 8388608;

引用的函数

[DllImport("user32.dll")]
public static extern IntPtr FindWindowA(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
public static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM