bool iWidget::ProcessMessage(eGuiMessage a_Message, cGuiMessageData &a_Data) { if (IsEnabled()==false) return false; a_Data.m_Message = a_Message; bool bRet = false; bRet = OnMessage(a_Message, a_Data); if (bRet==false) { switch(a_Message) { case eGuiMessage_MouseMove: bRet = OnMouseMove(a_Data);break; case eGuiMessage_MouseDown: bRet = OnMouseDown(a_Data);break; case eGuiMessage_MouseUp: bRet = OnMouseUp(a_Data);break; case eGuiMessage_MouseDoubleClick: bRet = OnMouseDoubleClick(a_Data);break; case eGuiMessage_MouseEnter: bRet = OnMouseEnter(a_Data);break; case eGuiMessage_MouseLeave: bRet = OnMouseLeave(a_Data);break; case eGuiMessage_GotFocus: bRet = OnGotFocus(a_Data);break; case eGuiMessage_LostFocus: bRet = OnLostFocus(a_Data);break; case eGuiMessage_KeyPress: bRet = OnKeyPress(a_Data);break; } } if (ProcessCallbacks(a_Message, a_Data)) bRet = true; return bRet; }
bool iWidget::ProcessMessage(eGuiMessage aMessage, cGuiMessageData &aData) { if(IsEnabled()==false) return false; aData.mMessage = aMessage; bool bRet = false; bRet = OnMessage(aMessage,aData); //This can override any message. ///////////////////////////////////////// //Call the correct virtual function if(bRet==false) { switch(aMessage) { case eGuiMessage_MouseMove: bRet = OnMouseMove(aData); break; case eGuiMessage_MouseDown: bRet = OnMouseDown(aData); break; case eGuiMessage_MouseUp: bRet = OnMouseUp(aData); break; case eGuiMessage_MouseDoubleClick: bRet = OnMouseDoubleClick(aData); break; case eGuiMessage_MouseEnter: bRet = OnMouseEnter(aData); break; case eGuiMessage_MouseLeave: bRet = OnMouseLeave(aData); break; case eGuiMessage_KeyPress: bRet = OnKeyPress(aData); break; case eGuiMessage_GotFocus: bRet = OnGotFocus(aData); break; case eGuiMessage_LostFocus: bRet = OnLostFocus(aData); break; } } ///////////////////////////////////////// //Process user callbacks for the event. if(ProcessCallbacks(aMessage,aData)) bRet = true; return bRet; }
void EventHandle::ParseInput() // Decides which keys have been pressed/released and which need to be repeated { if (m_vKeys.size() < m_vPrevKeys.size()) { for (int i = m_vKeys.size(); i < m_vPrevKeys.size(); ++i) OnKeyRelease(m_vPrevKeys[i]); } for (int i = 0; i < m_vKeys.size(); ++i) { if ((i >= m_vPrevKeys.size()) || (m_vKeys[i] != m_vPrevKeys[i])) { if (i >= m_vPrevKeys.size()) { m_vUntilPressed.push_back(clock() + KEY_PRESS_DELAY); m_vUntilRepeat.push_back(clock() + KEY_PRESS_DELAY + KEY_REPEAT_PRESS_DELAY); } OnKeyPress(m_vKeys[i]); } else if ((m_vKeys[i] == m_vPrevKeys[i]) && (clock() > m_vUntilRepeat[i]) && (clock() > m_vUntilPressed[i])) { m_vUntilRepeat[i] = clock() + KEY_REPEAT_PRESS_DELAY; OnKeyRepeat(m_vKeys[i]); } } m_vPrevKeys = m_vKeys; m_vKeys.clear(); }
LRESULT CNSDateEdit::OnRelayEvent(WPARAM wParam, LPARAM lParam) { LPMSG pMsg = (LPMSG) lParam; if (pMsg->message == WM_KEYDOWN) { return (LRESULT) OnKeyPress( (UINT) pMsg->wParam, (UINT) LOWORD(pMsg->lParam), (UINT) HIWORD(pMsg->lParam)); } return (LRESULT) FALSE; }
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_CREATE: return OnCreateWindow(hwnd); case WM_COMMAND: switch (LOWORD(wParam)) { case IDM_EXIT: DestroyWindow(hwnd); break; case ID_FILE_OPENFILE: OnFileOpen(hwnd); break; case ID_FILE_OPENURL: OnOpenURL(hwnd); break; default: return DefWindowProc(hwnd, message, wParam, lParam); } break; case WM_PAINT: OnPaint(hwnd); break; case WM_SIZE: OnResize(LOWORD(lParam), HIWORD(lParam)); break; case WM_ERASEBKGND: // Suppress window erasing, to reduce flickering while the video is playing. return 1; case WM_DESTROY: PostQuitMessage(0); break; case WM_CHAR: OnKeyPress(wParam); break; case WM_APP_PLAYER_EVENT: OnPlayerEvent(hwnd, wParam); break; default: return DefWindowProc(hwnd, message, wParam, lParam); } return 0; }
BOOL CMapToolView::PreTranslateMessage(MSG* pMsg) { // TODO: 여기에 특수화된 코드를 추가 및/또는 기본 클래스를 호출합니다. switch (pMsg->message) { case WM_KEYDOWN: if( LOWORD(pMsg->lParam) == 1 ) OnKeyPress(LOWORD(pMsg->wParam)); break; case WM_KEYUP: OnKeyRelease(LOWORD(pMsg->wParam)); break; case WM_LBUTTONDOWN: OnMouseClick(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 0, LOWORD(pMsg->wParam)); break; case WM_RBUTTONDOWN: OnMouseClick(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 1, LOWORD(pMsg->wParam)); break; case WM_MBUTTONDOWN: OnMouseClick(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 2, LOWORD(pMsg->wParam)); break; case WM_LBUTTONUP: OnMouseRelease(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 0, LOWORD(pMsg->wParam)); break; case WM_RBUTTONUP: OnMouseRelease(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 1, LOWORD(pMsg->wParam)); break; case WM_MBUTTONUP: OnMouseRelease(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 2, LOWORD(pMsg->wParam)); break; case WM_LBUTTONDBLCLK: OnMouseDoubleClick(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 0, LOWORD(pMsg->wParam)); break; case WM_RBUTTONDBLCLK: OnMouseDoubleClick(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 1, LOWORD(pMsg->wParam)); break; case WM_MBUTTONDBLCLK: OnMouseDoubleClick(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), 2, LOWORD(pMsg->wParam)); break; case WM_MOUSEMOVE: OnMouseMove(LOWORD(pMsg->lParam), HIWORD(pMsg->lParam)); break; case WM_MOUSEWHEEL: OnMouseWheel((short)HIWORD(pMsg->wParam), LOWORD(pMsg->wParam)); break; } return CView::PreTranslateMessage(pMsg); }
void UIBase::Input(){ int key = InputManager::GetInstance().GetMouseMousePressKey(); Point mpos = InputManager::GetInstance().GetMouse(); if (IsInside(mpos.x,mpos.y)){ if (key != 0 && OnMousePress){ OnMousePress(this,key,mpos); } key = InputManager::GetInstance().GetMouseMouseReleaseKey(); if (key != 0 && OnMouseRelease){ OnMouseRelease(this,key,mpos); } if (!MouseInside){ if (OnMouseEnter){ OnMouseEnter(this,mpos); } MouseInside = true; } }else{ if (MouseInside){ if (OnMouseLeave){ OnMouseLeave(this,mpos); } MouseInside = false; } } key = InputManager::GetInstance().IsAnyKeyPressed(); if (key != -1 && OnKeyPress){ OnKeyPress(this,key); } /*for (unsigned i = 0; i < Components.size(); ++i) { if (!Components[i]->IsDead()){ Components[i]->Input(); } }*/ }
static void MsgLoop(Display* dpy, Window win, GC gc, XFontStruct* font) { int running = 1; XEvent evt; Atom wm_quit = XInternAtom(dpy, "WM_DELETE_WINDOW", False); XSelectInput(dpy, win, ExposureMask | KeyPressMask | ButtonPressMask | StructureNotifyMask | PointerMotionMask); XSetWMProtocols(dpy, win, &wm_quit, 1); while(running) { XNextEvent(dpy, &evt); switch(evt.type) { case Expose: if(evt.xexpose.count) break; OnExpose(&evt.xexpose, gc, font); break; // case ConfigureNotify: // Resize(wnd, evt.xconfigure.width, evt.xconfigure.height); // break; case KeyPress: OnKeyPress(&evt.xkey); break; case ButtonPress: OnButtonPress(&evt.xbutton); break; case MotionNotify: OnMotionNotify(&evt.xmotion); break; case ClientMessage: if(evt.xclient.data.l[0] != wm_quit) continue; running = 0; break; } } //Stop receiving events XSelectInput(dpy, win, NoEventMask); }
void Widget::HandleEvent( const sf::Event& event ) { if( !IsVisible() ) { return; } // Set widget active in context. Context::Get().SetActiveWidget( shared_from_this() ); Container::Ptr parent( m_parent.lock() ); switch( event.Type ) { case sf::Event::MouseMoved: // Check if pointer inside of widget's allocation. if( GetAllocation().Contains( static_cast<float>( event.MouseMove.X ), static_cast<float>( event.MouseMove.Y ) ) ) { // Check for enter event. if( m_mouse_in == false ) { m_mouse_in = true; OnMouseEnter(); HandleMouseEnter( event.MouseMove.X, event.MouseMove.Y ); } OnMouseMove(); } else if( m_mouse_in == true ) { // Check for leave event. m_mouse_in = false; OnMouseLeave(); HandleMouseLeave( event.MouseMove.X, event.MouseMove.Y ); } HandleMouseMoveEvent( event.MouseMove.X, event.MouseMove.Y ); break; case sf::Event::MouseButtonPressed: // If a mouse button has already been pressed for this widget, drop further // presses. This maybe needs changing, but up to now, I can't think of any // cases where it would be useful to have such a functionality. if( m_mouse_button_down == -1 ) { if( m_mouse_in ) { m_mouse_button_down = event.MouseButton.Button; HandleMouseButtonEvent( event.MouseButton.Button, true, event.MouseButton.X, event.MouseButton.Y ); OnMouseButtonPress(); } } break; case sf::Event::MouseButtonReleased: // Only process when mouse button has been clicked inside the widget before. if( m_mouse_button_down == event.MouseButton.Button ) { m_mouse_button_down = -1; // When released inside the widget, the event can be considered a click. if( m_mouse_in ) { HandleMouseClick( event.MouseButton.Button, event.MouseButton.X, event.MouseButton.Y ); } OnMouseButtonRelease(); } HandleMouseButtonEvent( event.MouseButton.Button, false, event.MouseButton.X, event.MouseButton.Y ); break; case sf::Event::KeyPressed: if( GetState() == Active ) { // TODO: Delegate event too when widget's not active? HandleKeyEvent( event.Key.Code, true ); OnKeyPress(); } break; case sf::Event::KeyReleased: if( GetState() == Active ) { // TODO: Delegate event too when widget's not active? HandleKeyEvent( event.Key.Code, false ); OnKeyRelease(); } break; case sf::Event::TextEntered: if( GetState() == Active ) { // TODO: Delegate event too when widget's not active? HandleTextEvent( event.Text.Unicode ); OnText(); } break; default: break; } }
bool OnKeyUp(const CEGUI::EventArgs &eventArgs) { const CEGUI::KeyEventArgs eArgs = static_cast<const CEGUI::KeyEventArgs&>(eventArgs); return OnKeyPress(eArgs, "up"); }
LRESULT D3D11App::ProcessMessage(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { PAINTSTRUCT ps; HDC hdc; switch (message) { case WM_PAINT: hdc = BeginPaint(hwnd, &ps); EndPaint(hwnd, &ps); break; case WM_MOUSEMOVE: OnMouseMove(hwnd, GETX(lParam), GETY(lParam), (wParam & MK_LBUTTON) != 0, (wParam & MK_MBUTTON) != 0, (wParam & MK_RBUTTON) != 0); break; case WM_KEYDOWN: if (wParam == VK_ESCAPE) { if (m_mouseCapture) { // Release mouse capture on escape if there is one ... CaptureMouse(false); } else { // ... otherwise exit the application PostMessage(hwnd, WM_CLOSE, 0, 0); } } else { OnKeyPress(hwnd, (unsigned int) wParam, true); } break; case WM_KEYUP: OnKeyPress(hwnd, (unsigned int) wParam, false); break; case WM_SYSKEYDOWN: // Toggle fullscreen on Alt-Enter if ((lParam & (1 << 29)) && wParam == VK_RETURN) { m_context->ToggleFullscreen(); } break; case WM_LBUTTONDOWN: OnMouseClick(hwnd, GETX(lParam), GETY(lParam), MOUSE_LEFT, true); break; case WM_LBUTTONUP: OnMouseClick(hwnd, GETX(lParam), GETY(lParam), MOUSE_LEFT, false); break; case WM_RBUTTONDOWN: OnMouseClick(hwnd, GETX(lParam), GETY(lParam), MOUSE_RIGHT, true); break; case WM_RBUTTONUP: OnMouseClick(hwnd, GETX(lParam), GETY(lParam), MOUSE_RIGHT, false); break; case WM_MBUTTONDOWN: OnMouseClick(hwnd, GETX(lParam), GETY(lParam), MOUSE_MIDDLE, true); break; case WM_MBUTTONUP: OnMouseClick(hwnd, GETX(lParam), GETY(lParam), MOUSE_MIDDLE, false); break; case WM_WINDOWPOSCHANGED: WINDOWPOS *p; p = (WINDOWPOS *) lParam; // Ignore events with SWP_NOSENDCHANGING flag if (p->flags & SWP_NOSENDCHANGING) break; if ((p->flags & SWP_NOMOVE) == 0) { OnPosition(hwnd, p->x, p->y); } if ((p->flags & SWP_NOSIZE) == 0) { RECT rect; GetClientRect(hwnd, &rect); OnSize(hwnd, rect.right - rect.left, rect.bottom - rect.top); } break; case WM_CREATE: ShowWindow(hwnd, SW_SHOW); break; case WM_CLOSE: DestroyWindow(hwnd); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hwnd, message, wParam, lParam); } return 0; }
int XWindow::RunModal() { Prepare(); // Trap XWindows "WM_DELETE_WINDOW" message Atom wmDeleteMessage = XInternAtom(windowDisplay, "WM_DELETE_WINDOW", false); XSetWMProtocols(windowDisplay, window, &wmDeleteMessage, 1); XkbEvent event; do { // Gets the new event int res = XNextEvent(windowDisplay, &event.core); if (window != event.core.xany.window) continue; // Processes the events if (event.type == ButtonPress) { WindowEventMouseButton e(&event.core.xbutton); OnMouseDown(&e); } else if (event.type == ButtonRelease) { WindowEventMouseButton e(&event.core.xbutton); OnMouseUp(&e); } else if (event.type == MotionNotify) { WindowEventMouseMove e(&event.core.xmotion); OnMouseMove(&e); } else if (event.type == EnterNotify) { WindowEventEnterLeave e(&event.core.xcrossing); OnMouseEnterLeave(&e); } else if (event.type == LeaveNotify) { WindowEventEnterLeave e(&event.core.xcrossing); OnMouseEnterLeave(&e); } else if (event.type == FocusIn) { WindowEventFocus e(&event.core.xfocus); OnFocus(&e); } else if (event.type == FocusOut) { WindowEventFocus e(&event.core.xfocus); OnFocus(&e); } else if (event.type == Expose && event.core.xexpose.count == 0) { WindowEventDraw e(gc, &event.core.xexpose); OnDraw(&e); } else if (event.type == VisibilityNotify) { WindowEventVisible e(&event.core.xvisibility); OnVisible(&e); } else if (event.type == UnmapNotify) { WindowEventShow e(false); OnShow(&e); } else if (event.type == MapNotify) { WindowEventShow e(true); OnShow(&e); } else if (event.type == ConfigureNotify) { bool generateWindowMoveEvent = area->GetX() != event.core.xconfigure.x || area->GetY() != event.core.xconfigure.y; bool generateWindowResizeEvent = area->GetWidth() != event.core.xconfigure.width || area->GetHeight() != event.core.xconfigure.height; *area = NRectangle( event.core.xconfigure.x, event.core.xconfigure.y, event.core.xconfigure.width, event.core.xconfigure.height); borderwidth = event.core.xconfigure.border_width; if (generateWindowMoveEvent) { WindowEventMove e(&event.core.xconfigure); OnMove(&e); } if (generateWindowResizeEvent) { gc->Resize(area->GetWidth(), area->GetHeight()); // Resize XWindowGraphics WindowEventResize e(&event.core.xconfigure); OnResize(&e); } } else if (event.type == ColormapNotify) { WindowEventColormap e(&event.core.xcolormap); OnColormap(&e); } else if (event.type == KeyPress) { WindowEventKey e(&event.core.xkey); OnKeyPress(&e); } else if (event.type == KeyRelease) { WindowEventKey e(&event.core.xkey); OnKeyRelease(&e); } else if (event.type == XDisplay::Default().XkbBaseEvent() + XkbEventCode) { // XkbEvents if (event.any.xkb_type == XkbMapNotify) { WindowEventKeymap e(&event.map); OnKeymap(&e); } else if (event.any.xkb_type == XkbNewKeyboardNotify) { WindowEventKeyboardMapping e(&event.new_kbd); OnKeyboardMapping(&e); } else if (event.any.xkb_type == XkbStateNotifyMask) { int kk = 1; } } else if (event.type == ClientMessage) { if (event.core.xclient.data.l[0] == wmDeleteMessage) break; } else if (event.type != 28 && event.type != 21) { int kk = 1; } // Locks the collection of delegations windowMutex->Lock(); for (int i=0; i<delegationsToExecute->Count(); i++) { // Retrieve delegation and parameters void **item = (void **)(*delegationsToExecute)[i]; NDelegation *d = (NDelegation *)item[0]; void *params = item[1]; // Execute delegation try { d->Execute(params); } catch (Exception *e) { delete e; } // Deletes delegation and item array delete d; delete item; } // Clear delegations collection and unlocks the mutex delegationsToExecute->Clear(); windowMutex->Unlock(); } while (true); Dispose(); }
void Application::Run() { // // keyboard // if (keyboard_needs_poll()) poll_keyboard(); for (int k = 0; k < 256; k++) { if (key[k]) { OnKeyPress(k); if (!prevKeyState[k]) OnKeyPressed(k); } else if (!key[k]) { if (prevKeyState[k]) OnKeyReleased(k); } } memcpy(prevKeyState,(char*)key,256); // // mouse // if (mouse_needs_poll()) poll_mouse(); for (int button = 0; button < (numMouseButtons); button++) { if ((mouse_b & (1 << button)) != 0) { mouseButtons[button] = true; } else { mouseButtons[button] = false; } if (mouseButtons[button] && (!prevMouseButtons[button])) { OnMousePressed(button, mouse_x, mouse_y); mousePressedLocs[button].x = mouse_x; mousePressedLocs[button].y = mouse_y; } else if ((!mouseButtons[button]) && prevMouseButtons[button]) { OnMouseReleased(button, mouse_x, mouse_y); if ((mousePressedLocs[button].x == mouse_x) && (mousePressedLocs[button].y == mouse_y)) { OnMouseClick(button,mouse_x,mouse_y); } } } memcpy(prevMouseButtons,mouseButtons,sizeof(bool)*(numMouseButtons+1)); if ((mouse_x != prevMouseX) || (mouse_y != prevMouseY)) { OnMouseMove(mouse_x,mouse_y); prevMouseX = mouse_x; prevMouseY = mouse_y; } // mouse wheel if (mouse_z > prevMouseZ) { OnMouseWheelUp( mouse_x, mouse_y ); prevMouseZ = mouse_z; } else if (mouse_z < prevMouseZ) { OnMouseWheelDown( mouse_x, mouse_y ); prevMouseZ = mouse_z; } // // run the game // show_mouse(NULL); RunGame(); show_mouse(canvas); // // render canvas to the screen // blit(canvas,screen,0,0,0,0,screen->w,screen->h); // // sound polling (to ensure sounds currently playing will keep playing) // SoundOGG::PollSounds(); // // handle timing // HandleTiming(); }
INT_PTR GenericWindow::HandleDialogMessage (UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_MOUSEMOVE: if (!m_flagMouseTracking) { // register for mouse out message (TME_LEAVE) TRACKMOUSEEVENT trackMouseEvent; trackMouseEvent.cbSize = sizeof (trackMouseEvent); trackMouseEvent.dwFlags = TME_LEAVE; trackMouseEvent.dwHoverTime = 0; trackMouseEvent.hwndTrack = GetHandle (); m_flagMouseTracking = ::TrackMouseEvent (&trackMouseEvent); } OnMouseMove (0, 0, LOWORD(lParam), HIWORD(lParam)); break; case WM_MOUSELEAVE: OnMouseLeave (); m_flagMouseTracking = FALSE; break; case WM_LBUTTONDOWN: OnMouseDown (0, 0, LOWORD(lParam), HIWORD(lParam)); break; case WM_LBUTTONUP: OnMouseUp (0, 0, LOWORD(lParam), HIWORD(lParam)); break; case WM_RBUTTONDOWN: OnMouseDown (0, 0, LOWORD(lParam), HIWORD(lParam)); break; case WM_RBUTTONUP: OnMouseUp (0, 0, LOWORD(lParam), HIWORD(lParam)); OnContextMenu ( ); break; case WM_CHAR: OnKeyPress ( (int)wParam, LOWORD(lParam) ); break; case WM_KEYDOWN: OnKeyDown ( (int)wParam ); break; case WM_NCDESTROY: OnPreDestroy (); m_hWnd = NULL; break; case WM_DESTROY: OnDestroy (); break; case WM_SIZE: { int cx, cy; cx = LOWORD(lParam); cy = HIWORD(lParam); OnResize (cx, cy); } break; case WM_SETFOCUS: OnGotFocus (); break; case WM_KILLFOCUS: OnLostFocus (); break; case WM_COMMAND: OnCommand ( LOWORD(wParam) ); break; case WM_CONTEXTMENU: OnContextMenu ( ); break; default: return FALSE; } return TRUE; }
LRESULT GenericWindow::HandleMessage (UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_MOUSEMOVE: if (!m_flagMouseTracking) { // register for mouse out message (TME_LEAVE) TRACKMOUSEEVENT trackMouseEvent; trackMouseEvent.cbSize = sizeof (trackMouseEvent); trackMouseEvent.dwFlags = TME_LEAVE; trackMouseEvent.dwHoverTime = 0; trackMouseEvent.hwndTrack = GetHandle (); m_flagMouseTracking = ::TrackMouseEvent (&trackMouseEvent); } OnMouseMove (0, -1, LOWORD(lParam), HIWORD(lParam)); break; case WM_MOUSELEAVE: OnMouseLeave (); m_flagMouseTracking = FALSE; break; case WM_LBUTTONDOWN: OnMouseDown (0, 0, LOWORD(lParam), HIWORD(lParam)); break; case WM_LBUTTONUP: OnMouseUp (0, 0, LOWORD(lParam), HIWORD(lParam)); break; case WM_RBUTTONDOWN: OnMouseDown (0, 1, LOWORD(lParam), HIWORD(lParam)); break; case WM_RBUTTONUP: OnMouseUp (0, 1, LOWORD(lParam), HIWORD(lParam)); OnContextMenu ( ); break; case WM_ERASEBKGND: // we'll erase the background during the WM_PAINT message as necessary // to support dynamic background color for views // return FALSE to indicate we didn't erase the background here. return FALSE; case WM_PAINT: { PAINTSTRUCT ps; HDC hdc = ::BeginPaint (m_hWnd, &ps); // erase the background if required if (ps.fErase) { OnEraseBackground (hdc, ps); ps.fErase = FALSE; } OnPaint (hdc, ps); ::EndPaint (m_hWnd, &ps); } break; case WM_CHAR: OnKeyPress ( (int)wParam, LOWORD(lParam) ); break; case WM_KEYDOWN: OnKeyDown ( (int)wParam ); break; case WM_KEYUP: OnKeyUp ( (int)wParam ); break; case WM_NCDESTROY: OnPreDestroy (); m_hWnd = NULL; break; case WM_DESTROY: OnDestroy (); if (m_isMainWnd) { // ::MessageBox (0, _T("callling PostQuitMessage(0)"), _T(""), 0); ::PostQuitMessage (0); } break; case WM_SIZE: { int cx, cy; cx = LOWORD(lParam); cy = HIWORD(lParam); OnResize (cx, cy); } break; case WM_SETFOCUS: OnGotFocus (); break; case WM_KILLFOCUS: OnLostFocus (); break; case WM_COMMAND: OnCommand ( LOWORD(wParam) ); break; case WM_CONTEXTMENU: OnContextMenu ( ); break; case WM_CLOSE: { BOOL cancel = FALSE; OnClose (cancel); if (cancel == FALSE) DestroyWindow (m_hWnd); } break; case WM_DROPFILES: OnDropFiles ((HDROP)wParam); break; default: return ::DefWindowProc (m_hWnd, msg, wParam, lParam); } return 0; }