wince 1.窗体不显示在任务栏 2.最小化窗体
2013-04-14 11:39
239 查看
//首先调用Win32 的申明:
using System.Runtime.InteropServices;
//1.窗体不显示在任务栏
const int EXSTYLE = -20;
const int WS_EX_NOANIMATION = 0x04000000;
[DllImport("coredll.dll", SetLastError=true)]
public static extern void SetWindowLong(IntPtr hWnd, int GetWindowLongParam, uint nValue);
[DllImport("coredll.dll", SetLastError=true)]
public static extern uint GetWindowLong(IntPtr hWnd, int nItem);
[DllImport("coredll.dll")]
private static extern IntPtr GetCapture();
void NotShowInTaskbar()
{
Capture = true;
IntPtr hwnd = GetCapture();
Capture = false;
uint style = GetWindowLong(hwnd, EXSTYLE);
style |= WS_EX_NOANIMATION;
SetWindowLong(hwnd, EXSTYLE, style);
}
//2.最小化窗体
[DllImport("coredll.dll")]
static extern int ShowWindow(IntPtr hWnd, int nCmdShow);
const int SW_MINIMIZED = 6;
void MiniMize()
{
ShowWindow(this.Handle, SW_MINIMIZED);
}
using System.Runtime.InteropServices;
//1.窗体不显示在任务栏
const int EXSTYLE = -20;
const int WS_EX_NOANIMATION = 0x04000000;
[DllImport("coredll.dll", SetLastError=true)]
public static extern void SetWindowLong(IntPtr hWnd, int GetWindowLongParam, uint nValue);
[DllImport("coredll.dll", SetLastError=true)]
public static extern uint GetWindowLong(IntPtr hWnd, int nItem);
[DllImport("coredll.dll")]
private static extern IntPtr GetCapture();
void NotShowInTaskbar()
{
Capture = true;
IntPtr hwnd = GetCapture();
Capture = false;
uint style = GetWindowLong(hwnd, EXSTYLE);
style |= WS_EX_NOANIMATION;
SetWindowLong(hwnd, EXSTYLE, style);
}
//2.最小化窗体
[DllImport("coredll.dll")]
static extern int ShowWindow(IntPtr hWnd, int nCmdShow);
const int SW_MINIMIZED = 6;
void MiniMize()
{
ShowWindow(this.Handle, SW_MINIMIZED);
}
相关文章推荐
- 子窗体在任务栏上显示且能最小化到任务栏
- 窗体最小化后在任务栏不显示
- WPF 程序点击任务栏图标显示隐藏最小化窗体
- 让窗体最小化到任务栏中,双击后显示回来
- C#点击窗体最小化时,隐藏任务栏和显示托盘图标
- c# 智能设备应用程序不显示在任务栏以及最小化窗体
- c# 智能设备应用程序不显示在任务栏以及最小化窗体
- c# 智能设备应用程序不显示在任务栏以及最小化窗体
- c# 智能设备应用程序不显示在任务栏以及最小化窗体
- c# 智能设备应用程序不显示在任务栏以及最小化窗体
- c# 智能设备应用程序不显示在任务栏以及最小化窗体
- swing 自定义最小化按钮后,实现点击任务栏图标,使窗体重新显示
- 主窗体最小化时不显示在任务栏
- c# 智能设备应用程序不显示在任务栏以及最小化窗体
- Windows7下相似窗体最小化在任务栏合并后显示TODO:<文件说明>的问题
- c# 智能设备应用程序不显示在任务栏以及最小化窗体
- C#使窗体无法改变大小只能最大化最小化显示的方法
- C# winform 开机自启动时最小化到托盘 单击显示窗体,右击显示菜单
- 窗口最小化,任务栏不显示图标的解决办法
- java Swing最小化到任务栏图标,单击显示