/**************************************** WinTreeMenuCommands.cpp == Windows Last Left Threaded Data Tree Menu Commands This function is called from switch(message) WM_COMMAND : Menu command have lParam = 0. This was done to simplify WinProc. Use: LRESULT SendMessage( HWND hWnd, // handle of destination window UINT Msg, // message to send WPARAM wParam, // first message parameter LPARAM lParam // second message parameter ); To send the instruction back to WinProc. ****************************************/ #include "WinTree.h" // WinTree1.h is 'ifndef' so wont be multipled defind void WinTreeCommand(HWND hwnd, HINSTANCE hInstance, WPARAM wParam, LPARAM lParam, bool& fDoesTreeExist) { HMENU hMenu = GetMenu(hwnd); int i = LOWORD(wParam) ; switch(LOWORD(wParam)) { case ID_FILE_EXIT: SendMessage (hwnd, WM_DESTROY, 0, 0 ) ; break ; case ID_EDIT_EDITNODE: // You use cast for some reason, to (DLGPROC), this was from Jervis. //lpDialogFunc Points to the dialog box procedure. For more information // about the dialog box procedure, see the DialogProc callback function. // See also Dialog Boxes. Avoiding Global Variables. 510.// pad = (ABOUTBOX_DATA *) lParam ; DialogBox (hInstance, TEXT("IDD_EDIT_NODE"), hwnd, (DLGPROC) EditDlgProc) ; SendMessage (hwnd, WM_KEYDOWN, 0, 0 ) ; break ; case ID_VIEW_DISPLAYTREEINFO: SendMessage (hwnd, WM_KEYDOWN, VK_SPACE, 0 ) ; break ; case ID_REMOVENODE_REMOVEL: SendMessage (hwnd, WM_KEYDOWN, VK_LEFT, 0 ) ; break ; case ID_REMOVENODE_REMOVEMOSTSIGNIFICANTNODE: SendMessage (hwnd, WM_KEYDOWN, VK_RIGHT , 0 ) ; break ; case ID_REMOVENODE_REMOVETREEROOT: SendMessage (hwnd, WM_KEYDOWN, VK_UP, 0 ) ; break ; case ID_REMOVENODE_REMOVEMEDIANNODE: SendMessage (hwnd, WM_KEYDOWN, VK_DOWN , 0 ) ; break ; case ID_HELP_A: // You use cast for some reason, to (DLGPROC), this was from Jervis. //lpDialogFunc Points to the dialog box procedure. For more information // about the dialog box procedure, see the DialogProc callback function. // See also Dialog Boxes. Avoiding Global Variables. 510.// pad = (ABOUTBOX_DATA *) lParam ; DialogBox (hInstance, TEXT("WINTREE2_0_3_0"), hwnd, (DLGPROC) AboutDlgProc) ; break ; } // End "switch" if( !(fDoesTreeExist) ) { EnableMenuItem(hMenu, ID_VIEW_DISPLAYTREEINFO, MF_GRAYED); EnableMenuItem(hMenu, ID_REMOVENODE_REMOVEL, MF_GRAYED); EnableMenuItem(hMenu, ID_REMOVENODE_REMOVEMOSTSIGNIFICANTNODE, MF_GRAYED); EnableMenuItem(hMenu, ID_REMOVENODE_REMOVETREEROOT, MF_GRAYED); EnableMenuItem(hMenu, ID_REMOVENODE_REMOVEMEDIANNODE, MF_GRAYED); EnableMenuItem(hMenu, ID_EDIT_EDITNODE, MF_GRAYED); } // End of 'if' on "fDoesTreeExist" } // End "WinTreeCommand"