Here's an example that doesn't work. As far as I know, I should be using ProtoTypes instead of CallFunction, but they don't make sense to me. So can someone please convert this to a ProtoType so I have it as a code template for converting other unsupported API calls in future? Thank you.
Code: Select all
; https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowdisplayaffinity
#WDA_NONE=0
#WDA_MONITOR=1
Sleep_(2000) ; Allow time for user to select a target window.
hWnd=GetForegroundWindow_()
If OpenLibrary(0,"user32.dll") And GetFunction(0,"SetWindowDisplayAffinity")
Debug CallFunction(0,"SetWindowDisplayAffinity",hWnd,#WDA_MONITOR) ; Returns 0
CloseLibrary(0)
EndIf