diff --git a/KeyMouse.t.c b/KeyMouse.t.c index b3824ae..1fdf193 100644 --- a/KeyMouse.t.c +++ b/KeyMouse.t.c @@ -198,6 +198,51 @@ static void MainWindow_OnMouseMove(HWND hwnd, int x, int y, UINT keyFlags){ ReleaseDC(hwnd, hdc); } +static void MainWindow_OnRButtonDown(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags){ + char s[100]; + HDC hdc = GetDC(hwnd); + int size =0; + if(fDoubleClick){ + size = snprintf(s, sizeof(s)/sizeof(s[0]) + , "WM_RBUTTONDBLCLK ==> Db = %d, x = %d, y = %d, flags = %d " + , fDoubleClick + , x + , y + , keyFlags + ); + c_WinGuiUtil_MoveWindowToScreenCenter(hwnd); + }else{ + size = snprintf(s, sizeof(s)/sizeof(s[0]) + , "WM_RBUTTONDOWN ==> Db = %d, x = %d, y = %d, flags = %d " + , fDoubleClick + , x + , y + , keyFlags + ); + } + + SetBkColor(hdc, GetSysColor(COLOR_WINDOW)); + TextOut(hdc, xVal, yVal + 140, s, size); + ReleaseDC(hwnd, hdc); +} + +static void MainWindow_OnRButtonUp(HWND hwnd, int x, int y, UINT keyFlags){ + char s[100]; + HDC hdc = GetDC(hwnd); + int size =0; + + size = snprintf(s, sizeof(s)/sizeof(s[0]) + , "WM_RBUTTONUP ==> x = %d, y = %d, flags = %d " + , x + , y + , keyFlags + ); + + + SetBkColor(hdc, GetSysColor(COLOR_WINDOW)); + TextOut(hdc, xVal, yVal + 160, s, size); + ReleaseDC(hwnd, hdc); +} /* -------------------------------------------------------------------------------------------------------------- */ /* */ @@ -214,6 +259,9 @@ c_WinGuiApp_EventBegin(WndProc) c_WinGuiApp_OnEvent(WM_LBUTTONUP, MainWindow_OnLButtonUp) c_WinGuiApp_OnEvent(WM_DESTROY, MainWindow_OnDestroy) c_WinGuiApp_OnEvent(WM_PAINT, MainWindow_OnPaint) + c_WinGuiApp_OnEvent(WM_RBUTTONDBLCLK, MainWindow_OnRButtonDown) + c_WinGuiApp_OnEvent(WM_RBUTTONDOWN, MainWindow_OnRButtonDown) + c_WinGuiApp_OnEvent(WM_RBUTTONUP, MainWindow_OnRButtonUp) c_WinGuiApp_EventEnd /* -------------------------------------------------------------------------------------------------------------- */ @@ -241,7 +289,8 @@ static HWND Create(HINSTANCE hInstance, int nCmdShow){ HWND hWindow = CreateWindowEx(0, MAIN_WINDOW_CLASSNAME, MAIN_WINDOW_CLASSNAME, WS_OVERLAPPEDWINDOW, 800, 600, - CW_USEDEFAULT, CW_USEDEFAULT, + 800, 300, +// CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); if(!hWindow) return NULL; c_WinGuiApp.hMainWindow = hWindow;