Implementing the hotkey activation background process (Hunan Zhangbo Cloud) Write the current memory application (TSR) program under DOS, typically set the hotkey activation, DOS users are very familiar with this. In the Windows 9X environment, some time the front desk running program hides the WINDOWS taskbar, the user cannot switch, and many GAME programs are running. If you add a hotkey exhalation function in your background process, it will not be concerned. Program implementation Principle: First, the user predetermined a hotkey, whether the program is a front program or a background program, as long as the user presses this button, the program will change immediately as a front program. The hotkey message WM_HOTKEY is captured in the program and knows which button is pressed by message parameters. Because the message WM_HOTKEY is not encapsulated in the ClassWizard in the VC, we only have the mapping and processing of the message by programming (programming environment VC5, the project is the MFC AppWizard [EXE] type, the project name of this example: eXample). The specific implementation steps are as follows: 1. Declaring Hot Key Message Processing Function Prototype Added in CexampleView.h (after AFX_MSG font) Adds statements: LRESULT Onhotkey (WPARAM WPARAM, LPARAM LPARAM); 2. The message is associated with the corresponding processing function to add message mapping macro in CexampleView.cpp, making the message and the corresponding processing function relationship, ON_MESSAGE (WM_HOTKEY, INHOTKEY); 3. To make it easy for future operations to create a function on the CEXAMPLVIEW class in the CEXAMPLView class, the ONCREATE () with the onDestroy () (easy to implement using ClassWizard, refer to books about VC, here no further details). 4. The following code is added to the system () function to register the hotkey to the system () function, and the hotkey of this example is set to Ctrl Shift a. RegisterhotKey (M_HWND, 1001, MOD_CONTROL | MOD_SHIFT, 'A'); RegisterhotKey (M_HWND, 1002 , MOD_CONTROL | MOD_SHIFT, 'A'); 5. The processing hotkey is handled in the message processing function on the message processing function on the message processing function, and can join the program code that the user wants to run, etc .: LRESULT CEXAMPLEVIEW :: OnhotKey (WPARAM WPARAM, LPARAM LPARAM) IF (WPARAM == 1001 || WPARAM = = 1002) CWnd :: setForegroundWindow (); // The activated window appears in the foreground MessageBox ("Hello, How do you do!"); // The user can add code RETURN 0; 6. After the program is running, the hotkey is released in OnDestroy () releases the hotkey registration, release system resources. UnregisterhotKey (M_HWND, 1001); UnregisterhotKey (M_HWND, 1002); 7. After compiling and running the program running the program, whenever you press the hotkey Ctrl Shift A, the program immediately becomes the front run program and appears on Desktop.