打开word后怎样只能使用word本身退出 现在有个应用环境,需要在用户打开Word或Excel后,不能切换到其它界面,也就是说不能使用windows键或ALT+TAB键切换到等其它方式切换到其它界面,而且不能最小化,一直保持最大化的状态,直到用户使用word或excel本身的退出功能退出。不知道这样的程序用C#或VC++怎样实现,希望高手指教! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 想要控制的比较严格就HOOK做一般程度的骗过可以用C#实现。 置前[DllImport("User32.dll ", EntryPoint = "FindWindow")] private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImport("user32.dll")] public static extern IntPtr GetDC(IntPtr hWnd); [DllImport("user32.dll")] public static extern Int32 ReleaseDC(IntPtr hWnd, IntPtr hdc); [DllImport("gdi32.dll")] public static extern uint GetPixel(IntPtr hdc, int nXPos, int nYPos); [DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr hWnd); private void button1_Click(object sender, EventArgs e) { IntPtr hWnd = FindWindow(null, ""); IntPtr hdc = GetDC(hWnd); SetForegroundWindow(hWnd); } 求教学C#的朋友 dataGridView1_Paint修改显示字体颜色问题 没有将代码放在单独的文件中,怎么继承类呀? 制作代码编辑器中,征集代码字体样式!100分!!! dataGridView 复制row问题 C#学习网站 C#主程序里调用DLL文件,调用的DLL怎样使用主程序里的函数,及变量? 窗体的问题 大神来帮忙啊 效率问题!两个大文本比较(上万条记录)! 在线紧急求援! 从外部如何读取DataList表格中的核选框(每一行一个)值?先谢谢!!! 急用。。。 重复发问了!指针的用法 请教ocx可以和宿主程序进行二进制交互吗?谢谢
[DllImport("User32.dll ", EntryPoint = "FindWindow")]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImport("user32.dll")]
public static extern IntPtr GetDC(IntPtr hWnd); [DllImport("user32.dll")]
public static extern Int32 ReleaseDC(IntPtr hWnd, IntPtr hdc);
[DllImport("gdi32.dll")]
public static extern uint GetPixel(IntPtr hdc, int nXPos, int nYPos);
[DllImport("user32.dll")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
private void button1_Click(object sender, EventArgs e)
{
IntPtr hWnd = FindWindow(null, "");
IntPtr hdc = GetDC(hWnd);
SetForegroundWindow(hWnd); }