Minimizing all open windows in C#

前端 未结 5 1700
南笙
南笙 2020-11-28 07:50

I saw this C++ code on a forum which minimizes all open windows

#define MIN_ALL        419
#define MIN_ALL_UNDO   416

int main(int argc, char* argv[])
{
            


        
5条回答
  •  无人及你
    2020-11-28 08:13

    A similar result can be achieved by sending these keyboard events to bring the Taskbar popup menu and send it the letter "M":

    public class DesktopHelper
    {
        [DllImport("user32.dll")]
        static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, int dwExtraInfo);
    
        /// 
        /// Shows the desktop.
        /// 
        public static void ShowDesktop()
        {
            keybd_event(0x5B, 0, 0, 0);
            keybd_event(0x4D, 0, 0, 0);
            keybd_event(0x5B, 0, 0x2, 0);
        }
    }
    

提交回复
热议问题