Relative Content

Tag Archive for windowswinapi

Is there a scope requirement to “SetWindowPos”?

Im trying to move a button to the right side of the window every wm_paint message, but it always return zero when called in window procedure(like the docs says when it fails), but not at the win main function. The docs for the function says nothing of this(https://learn.microsoft.com/pt-br/windows/win32/api/winuser/nf-winuser-setwindowpos). also i cant find better word for this other than scope requirement. I tried putting setwindowpos into the win main function and it works fine.

Dimming/Darkening another Win32 Window

Is there a way to ‘dim’ another window, that does not belong to your process? Not reducing opacity (that’s easy to do using SetLayeredWindowAttributes), but make the window more dark.

List of Windows programs that should not be killed?

Assume I have a program running with either Admin or SYSTEM privileges. That program will go around repeatedly killing certain other programs in a list. Is there a list of Windows programs that it should not kill?

The third parameter of PrintWindow API

Recently I am using an Win API called PrintWindow, which can screenshot a specific window. In some windows that enabled hardware acceleration, the image will be blank. However, if I changed the third parameter from 0 to 3, it can work again.

I also posted a demo code written in C#: