1 (изменено: Malcev, 2023-11-05 18:48:25)

Тема: AHK: Получение IDCompositionVisual чужого окна

Недокументированное апи, которое использует виндовс для отображения DWM Thumbnails.
https://blog.adeltax.com/dwm-thumbnails … ionvisual/
На автохотки как-то так (при нажатии f11 будет примитивная анимация):

targetWindow := WinExist("ahk_class Shell_TrayWnd")

if !targetWindow
{
   msgbox targetWindow does not exist
   exitapp
}
DllCall("LoadLibrary", "str", "D3D11.dll")
DllCall("LoadLibrary", "str", "Dcomp.dll")
dwmapiLib := DllCall("LoadLibrary", "str", "Dwmapi.dll", "ptr")
lDwmpCreateSharedThumbnailVisual := DllCall("GetProcAddress", "ptr", dwmapiLib, "ptr", 147, "ptr")
lDwmpQueryWindowThumbnailSourceSize := DllCall("GetProcAddress", "ptr", dwmapiLib, "ptr", 162, "ptr")
if !lDwmpCreateSharedThumbnailVisual or !lDwmpQueryWindowThumbnailSourceSize
{
   msgbox dwmapiLib error
   exitapp
}
hr := DllCall("D3D11\D3D11CreateDevice", "ptr", 0, "int", D3D_DRIVER_TYPE_HARDWARE := 1, "ptr", 0, "uint", D3D11_CREATE_DEVICE_BGRA_SUPPORT := 0x20, "ptr", 0, "uint", 0, "uint", D3D11_SDK_VERSION := 7, "ptr*", direct3dDevice, "ptr*", 0, "ptr*", 0)
if (hr != 0)
{
   msgbox D3D11CreateDevice error - %A_LastError%
   exitapp
}
dxgiDevice := ComObjQuery(direct3dDevice, IID_IDXGIDevice := "{54ec77fa-1377-44e6-8c32-88fd5f44c84c}")
if !dxgiDevice
{
   msgbox dxgiDevice error - %A_LastError%
   exitapp
}
VarSetCapacity(IID_IDCompositionDevice, 16, 0)
DllCall("ole32\CLSIDFromString", "str", "{C37EA93A-E7AA-450D-B16F-9746CB0407F3}", "ptr", &IID_IDCompositionDevice)
hr := DllCall("Dcomp\DCompositionCreateDevice3", "ptr", dxgiDevice, "ptr", &IID_IDCompositionDevice, "ptr*", dcompDevice)
if (hr != 0)
{
   msgbox DCompositionCreateDevice3 error - %A_LastError%
   exitapp
}
ObjRelease(direct3dDevice)
ObjRelease(dxgiDevice)

VarSetCapacity(windowSize, 8, 0)
hr := DllCall(lDwmpQueryWindowThumbnailSourceSize, "uptr", targetWindow, "int", 0, "ptr", &windowSize)
if (hr != 0)
{
   msgbox lDwmpQueryWindowThumbnailSourceSize error - %A_LastError%
   exitapp
}
width := NumGet(windowSize, 0, "uint")
height := NumGet(windowSize, 4, "uint")
VarSetCapacity(DWM_THUMBNAIL_PROPERTIES, 48, 0)
NumPut(0x00000010|0x00000008|0x00000001|0x00000002|0x00000004|0x4000000, DWM_THUMBNAIL_PROPERTIES, 0, "uint")   ; DWM_TNP_SOURCECLIENTAREAONLY | DWM_TNP_VISIBLE | DWM_TNP_RECTDESTINATION | DWM_TNP_RECTSOURCE | DWM_TNP_OPACITY | DWM_TNP_ENABLE3D
NumPut(width, DWM_THUMBNAIL_PROPERTIES, 12, "uint")   ; rcDestination
NumPut(height, DWM_THUMBNAIL_PROPERTIES, 16, "uint")
NumPut(width, DWM_THUMBNAIL_PROPERTIES, 28, "uint")   ; rcSource
NumPut(height, DWM_THUMBNAIL_PROPERTIES, 32, "uint") 
NumPut(255, DWM_THUMBNAIL_PROPERTIES, 36, "uchar")   ; opacity
NumPut(1, DWM_THUMBNAIL_PROPERTIES, 37, "uint")   ; fVisible

Gui +hwndmyWnd -DPIScale
Gui Show, w%width% h%height%

hr := DllCall(lDwmpCreateSharedThumbnailVisual, "uptr", myWnd, "uptr", targetWindow, "uint", 2, "ptr", &DWM_THUMBNAIL_PROPERTIES, "ptr", dcompDevice, "ptr*", windowVisual, "ptr*", hThumbWindow)
if (hr != 0)
{
   msgbox lDwmpCreateSharedThumbnailVisual error - %A_LastError%
   exitapp
}
hr := DllCall(NumGet(NumGet(dcompDevice+0)+6*A_PtrSize), "ptr", dcompDevice, "uptr", myWnd, "int", 0, "ptr*", dcompTarget)   ; IDCompositionDevice::CreateTargetForHwnd
if (hr != 0)
{
   msgbox IDCompositionDevice::CreateTargetForHwnd error - %A_LastError%
   exitapp
}
DllCall(NumGet(NumGet(dcompDevice+0)+19*A_PtrSize), "ptr", dcompDevice, "ptr*", Scale3D)   ; IDCompositionDevice::CreateScaleTransform3D
DllCall(NumGet(NumGet(dcompDevice+0)+23*A_PtrSize), "ptr", dcompDevice, "ptr*", EffectGroup)   ; IDCompositionDevice::CreateEffectGroup
DllCall(NumGet(NumGet(dcompDevice+0)+25*A_PtrSize), "ptr", dcompDevice, "ptr*", Animation)   ; IDCompositionDevice2::CreateAnimation
DllCall(NumGet(NumGet(dcompTarget+0)+3*A_PtrSize), "ptr", dcompTarget, "ptr", windowVisual)   ; IDCompositionTarget::SetRoot
DllCall(NumGet(NumGet(dcompDevice+0)+3*A_PtrSize), "ptr", dcompDevice)   ; IDCompositionDevice::Commit
return

f11::
DllCall(NumGet(NumGet(Animation+0)+5*A_PtrSize), "ptr", Animation, "double", 0, "float", 1, "float", -1, "float", 0, "float", 0)   ; IDCompositionAnimation::AddCubic
DllCall(NumGet(NumGet(Animation+0)+5*A_PtrSize), "ptr", Animation, "double", 0.5, "float", 0.5, "float", 1, "float", 0, "float", 0)   ; IDCompositionAnimation::AddCubic
DllCall(NumGet(NumGet(Animation+0)+8*A_PtrSize), "ptr", Animation, "double", 1, "float", 1)   ; IDCompositionAnimation::End

DllCall(NumGet(NumGet(Scale3D+0)+3*A_PtrSize), "ptr", Scale3D, "ptr", Animation)   ; IDCompositionScaleTransform3D::SetScaleX(IDCompositionAnimation*)
DllCall(NumGet(NumGet(Scale3D+0)+5*A_PtrSize), "ptr", Scale3D, "ptr", Animation)   ; IDCompositionScaleTransform3D::SetScaleY(IDCompositionAnimation*)
DllCall(NumGet(NumGet(Scale3D+0)+7*A_PtrSize), "ptr", Scale3D, "ptr", Animation)   ; IDCompositionScaleTransform3D::SetScaleZ(IDCompositionAnimation*)
DllCall(NumGet(NumGet(Scale3D+0)+10*A_PtrSize), "ptr", Scale3D, "float", width/2)   ; IDCompositionScaleTransform3D::SetCenterX(float)
DllCall(NumGet(NumGet(Scale3D+0)+12*A_PtrSize), "ptr", Scale3D, "float", height/2)   ; IDCompositionScaleTransform3D::SetCenterY(float)

DllCall(NumGet(NumGet(EffectGroup+0)+5*A_PtrSize), "ptr", EffectGroup, "ptr", Scale3D)   ; IDCompositionEffectGroup::SetTransform3D
DllCall(NumGet(NumGet(windowVisual+0)+10*A_PtrSize), "ptr", windowVisual, "ptr", EffectGroup)   ; IDCompositionVisual::SetEffect
DllCall(NumGet(NumGet(dcompTarget+0)+3*A_PtrSize), "ptr", dcompTarget, "ptr", windowVisual)   ; IDCompositionTarget::SetRoot
DllCall(NumGet(NumGet(dcompDevice+0)+3*A_PtrSize), "ptr", dcompDevice)   ; IDCompositionDevice::Commit
return

Пример вертикального отображения нескольких visual (окна должны вертикально друг за другом помещаться на рабочем столе), при нажатии f1, f2, f3...  анимация:

targetWindows := [WinExist("ahk_class Shell_TrayWnd"), 0x1307fe, 0x3904ce]

oHotkeys := {}
loop % targetWindows.length()
{
   if !WinExist("ahk_id " targetWindows[A_Index])
   {
      msgbox Window %A_Index% does not exist
      exitapp
   }
   hotkey := "f" A_Index
   oHotkeys[hotkey] := A_Index
   Hotkey, % hotkey, animation
}
DllCall("LoadLibrary", "str", "D3D11.dll")
DllCall("LoadLibrary", "str", "Dcomp.dll")
dwmapiLib := DllCall("LoadLibrary", "str", "Dwmapi.dll", "ptr")
lDwmpCreateSharedThumbnailVisual := DllCall("GetProcAddress", "ptr", dwmapiLib, "ptr", 147, "ptr")
lDwmpQueryWindowThumbnailSourceSize := DllCall("GetProcAddress", "ptr", dwmapiLib, "ptr", 162, "ptr")
if !lDwmpCreateSharedThumbnailVisual or !lDwmpQueryWindowThumbnailSourceSize
{
   msgbox dwmapiLib error
   exitapp
}
hr := DllCall("D3D11\D3D11CreateDevice", "ptr", 0, "int", D3D_DRIVER_TYPE_HARDWARE := 1, "ptr", 0, "uint", D3D11_CREATE_DEVICE_BGRA_SUPPORT := 0x20, "ptr", 0, "uint", 0, "uint", D3D11_SDK_VERSION := 7, "ptr*", direct3dDevice, "ptr*", 0, "ptr*", 0)
if (hr != 0)
{
   msgbox D3D11CreateDevice error - %A_LastError%
   exitapp
}
dxgiDevice := ComObjQuery(direct3dDevice, IID_IDXGIDevice := "{54ec77fa-1377-44e6-8c32-88fd5f44c84c}")
if !dxgiDevice
{
   msgbox dxgiDevice error - %A_LastError%
   exitapp
}
VarSetCapacity(IID_IDCompositionDevice, 16, 0)
DllCall("ole32\CLSIDFromString", "str", "{C37EA93A-E7AA-450D-B16F-9746CB0407F3}", "ptr", &IID_IDCompositionDevice)
hr := DllCall("Dcomp\DCompositionCreateDevice3", "ptr", dxgiDevice, "ptr", &IID_IDCompositionDevice, "ptr*", dcompDevice)
if (hr != 0)
{
   msgbox DCompositionCreateDevice3 error - %A_LastError%
   exitapp
}
ObjRelease(direct3dDevice)
ObjRelease(dxgiDevice)

widthMax := heightAll := 0
loop % targetWindows.length()
{
   VarSetCapacity(windowSize%A_Index%, 8, 0)
   hr := DllCall(lDwmpQueryWindowThumbnailSourceSize, "uptr", targetWindows[A_Index], "int", 0, "ptr", &windowSize%A_Index%)
   if (hr != 0)
   {
      msgbox lDwmpQueryWindowThumbnailSourceSize error - %A_LastError%
      exitapp
   }
   width%A_Index% := NumGet(windowSize%A_Index%, 0, "uint")
   height%A_Index% := NumGet(windowSize%A_Index%, 4, "uint")
   VarSetCapacity(DWM_THUMBNAIL_PROPERTIES%A_Index%, 48, 0)
   NumPut(0x00000010|0x00000008|0x00000001|0x00000002|0x00000004|0x4000000, DWM_THUMBNAIL_PROPERTIES%A_Index%, 0, "uint")   ; DWM_TNP_SOURCECLIENTAREAONLY | DWM_TNP_VISIBLE | DWM_TNP_RECTDESTINATION | DWM_TNP_RECTSOURCE | DWM_TNP_OPACITY | DWM_TNP_ENABLE3D
   NumPut(width%A_Index%, DWM_THUMBNAIL_PROPERTIES%A_Index%, 12, "uint")
   NumPut(height%A_Index%, DWM_THUMBNAIL_PROPERTIES%A_Index%, 16, "uint")
   NumPut(width%A_Index%, DWM_THUMBNAIL_PROPERTIES%A_Index%, 28, "uint")   ; rcSource
   NumPut(height%A_Index%, DWM_THUMBNAIL_PROPERTIES%A_Index%, 32, "uint") 
   NumPut(255, DWM_THUMBNAIL_PROPERTIES%A_Index%, 36, "uchar")   ; opacity
   NumPut(1, DWM_THUMBNAIL_PROPERTIES%A_Index%, 37, "uint")   ; fVisible
   heightAll += height%A_Index%
   if (width%A_Index% > widthMax)
      widthMax := width%A_Index%
}
if (heightAll > A_ScreenHeight)
{
   msgbox whole height is too long
   exitapp
}

Gui +hwndmyWnd -DPIScale
Gui Show, w%widthMax% h%heightAll%

loop % targetWindows.length()
{
   hr := DllCall(lDwmpCreateSharedThumbnailVisual, "uptr", myWnd, "uptr", targetWindows[A_Index], "uint", 2, "ptr", &DWM_THUMBNAIL_PROPERTIES%A_Index%, "ptr", dcompDevice, "ptr*", windowVisual%A_Index%, "ptr*", hThumbWindow%A_Index%)
   if (hr != 0)
   {
      msgbox lDwmpCreateSharedThumbnailVisual error - %A_LastError%
      exitapp
   }
}
hr := DllCall(NumGet(NumGet(dcompDevice+0)+6*A_PtrSize), "ptr", dcompDevice, "uptr", myWnd, "int", 0, "ptr*", dcompTarget)   ; IDCompositionDevice::CreateTargetForHwnd
if (hr != 0)
{
   msgbox IDCompositionDevice::CreateTargetForHwnd error - %A_LastError%
   exitapp
}
DllCall(NumGet(NumGet(dcompDevice+0)+7*A_PtrSize), "ptr", dcompDevice, "ptr*", mainVisual)   ; IDCompositionDevice::CreateVisual
DllCall(NumGet(NumGet(dcompTarget+0)+3*A_PtrSize), "ptr", dcompTarget, "ptr", mainVisual)   ; IDCompositionTarget::SetRoot
heightPrev := 0
loop % targetWindows.length()
{
   DllCall(NumGet(NumGet(mainVisual+0)+16*A_PtrSize), "ptr", mainVisual, "ptr", windowVisual%A_Index%, "int", 0, "ptr", 0)   ; IDCompositionVisual::AddVisual
   DllCall(NumGet(NumGet(windowVisual%A_Index%+0)+6*A_PtrSize), "ptr", windowVisual%A_Index%, "float", heightPrev)   ; IDCompositionVisual::SetOffsetY(float)
   heightPrev += height%A_Index%
}
DllCall(NumGet(NumGet(dcompDevice+0)+3*A_PtrSize), "ptr", dcompDevice)   ; IDCompositionDevice::Commit
loop % targetWindows.length()
{
   DllCall(NumGet(NumGet(dcompDevice+0)+19*A_PtrSize), "ptr", dcompDevice, "ptr*", Scale3D%A_Index%)   ; IDCompositionDevice::CreateScaleTransform3D
   DllCall(NumGet(NumGet(dcompDevice+0)+23*A_PtrSize), "ptr", dcompDevice, "ptr*", EffectGroup%A_Index%)   ; IDCompositionDevice::CreateEffectGroup
}
DllCall(NumGet(NumGet(dcompDevice+0)+25*A_PtrSize), "ptr", dcompDevice, "ptr*", Animation)   ; IDCompositionDevice2::CreateAnimation
DllCall(NumGet(NumGet(Animation+0)+5*A_PtrSize), "ptr", Animation, "double", 0, "float", 1, "float", -1, "float", 0, "float", 0)   ; IDCompositionAnimation::AddCubic
DllCall(NumGet(NumGet(Animation+0)+5*A_PtrSize), "ptr", Animation, "double", 0.5, "float", 0.5, "float", 1, "float", 0, "float", 0)   ; IDCompositionAnimation::AddCubic
DllCall(NumGet(NumGet(Animation+0)+8*A_PtrSize), "ptr", Animation, "double", 1, "float", 1)   ; IDCompositionAnimation::End
return

animation:
n := oHotkeys[A_ThisHotkey]
DllCall(NumGet(NumGet(Scale3D%n%+0)+3*A_PtrSize), "ptr", Scale3D%n%, "ptr", Animation)   ; IDCompositionScaleTransform3D::SetScaleX(IDCompositionAnimation*)
DllCall(NumGet(NumGet(Scale3D%n%+0)+5*A_PtrSize), "ptr", Scale3D%n%, "ptr", Animation)   ; IDCompositionScaleTransform3D::SetScaleY(IDCompositionAnimation*)
DllCall(NumGet(NumGet(Scale3D%n%+0)+7*A_PtrSize), "ptr", Scale3D%n%, "ptr", Animation)   ; IDCompositionScaleTransform3D::SetScaleZ(IDCompositionAnimation*)
DllCall(NumGet(NumGet(Scale3D%n%+0)+10*A_PtrSize), "ptr", Scale3D%n%, "float", width%n%/2)   ; IDCompositionScaleTransform3D::SetCenterX(float)
DllCall(NumGet(NumGet(Scale3D%n%+0)+12*A_PtrSize), "ptr", Scale3D%n%, "float", height%n%/2)   ; IDCompositionScaleTransform3D::SetCenterY(float)
DllCall(NumGet(NumGet(EffectGroup%n%+0)+5*A_PtrSize), "ptr", EffectGroup%n%, "ptr", Scale3D%n%)   ; IDCompositionEffectGroup::SetTransform3D
DllCall(NumGet(NumGet(windowVisual%n%+0)+10*A_PtrSize), "ptr", windowVisual%n%, "ptr", EffectGroup%n%)   ; IDCompositionVisual::SetEffect
DllCall(NumGet(NumGet(dcompDevice+0)+3*A_PtrSize), "ptr", dcompDevice)   ; IDCompositionDevice::Commit
return

Вариант для отображения всех окон на рабочем столе.
При нажатии f11 - анимация, f12 - visual обновляются.

width := 1000   ; gui width
height := 640   ; gui height
hwndsExclude := [0x39064a, 0x1601ca]   ; excluded windows

Gui +hwndmyWnd -DPIScale
Gui Show, w%width% h%height%
VarSetCapacity(enable, 4, 0)
NumPut(1, enable, 0, "int")
VarSetCapacity(WINCOMPATTRDATA, A_PtrSize*3, 0)
NumPut(WCA_EXCLUDED_FROM_LIVEPREVIEW := 0xD, WINCOMPATTRDATA, 0, "int")
NumPut(&enable, WINCOMPATTRDATA, A_PtrSize, "ptr")
NumPut(4, WINCOMPATTRDATA, A_PtrSize*2, "uint")
DllCall("SetWindowCompositionAttribute", "uptr", myWnd, "ptr", &WINCOMPATTRDATA)

DllCall("LoadLibrary", "str", "D3D11.dll")
DllCall("LoadLibrary", "str", "Dcomp.dll")
dwmapiLib := DllCall("LoadLibrary", "str", "Dwmapi.dll", "ptr")
lDwmpCreateSharedMultiWindowVisual := DllCall("GetProcAddress", "ptr", dwmapiLib, "ptr", 163, "ptr")
lDwmpUpdateSharedMultiWindowVisual := DllCall("GetProcAddress", "ptr", dwmapiLib, "ptr", 164, "ptr")
if !lDwmpCreateSharedMultiWindowVisual or !lDwmpUpdateSharedMultiWindowVisual
{
   msgbox dwmapiLib error
   exitapp
}
hr := DllCall("D3D11\D3D11CreateDevice", "ptr", 0, "int", D3D_DRIVER_TYPE_HARDWARE := 1, "ptr", 0, "uint", D3D11_CREATE_DEVICE_BGRA_SUPPORT := 0x20, "ptr", 0, "uint", 0, "uint", D3D11_SDK_VERSION := 7, "ptr*", direct3dDevice, "ptr*", 0, "ptr*", 0)
if (hr != 0)
{
   msgbox D3D11CreateDevice error - %A_LastError%
   exitapp
}
dxgiDevice := ComObjQuery(direct3dDevice, IID_IDXGIDevice := "{54ec77fa-1377-44e6-8c32-88fd5f44c84c}")
if !dxgiDevice
{
   msgbox dxgiDevice error - %A_LastError%
   exitapp
}
VarSetCapacity(IID_IDCompositionDevice, 16, 0)
DllCall("ole32\CLSIDFromString", "str", "{C37EA93A-E7AA-450D-B16F-9746CB0407F3}", "ptr", &IID_IDCompositionDevice)
hr := DllCall("Dcomp\DCompositionCreateDevice3", "ptr", dxgiDevice, "ptr", &IID_IDCompositionDevice, "ptr*", dcompDevice)
if (hr != 0)
{
   msgbox DCompositionCreateDevice3 error - %A_LastError%
   exitapp
}
ObjRelease(direct3dDevice)
ObjRelease(dxgiDevice)

hr := DllCall(lDwmpCreateSharedMultiWindowVisual, "uptr", myWnd, "ptr", dcompDevice, "ptr*", virtualDesktopVisual, "ptr*", hThumbVirtualDesktop)
if (hr != 0)
{
   msgbox lDwmpCreateSharedMultiWindowVisual error - %A_LastError%
   exitapp
}
VarSetCapacity(monitorSize, 16, 0)
NumPut(a_screenwidth, monitorSize, 8, "uint")
NumPut(a_screenheight, monitorSize, 12, "uint")
VarSetCapacity(targetSize, 8, 0)
NumPut(width, targetSize, 0, "uint")
NumPut(height, targetSize, 4, "uint")
length := hwndsExclude.length()
if (length = "")
   length := 0
VarSetCapacity(excludeArray, A_PtrSize*length, 0)
for k, v in hwndsExclude
   NumPut(v, excludeArray, A_PtrSize*(a_index-1), "ptr")
OSbuildNumber := StrSplit(A_OSVersion, ".")[3]
if (OSbuildNumber < 20000)
   hr := DllCall(lDwmpUpdateSharedMultiWindowVisual, "uptr", hThumbVirtualDesktop, "ptr", 0, "uint", 0, "ptr", &excludeArray, "uint", length, "ptr", &monitorSize, "ptr", &targetSize)
else
   hr := DllCall(lDwmpUpdateSharedMultiWindowVisual, "uptr", hThumbVirtualDesktop, "ptr", 0, "uint", 0, "ptr", &excludeArray, "uint", length, "ptr", &monitorSize, "ptr", &targetSize, "uint", 1)
if (hr != 0)
{
   msgbox lDwmpUpdateSharedMultiWindowVisual error - %A_LastError%
   exitapp
}
hr := DllCall(NumGet(NumGet(dcompDevice+0)+6*A_PtrSize), "ptr", dcompDevice, "uptr", myWnd, "int", 0, "ptr*", dcompTarget)   ; IDCompositionDevice::CreateTargetForHwnd
if (hr != 0)
{
   msgbox IDCompositionDevice::CreateTargetForHwnd error - %A_LastError%
   exitapp
}
DllCall(NumGet(NumGet(dcompDevice+0)+19*A_PtrSize), "ptr", dcompDevice, "ptr*", Scale3D)   ; IDCompositionDevice::CreateScaleTransform3D
DllCall(NumGet(NumGet(dcompDevice+0)+23*A_PtrSize), "ptr", dcompDevice, "ptr*", EffectGroup)   ; IDCompositionDevice::CreateEffectGroup
DllCall(NumGet(NumGet(dcompDevice+0)+25*A_PtrSize), "ptr", dcompDevice, "ptr*", Animation)   ; IDCompositionDevice2::CreateAnimation
DllCall(NumGet(NumGet(dcompTarget+0)+3*A_PtrSize), "ptr", dcompTarget, "ptr", virtualDesktopVisual)   ; IDCompositionTarget::SetRoot
DllCall(NumGet(NumGet(dcompDevice+0)+3*A_PtrSize), "ptr", dcompDevice)   ; IDCompositionDevice::Commit
return

f11::
DllCall(NumGet(NumGet(Animation+0)+5*A_PtrSize), "ptr", Animation, "double", 0, "float", 1, "float", -1, "float", 0, "float", 0)   ; IDCompositionAnimation::AddCubic
DllCall(NumGet(NumGet(Animation+0)+5*A_PtrSize), "ptr", Animation, "double", 0.5, "float", 0.5, "float", 1, "float", 0, "float", 0)   ; IDCompositionAnimation::AddCubic
DllCall(NumGet(NumGet(Animation+0)+8*A_PtrSize), "ptr", Animation, "double", 1, "float", 1)   ; IDCompositionAnimation::End

DllCall(NumGet(NumGet(Scale3D+0)+3*A_PtrSize), "ptr", Scale3D, "ptr", Animation)   ; IDCompositionScaleTransform3D::SetScaleX(IDCompositionAnimation*)
DllCall(NumGet(NumGet(Scale3D+0)+5*A_PtrSize), "ptr", Scale3D, "ptr", Animation)   ; IDCompositionScaleTransform3D::SetScaleY(IDCompositionAnimation*)
DllCall(NumGet(NumGet(Scale3D+0)+7*A_PtrSize), "ptr", Scale3D, "ptr", Animation)   ; IDCompositionScaleTransform3D::SetScaleZ(IDCompositionAnimation*)
DllCall(NumGet(NumGet(Scale3D+0)+10*A_PtrSize), "ptr", Scale3D, "float", width/2)   ; IDCompositionScaleTransform3D::SetCenterX(float)
DllCall(NumGet(NumGet(Scale3D+0)+12*A_PtrSize), "ptr", Scale3D, "float", height/2)   ; IDCompositionScaleTransform3D::SetCenterY(float)

DllCall(NumGet(NumGet(EffectGroup+0)+5*A_PtrSize), "ptr", EffectGroup, "ptr", Scale3D)   ; IDCompositionEffectGroup::SetTransform3D
DllCall(NumGet(NumGet(virtualDesktopVisual+0)+10*A_PtrSize), "ptr", virtualDesktopVisual, "ptr", EffectGroup)   ; IDCompositionVisual::SetEffect
DllCall(NumGet(NumGet(dcompTarget+0)+3*A_PtrSize), "ptr", dcompTarget, "ptr", virtualDesktopVisual)   ; IDCompositionTarget::SetRoot
DllCall(NumGet(NumGet(dcompDevice+0)+3*A_PtrSize), "ptr", dcompDevice)   ; IDCompositionDevice::Commit
return

f12::
if (OSbuildNumber < 20000)
   hr := DllCall(lDwmpUpdateSharedMultiWindowVisual, "uptr", hThumbVirtualDesktop, "ptr", 0, "uint", 0, "ptr", &excludeArray, "uint", length, "ptr", &monitorSize, "ptr", &targetSize)
else
   hr := DllCall(lDwmpUpdateSharedMultiWindowVisual, "uptr", hThumbVirtualDesktop, "ptr", 0, "uint", 0, "ptr", &excludeArray, "uint", length, "ptr", &monitorSize, "ptr", &targetSize, "uint", 1)
if (hr != 0)
{
   msgbox lDwmpUpdateSharedMultiWindowVisual error - %A_LastError%
   exitapp
}

Тема для обсуждения