Does this function support that the cursor is also drawn?
Thanks for your help
MFG
Turisas
hWnd_to_hBmp() : Capture full screen, Window, Control or user defined area of these
Re: hWnd_to_hBmp() : Capture full screen, Window, Control or user defined area of these
Hi Turisas,Turisas wrote:Does this function support that the cursor is also drawn?
Yes. But this feature is dependent on additional function DrawCursor()
The fourth parameter of hWnd_to_hBmp() requires a 3 element array consisting: IDC constant, X, Y
For example: hWnd_to_hBmp(,,, [0, X, Y]) where 0 will use the current cursor.
If you want to draw a different cursor say IDC_HAND, you may call like: hWnd_to_hBmp(,,, [32649, X, Y])
To determine X and Y you have to call MouseGetPos after setting CoordMode correctly.
List of IDC constants
...and you will also have to include the following function with your code
Code: Select all
DrawCursor( hDC, C:="" ) { ; By SKAN C/M on D295|D299 @ bit.ly/2lyG0sN
C := IsObject(C) ? C : StrLen(C) ? StrSplit( C, ",", A_Space ) : {}, C.Res := 0
C.1 := Round(C.1), C.2 := Round(C.2), C.3 := Round(C.3)
If ! ( C.hCurs := C.1 ? DllCall( "LoadCursor", "Ptr",0, "Int",C.1, "Ptr" ) : 0 )
{
C.SetCapacity( "CURSORINFO", 24 ), C.Ptr := C.GetAddress( "CURSORINFO" )
NumPut( A_PtrSize+16, C.Ptr, "UInt" )
DllCall( "GetCursorInfo", "Ptr",C.Ptr )
C.hCurs := NumGet(C.Ptr,8)
}
If ( C.hIcon := C.hCurs ? DllCall( "CopyIcon", "Ptr",C.hCurs, "Ptr" ) : 0 )
{
C.SetCapacity( "ICONINFO", 32 ), C.Ptr := C.GetAddress( "ICONINFO" )
DllCall( "GetIconInfo", "Ptr",C.hIcon, "Ptr",C.Ptr )
C.xHot := NumGet( C.Ptr+4, "UInt" ), C.hbmMask := NumGet( C.Ptr, A_PtrSize=8 ? 16:12 )
C.yHot := NumGet( C.Ptr+8, "UInt" ), C.hbmColor := NumGet( C.Ptr, A_PtrSize=8 ? 24:16 )
C.Res := DllCall( "DrawIcon", "Ptr",hDC, "Int",C.2-C.xHot, "Int", C.3-C.yHot, "Ptr",C.hCurs )
DllCall( "DestroyIcon", "Ptr", C.hCurs )
DllCall( "DeleteObject", "Ptr", C.hbmMask )
DllCall( "DeleteObject", "Ptr", C.hbmColor )
}
Return C.Res
}
Re: hWnd_to_hBmp() : Capture full screen, Window, Control or user defined area of these
I thank you it worked.
MFG
Turisas.
MFG
Turisas.