oncmnd.cpp


#include <windows.h>
#include <tchar.h>
#include "resource.h"
#include "openfnm.h"

extern HINSTANCE g_hInst;
extern CMyOpenFileName g_ofn;

// Prototype
BOOL CALLBACK About(HWND, UINT, WPARAM, LPARAM);

BOOL
OnCmnd(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
  WORD wNotify;
  WORD wId;
  wNotify = HIWORD(wParam);
  wId = LOWORD(wParam);
  
  if(wNotify != 0)
    return FALSE;
  	
  switch(wId)
  {
  case IDM_FILE_EXIT:
    DestroyWindow(hwnd);
    break;
  case IDM_FILE_OPEN:
    if(g_ofn.Prompt(g_hInst, hwnd))
    {
      InvalidateRect(hwnd, 0, TRUE);
      UpdateWindow(hwnd);
    }
    break;
  case IDM_VIEW_REDRAW:
    InvalidateRect(hwnd, 0, TRUE);
    UpdateWindow(hwnd);
    break;
  case IDM_HELP_VERSION:
    DialogBox(g_hInst,_T("MyVersion"),hwnd,(DLGPROC)About);
    break;
  default:
    return FALSE;
  }
  
  return TRUE;
}