forked from karlphillip/GraphicsProgramming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
52 lines (38 loc) · 1.88 KB
/
main.cpp
File metadata and controls
52 lines (38 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// https://westechsolutions.net/sites/WindowedBorderlessGaming/
#include <Windows.h>
#include <iostream>
int main(int argc, char* argv[])
{
HWND win_handle = FindWindow(0, L"Overwatch");
if (!win_handle)
{
std::cout << "Failed FindWindow" << std::endl;
return 0;
}
// Resize
// unsigned int flags = (SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER);
// unsigned int flags = (SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
unsigned int flags = (SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER);
flags &= ~SWP_NOSIZE; // essential
unsigned int x = 300;
unsigned int y = 200;
unsigned int w = 960;
unsigned int h = 540;
SetWindowPos(win_handle, HWND_NOTOPMOST, x, y, w, h, flags);
// SendMessage(win_handle, WM_SIZE, SIZE_RESTORED, MAKELPARAM(x, y));
// PostMessage(win_handle, WM_SIZE, SIZE_RESTORED, MAKELPARAM(x, y));
// InvalidateRect(win_handle, NULL, TRUE);
// SendMessage(win_handle, WM_SETREDRAW, TRUE, 0); // Re-enable repaint
// RedrawWindow(win_handle, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
// RedrawWindow(win_handle, &g::rcDesktop , 0 , RDW_INTERNALPAINT | RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_INVALIDATE);
// Borderless
// SetWindowLong(win_handle, GWL_STYLE, GetWindowLong(win_handle, GWL_EXSTYLE) | WS_EX_TOPMOST);
// SetWindowLong(win_handle, GWL_STYLE, WS_CAPTION | WS_BORDER | WS_SYSMENU | WS_MINIMIZEBOX | WS_OVERLAPPEDWINDOW);
// SetWindowLong(win_handle, GWL_STYLE, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SIZEBOX);
SetWindowLong(win_handle, GWL_STYLE, WS_SYSMENU | WS_OVERLAPPEDWINDOW);
// UpdateWindow(win_handle);
// RECT rc = { x, y, w, h};
// RedrawWindow(win_handle, &rc, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW );
ShowWindow(win_handle, SW_SHOW);
return 0;
}