Author: Tomas Rutkauskas
How to minimize and restore all open applications
Answer:
1 procedure MinimizeAll;
2 begin
3 { [Window key] + 'M' minimizes all windows, [Win][Shift] + 'M' restores them }
4 keybd_event(VK_LWIN, MapvirtualKey(VK_LWIN, 0), 0, 0);
5 keybd_event(Ord('M'), MapvirtualKey(Ord('M'), 0), 0, 0);
6 keybd_event(Ord('M'), MapvirtualKey(Ord('M'), 0), KEYEVENTF_KEYUP, 0);
7 keybd_event(VK_LWIN, MapvirtualKey(VK_LWIN, 0), KEYEVENTF_KEYUP, 0);
8 end;
9
10 procedure UnMinimizeAll;
11 begin
12 { [Window key] + 'M' minimizes all windows, [Win][Shift] + 'M' restores them }
13 keybd_event(VK_LWIN, MapvirtualKey(VK_LWIN, 0), 0, 0);
14 keybd_event(VK_SHIFT, MapvirtualKey(VK_SHIFT, 0), 0, 0);
15 keybd_event(Ord('M'), MapvirtualKey(Ord('M'), 0), 0, 0);
16 keybd_event(Ord('M'), MapvirtualKey(Ord('M'), 0), KEYEVENTF_KEYUP, 0);
17 keybd_event(VK_SHIFT, MapvirtualKey(VK_SHIFT, 0), KEYEVENTF_KEYUP, 0);
18 keybd_event(VK_LWIN, MapvirtualKey(VK_LWIN, 0), KEYEVENTF_KEYUP, 0);
19 end;
|