void _ViewFullScreen(HWND hWnd) { // keep in mind normal window rectangle ::GetWindowRect(hWnd, &g_normalRC); // remove caption and border styles DWORD dwOldStyle = ::GetWindowLong(hWnd, GWL_STYLE); DWORD dwNewStyle = dwOldStyle & ~(WS_CAPTION | WS_THICKFRAME); ::SetWindowLong(hWnd, GWL_STYLE, dwNewStyle); // remove the menu bar ::SetMenu(hWnd, NULL); // resize to full screen view // NOTE: use SWP_FRAMECHANGED to force redraw non-client const int x = 0; const int y = 0; const int cx = ::GetSystemMetrics(SM_CXSCREEN); const int cy = ::GetSystemMetrics(SM_CYSCREEN); ::SetWindowPos(hWnd, HWND_TOPMOST, x, y, cx, cy, SWP_FRAMECHANGED); // set full screen indicator g_bFullScreen = TRUE; CorrectCursor(); ResizeDisplay(); ShowOwnedPopups(hwndMain, FALSE); }
VOID MinimizeWndToTray(HWND hWnd) { // Add the tray icon. If we add it before the call to DrawAnimatedRects, // the taskbar gets erased, but doesn't get redrawn until DAR finishes. // This looks untidy, so call the functions in this order // Hide the window ShowWindow(hWnd, SW_HIDE); ShowOwnedPopups(hWnd, FALSE); AnimateToTray(hWnd); }
VOID RestoreWndFromTray(HWND hWnd) { // Show the window, and make sure we're the foreground window ShowWindow(hWnd, SW_SHOW); if(IsIconic(hWnd)) ShowWindow(hWnd, SW_SHOWNORMAL); SetActiveWindow(hWnd); SetForegroundWindow(hWnd); ShowOwnedPopups(hWnd, TRUE); // Remove the tray icon. As described above, remove the icon after the // call to DrawAnimatedRects, or the taskbar will not refresh itself // properly until DAR finished }
int _tmain(int argc, _TCHAR* argv[]) { HWND hwnd = notepad("test1"); printf("[-] hwnd: %08x\n", hwnd); DWORD buf[3]; buf[0] = 1; buf[1] = (DWORD)hwnd; buf[2] = 0xba; NtUserConsoleControl(2, buf, 0xc); NtGdiSetBitmapDimension(0,0x2f,0xbe, 0x0); ShowOwnedPopups(hwnd, 1); SetWindowLong(hwnd, -16, 0x42c10000); SetClassLong(hwnd, -0x1a, 0x6ba99e04); srand( (unsigned) time(NULL)); Sleep(rand()%1000); }
WPI_MRESULT GUIProcessMenuSelect( gui_window *wnd, HWND hwnd, WPI_MSG msg, WPI_PARAM1 wparam, WPI_PARAM2 lparam ) { hint_type type; if( GUIHFloatingPopup != NULLHANDLE ) { type = FLOAT_HINT; #ifndef __OS2_PM__ ShowOwnedPopups( hwnd, true ); #endif GUIPopupMenuSelect( wparam, lparam ); } else { type = MENU_HINT; } DisplayMenuHintText( wnd, wparam, lparam, type ); return( _wpi_defwindowproc( hwnd, msg, wparam, lparam ) ); }
void _ViewNormal(HWND hWnd) { // Put caption and border styles back. DWORD dwOldStyle = ::GetWindowLong(hWnd, GWL_STYLE); DWORD dwNewStyle = dwOldStyle | WS_CAPTION | WS_THICKFRAME; ::SetWindowLong(hWnd, GWL_STYLE, dwNewStyle); // Put back the menu bar. ::SetMenu(hWnd, menu); // Resize to normal view. // NOTE: Use SWP_FRAMECHANGED to force redraw non-client. const int x = g_normalRC.left; const int y = g_normalRC.top; const int cx = g_normalRC.right - g_normalRC.left; const int cy = g_normalRC.bottom - g_normalRC.top; ::SetWindowPos(hWnd, HWND_NOTOPMOST, x, y, cx, cy, SWP_FRAMECHANGED); // Reset full screen indicator. g_bFullScreen = FALSE; CorrectCursor(); ResizeDisplay(); ShowOwnedPopups(hwndMain, TRUE); }
void ToggleFullscreen(HWND hWnd, bool goingFullscreen) { // Make sure no rendering is happening during the switch. bool isOpenGL = g_Config.iGPUBackend == GPU_BACKEND_OPENGL; if (isOpenGL) { GL_Pause(); } int oldWindowState = g_WindowState; g_IgnoreWM_SIZE = true; DWORD dwStyle; if (!goingFullscreen) { dwStyle = ::GetWindowLong(hWnd, GWL_STYLE); // Remove popup dwStyle &= ~WS_POPUP; // Re-add caption and border styles. dwStyle |= WS_OVERLAPPEDWINDOW; // Put back the menu bar. ::SetMenu(hWnd, menu); } else { // If the window was maximized before going fullscreen, make sure to restore first // in order not to have the taskbar show up on top of PPSSPP. if (oldWindowState == SIZE_MAXIMIZED) { ShowWindow(hwndMain, SW_RESTORE); } // Remember the normal window rectangle. ::GetWindowRect(hWnd, &g_normalRC); // Remove caption and border styles. dwStyle = ::GetWindowLong(hWnd, GWL_STYLE); dwStyle &= ~WS_OVERLAPPEDWINDOW; // Add Popup dwStyle |= WS_POPUP; } ::SetWindowLong(hWnd, GWL_STYLE, dwStyle); // Remove the menu bar. This can trigger WM_SIZE ::SetMenu(hWnd, goingFullscreen ? NULL : menu); g_Config.bFullScreen = goingFullscreen; g_IgnoreWM_SIZE = false; // Resize to the appropriate view. // If we're returning to window mode, re-apply the appropriate size setting. if (goingFullscreen) { ShowWindow(hwndMain, SW_MAXIMIZE); } else { ShowWindow(hwndMain, oldWindowState == SIZE_MAXIMIZED ? SW_MAXIMIZE : SW_RESTORE); } CorrectCursor(); bool showOSM = (g_Config.iInternalResolution == RESOLUTION_AUTO); if (showOSM) { ShowScreenResolution(); } ShowOwnedPopups(hwndMain, goingFullscreen ? FALSE : TRUE); W32Util::MakeTopMost(hwndMain, g_Config.bTopMost); WindowsRawInput::NotifyMenu(); if (isOpenGL) { GL_Resume(); } }
LRESULT DefWndHandleSysCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) { POINT Pt; LRESULT lResult; if (!IsWindowEnabled( hWnd )) return 0; if (ISITHOOKED(WH_CBT)) { NtUserMessageCall( hWnd, WM_SYSCOMMAND, wParam, lParam, (ULONG_PTR)&lResult, FNID_DEFWINDOWPROC, FALSE); if (lResult) return 0; } switch (wParam & 0xfff0) { case SC_MOVE: case SC_SIZE: NtUserMessageCall( hWnd, WM_SYSCOMMAND, wParam, lParam, (ULONG_PTR)&lResult, FNID_DEFWINDOWPROC, FALSE); break; case SC_MINIMIZE: if (hWnd == GetActiveWindow()) ShowOwnedPopups(hWnd,FALSE); ShowWindow( hWnd, SW_MINIMIZE ); break; case SC_MAXIMIZE: if (IsIconic(hWnd) && hWnd == GetActiveWindow()) ShowOwnedPopups(hWnd,TRUE); ShowWindow( hWnd, SW_MAXIMIZE ); break; case SC_RESTORE: if (IsIconic(hWnd) && hWnd == GetActiveWindow()) ShowOwnedPopups(hWnd,TRUE); ShowWindow( hWnd, SW_RESTORE ); break; case SC_CLOSE: return SendMessageW(hWnd, WM_CLOSE, 0, 0); // case SC_DEFAULT: case SC_MOUSEMENU: { Pt.x = (short)LOWORD(lParam); Pt.y = (short)HIWORD(lParam); MenuTrackMouseMenuBar(hWnd, wParam & 0x000f, Pt); } break; case SC_KEYMENU: MenuTrackKbdMenuBar(hWnd, wParam, (WCHAR)lParam); break; case SC_VSCROLL: case SC_HSCROLL: { Pt.x = (short)LOWORD(lParam); Pt.y = (short)HIWORD(lParam); DefWndTrackScrollBar(hWnd, wParam, Pt); } break; case SC_TASKLIST: WinExec( "taskman.exe", SW_SHOWNORMAL ); break; case SC_SCREENSAVE: NtUserMessageCall( hWnd, WM_SYSCOMMAND, wParam, lParam, (ULONG_PTR)&lResult, FNID_DEFWINDOWPROC, FALSE); break; case SC_NEXTWINDOW: case SC_PREVWINDOW: DoAppSwitch( wParam, lParam); break; case SC_HOTKEY: { HWND hwnd, hWndLastActive; PWND pWnd; hwnd = (HWND)lParam; pWnd = ValidateHwnd(hwnd); if (pWnd) { hWndLastActive = GetLastActivePopup(hwnd); if (hWndLastActive) { hwnd = hWndLastActive; pWnd = ValidateHwnd(hwnd); } SetForegroundWindow(hwnd); if (pWnd->style & WS_MINIMIZE) { PostMessage(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0); } } } break; default: FIXME("Unimplemented DefWndHandleSysCommand wParam 0x%x\n",wParam); break; } return(0); }
void ToggleFullscreen(HWND hWnd, bool goingFullscreen) { GraphicsContext *graphicsContext = PSP_CoreParameter().graphicsContext; // Make sure no rendering is happening during the switch. if (graphicsContext) { graphicsContext->Pause(); } WINDOWPLACEMENT placement = { sizeof(WINDOWPLACEMENT) }; GetWindowPlacement(hwndMain, &placement); int oldWindowState = g_WindowState; inFullscreenResize = true; g_IgnoreWM_SIZE = true; DWORD dwStyle; if (!goingFullscreen) { dwStyle = ::GetWindowLong(hWnd, GWL_STYLE); // Remove popup dwStyle &= ~WS_POPUP; // Re-add caption and border styles. dwStyle |= WS_OVERLAPPEDWINDOW; // Put back the menu bar. ::SetMenu(hWnd, menu); } else { // If the window was maximized before going fullscreen, make sure to restore first // in order not to have the taskbar show up on top of PPSSPP. if (oldWindowState == SIZE_MAXIMIZED || placement.showCmd == SW_SHOWMAXIMIZED) { ShowWindow(hwndMain, SW_RESTORE); } // Remove caption and border styles. dwStyle = ::GetWindowLong(hWnd, GWL_STYLE); dwStyle &= ~WS_OVERLAPPEDWINDOW; // Add Popup dwStyle |= WS_POPUP; } ::SetWindowLong(hWnd, GWL_STYLE, dwStyle); // Remove the menu bar. This can trigger WM_SIZE ::SetMenu(hWnd, goingFullscreen ? NULL : menu); g_Config.bFullScreen = goingFullscreen; g_IgnoreWM_SIZE = false; // Resize to the appropriate view. // If we're returning to window mode, re-apply the appropriate size setting. if (goingFullscreen) { if (g_Config.bFullScreenMulti) { // Maximize isn't enough to display on all monitors. // Remember that negative coordinates may be valid. int totalX = GetSystemMetrics(SM_XVIRTUALSCREEN); int totalY = GetSystemMetrics(SM_YVIRTUALSCREEN); int totalWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN); int totalHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN); MoveWindow(hwndMain, totalX, totalY, totalWidth, totalHeight, TRUE); HandleSizeChange(oldWindowState); } else { ShowWindow(hwndMain, SW_MAXIMIZE); } } else { ShowWindow(hwndMain, oldWindowState == SIZE_MAXIMIZED ? SW_MAXIMIZE : SW_RESTORE); if (g_Config.bFullScreenMulti && oldWindowState != SIZE_MAXIMIZED) { // Return the screen to where it was. MoveWindow(hwndMain, g_Config.iWindowX, g_Config.iWindowY, g_Config.iWindowWidth, g_Config.iWindowHeight, TRUE); } if (oldWindowState == SIZE_MAXIMIZED) { // WM_SIZE wasn't sent, since the size didn't change (it was full screen before and after.) HandleSizeChange(oldWindowState); } } inFullscreenResize = false; CorrectCursor(); ShowOwnedPopups(hwndMain, goingFullscreen ? FALSE : TRUE); W32Util::MakeTopMost(hwndMain, g_Config.bTopMost); WindowsRawInput::NotifyMenu(); if (graphicsContext) { graphicsContext->Resume(); } }
void ToggleFullscreen(HWND hWnd, bool goingFullscreen) { GraphicsContext *graphicsContext = PSP_CoreParameter().graphicsContext; // Make sure no rendering is happening during the switch. if (graphicsContext) { graphicsContext->Pause(); } int oldWindowState = g_WindowState; g_IgnoreWM_SIZE = true; DWORD dwStyle; if (!goingFullscreen) { dwStyle = ::GetWindowLong(hWnd, GWL_STYLE); // Remove popup dwStyle &= ~WS_POPUP; // Re-add caption and border styles. dwStyle |= WS_OVERLAPPEDWINDOW; // Put back the menu bar. ::SetMenu(hWnd, menu); } else { // If the window was maximized before going fullscreen, make sure to restore first // in order not to have the taskbar show up on top of PPSSPP. if (oldWindowState == SIZE_MAXIMIZED) { ShowWindow(hwndMain, SW_RESTORE); } // Remember the normal window rectangle. ::GetWindowRect(hWnd, &g_normalRC); // Remove caption and border styles. dwStyle = ::GetWindowLong(hWnd, GWL_STYLE); dwStyle &= ~WS_OVERLAPPEDWINDOW; // Add Popup dwStyle |= WS_POPUP; } ::SetWindowLong(hWnd, GWL_STYLE, dwStyle); // Remove the menu bar. This can trigger WM_SIZE ::SetMenu(hWnd, goingFullscreen ? NULL : menu); g_Config.bFullScreen = goingFullscreen; g_IgnoreWM_SIZE = false; // Resize to the appropriate view. // If we're returning to window mode, re-apply the appropriate size setting. if (goingFullscreen) { ShowWindow(hwndMain, SW_MAXIMIZE); } else { ShowWindow(hwndMain, oldWindowState == SIZE_MAXIMIZED ? SW_MAXIMIZE : SW_RESTORE); if (oldWindowState == SIZE_MAXIMIZED) { // WM_SIZE wasn't sent, since the size didn't change (it was full screen before and after.) HandleSizeChange(oldWindowState); } } CorrectCursor(); ShowOwnedPopups(hwndMain, goingFullscreen ? FALSE : TRUE); W32Util::MakeTopMost(hwndMain, g_Config.bTopMost); WindowsRawInput::NotifyMenu(); if (graphicsContext) { graphicsContext->Resume(); } }