1 Star 0 Fork 87

星尘 / ComponentOne_Winform

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Program.cs 2.24 KB
一键复制 编辑 原始数据 按行查看 历史
GrapeCity 提交于 2014-07-21 10:50 . Init
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Configuration;
using System.Runtime.InteropServices;
namespace ControlExplorer
{
static class Program
{
internal static int WM_UpdateDemoStatus;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
WM_UpdateDemoStatus = RegisterWindowMessage("UpdateDemoStatus");
ChangeWindowMessageFilter(WM_UpdateDemoStatus, 1 /* MSGFLT_ADD */);
if (args.Length > 0)
{
int action;
if (!int.TryParse(args[0], out action))
{
return;
}
IntPtr hWnd = FindWindow(IntPtr.Zero, "Jump List Demo");
if (hWnd != IntPtr.Zero)
{
SetForegroundWindow(hWnd);
PostMessage(hWnd, WM_UpdateDemoStatus, new IntPtr(action), IntPtr.Zero);
return;
}
Win7Pack.JumpTaskDemo.Action = (Win7Pack.JumpTaskAction)action;
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
[DllImport("user32.dll", ExactSpelling = true)]
private static extern bool ChangeWindowMessageFilter(int message, int dwFlag);
[DllImport("user32.dll", EntryPoint = "FindWindowW", CharSet = CharSet.Unicode)]
private static extern IntPtr FindWindow(IntPtr lpClassName /* Dummy */,
[MarshalAs(UnmanagedType.LPWStr)] string lpWindowName);
[DllImport("user32.dll", EntryPoint = "PostMessageW", CharSet = CharSet.Unicode)]
internal static extern IntPtr PostMessage(IntPtr hWnd, int wMsg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", EntryPoint = "RegisterWindowMessageW", CharSet = CharSet.Unicode)]
private static extern int RegisterWindowMessage([MarshalAs(UnmanagedType.LPWStr)] string lpString);
[DllImport("user32.dll", ExactSpelling = true)]
internal static extern bool SetForegroundWindow(IntPtr hWnd);
}
}
1
https://gitee.com/xingchensoft/ComponentOne_Winform.git
git@gitee.com:xingchensoft/ComponentOne_Winform.git
xingchensoft
ComponentOne_Winform
ComponentOne_Winform
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891