When the user minimizes the window (either using the field in the title bar or selecting "Minimize" in the system menu), your application will receive WM_SYSCOMMAND . The wParam parameter of this message will contain an SC_MINIMIZE value that indicates the specific type of system command requested. In this case, you do not care about lParam .
So, you need to configure a message card that listens for the WM_SYSCOMMAND with wParam set to SC_MINIMIZE . After receiving such a message, you must execute your code to minimize your application in the notification area of โโthe taskbar, and return 0 (indicating that you have processed the message).
I am not sure which GUI you are using. Sample code can potentially be very different for different toolkits. Here is what you can use in a direct Win32 C application:
switch (message) { case WM_SYSCOMMAND: if ((wParam & 0xFFF0) == SC_MINIMIZE) {
source share