1 Star 0 Fork 89

wilesilly/ComponentOne_Winform

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Program.cs 2.24 KB
一键复制 编辑 原始数据 按行查看 历史
Grapecityandyli 提交于 2017-03-22 17:06 . update by andy on 2017.03.22
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 Explorer());
}
[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);
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/wilesilly/ComponentOne_Winform.git
git@gitee.com:wilesilly/ComponentOne_Winform.git
wilesilly
ComponentOne_Winform
ComponentOne_Winform
master

搜索帮助