本文介绍了C#获取全局键盘笔划?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! Hello Everyone again! 当我按下一个键组合(如CTRL + E或其他东西)时,我有一个想法可以最小化或关闭我的应用程序。现在我知道如何最小化和关闭应用程序,我可以使用使用DestroyWindow方法的win api或CloseWindow(这是为了最小化应用程序)方法这样做 i也希望能够按CTRl + B或某种键组合并将应用程序带到窗口堆栈的前面(或窗口链或其他任何调用)我可以通过调用windows api中的BringWindowToTop方法来实现这一点 我不知道怎么办是当我全局按下键盘组合时如何告诉我的应用程序执行这些功能,或者我应该说当我的应用程序有焦点时。 i有一个感觉我将指的是这个工作的win api和User32.dll方法列表吗?(Gosh我讨厌使用P / Invoke,它使用无人C ++这么复杂) 对于函数我想做(比如最小化窗口并将其带到前面)我导入了以下方法:Hello Everyone again!i had an idea to minimize or close my app when i press a key combo(like CTRL+E or something). Now i know how to minimize and close the app, i can do that either using the win api using the DestroyWindow method or the CloseWindow(this is to minimize the app) methodi also want to be able to press CTRl+B or some sort of key combo and bring the app to the front of the window stack(or window chain or whatever its called) i can do this by calling the BringWindowToTop method in the windows apiwhat i don't know how to do is how do i tell my app to execute those functions when a keyboard combo is pressed globally, or i should say when my app has focus or not.i have a felling i will be referring to the win api and the User32.dll method list for this job right?(Gosh i hate using P/Invoke, its so complicated to use unmanned C++)For the functions i want to do(like minimizing the window and bringing it to the front) i have imported the following methods:[DllImport("user32.dll")]using System.Runtime.InteropServices;public static extern void DestroyWindow(IntPtr hWnd);[DllImport("user32.dll")]public static extern void CloseWindow(IntPtr hWnd);[DllImport("user32.dll")]public static extern void BringWindowToTop(IntPtr hWnd); 感谢所有人提前帮助, MasterCodeonthanks for all of your help in advance,MasterCodeon推荐答案 这篇关于C#获取全局键盘笔划?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-07 06:10