/* * MDIIsSysCommand - see if WM_COMMAND is really a WM_SYSCOMMAND */ int MDIIsSysCommand( HWND hwnd, WPI_MSG msg, WPI_PARAM1 wparam, WPI_PARAM2 lparam ) { #ifndef __OS2_PM__ HMENU sys_menu; hwnd = hwnd; msg = msg; if( childrenMaximized ) { if( LOWORD( wparam ) >= 0xF000 ) { _wpi_sendmessage( currentWindow, WM_SYSCOMMAND, wparam, lparam ); return( TRUE ); } else { sys_menu = GetSystemMenu( currentWindow, FALSE ); CheckForMessage( sys_menu, currentWindow, wparam, lparam ); } } #else hwnd = hwnd; msg = msg; wparam = wparam; lparam = lparam; #endif return( FALSE ); } /* MDIIsSysCommand */
/* * CheckForMessage - check for a WM_COMMAND message that needs to be * sent to the maximized window */ static bool CheckForMessage( HMENU menu, HWND currentWindow, WPI_PARAM1 wparam, WPI_PARAM2 lparam ) { int num; int i; UINT id; UINT flags; if( menu != NULL ) { num = (int)_wpi_getmenuitemcount( menu ); for( i = 0; i < num; i++ ) { flags = GetMenuState( menu, i, MF_BYPOSITION ); if( flags & MF_POPUP ) { if( CheckForMessage( GetSubMenu( menu, i ), currentWindow, wparam, lparam ) ) { return( TRUE ); } } else { id = GetMenuItemID( menu, i ); if( id == wparam ) { _wpi_sendmessage( currentWindow, WM_COMMAND, wparam, lparam ); return( TRUE ); } } } } return( FALSE ); } /* CheckForMessage */
// Signal Handler void MessageRecieved() { // Debug message fprintf(stdout, "A Message has been recieved. The queue id is: %d\n", msqid); //DeviceRegistrationMessage regMsg; //checkForDeviceRegMessage(®Msg); CommandMessage cmd; if(!CheckForMessage(&cmd, sizeof(cmd) - sizeof(cmd.msgType),MSG_CMD)) { if(cmd.command[0] == 0xE) Exit(); } }