M
M
maaGames2020-11-25 05:57:10
Windows
maaGames, 2020-11-25 05:57:10

SetWindowPos without space around edges?

I use SetWindowPos(wnd,0, 0.0, 0.0, SWP_NOSIZE) to move the window to the top left corner. From above, the window is placed end-to-end, and a gap remains on the left. Can I somehow shift right up to the left edge so that there is no gap?
Actually, any applications that were manually placed close to the edge are also opened. After their subsequent opening, they slightly shift, leaving a few pixels for the wallpaper to stick out. I would like to get rid of this too.

5fbdc7dfbd6cf748573712.png

It looks like they are clearances for SM_CXSIZEFRAME, SM_CYSIZEFRAME. Is it really necessary to do SetWindowPos(wnd,0, -SM_CXSIZEFRAME,0, 0,0, SWP_NOSIZE)? Most of all, it confuses that a gap does not appear from above.

Added :
SM_CXSIZEFRAME returns 4 pixels, left gap 8 pixels. Those. the gap becomes two times smaller, but remains.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
rPman, 2020-11-25
@rPman

Once upon a time I made an application that removes the frame and resizes the window of any application to fit the entire available desktop minus the panel .. there were no 'minus frame', set 0.0 and the size of the desktop.

SetWindowLong(hWnd,GWL_STYLE,0);
SetWindowLong(hWnd,GWL_STYLE,WS_POPUP|WS_VISIBLE|WS_CLIPSIBLINGS|WS_OVERLAPPED);
SetWindowLong(hWnd,GWL_EXSTYLE,WS_EX_LEFT|WS_EX_LTRREADING|WS_EX_RIGHTSCROLLBAR|WS_EX_APPWINDOW);
SetWindowPos(hWnd,HWND_TOP,x,y,sx,sy,SWP_SHOWWINDOW);

What style did the window have? there shouldn't be anything with border.
ps It's strange that console windows (which stand apart in win32) also have real coordinates a few pixels to the left and after maximizing it automatically goes into minus

M
maaGames, 2020-11-30
@maaGames

https://github.com/wangwenx190/framelesshelper/issues/3
5fc47992ca933325008460.png
Here the essence of the problem is well shown and, it seems, there is a solution. You need to intercept the WM_NCCALCSIZE message and resize the "non-client" area of ​​the window. I have not checked it yet, but most likely you will have to write your own handlers to resize the window so that the mouse works not outside, but inside the window. Or aim at a frame of pixel thickness, which is unrealistic.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question