Skip to content

Commit

Permalink
Revert clipboard stream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
iseahound authored Jan 7, 2022
1 parent 8e088b1 commit 16d5fb3
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions ImagePut (for v1).ahk
Original file line number Diff line number Diff line change
Expand Up @@ -829,20 +829,12 @@ class ImagePut {
Sleep (2**(A_Index-1) * 30)
else throw Exception("Clipboard could not be opened.")

for i, format in ["bmp", 6, "jpg", "gif"] {
if !(format ~= "^\d+$")
format := DllCall("RegisterClipboardFormat", "str", format, "uint")
png := DllCall("RegisterClipboardFormat", "str", "png", "uint")
if !DllCall("IsClipboardFormatAvailable", "uint", png)
throw Exception("Clipboard does not have PNG stream data.")

if !DllCall("IsClipboardFormatAvailable", "uint", format)
continue
;throw Exception("Clipboard does not have stream data.")

if !(hData := DllCall("GetClipboardData", "uint", format, "ptr"))
throw Exception("Shared clipboard data has been deleted.")
}

if !hData
Msgbox :(
if !(hData := DllCall("GetClipboardData", "uint", png, "ptr"))
throw Exception("Shared clipboard data has been deleted.")

; Allow the stream to be freed while leaving the hData intact.
; Please read: https://devblogs.microsoft.com/oldnewthing/20210930-00/?p=105745
Expand Down Expand Up @@ -1602,7 +1594,6 @@ class ImagePut {
WS_VISIBLE := 0x10000000
WS_EX_TOOLWINDOW := 0x80


; Get Bitmap width and height.
DllCall("gdiplus\GdipGetImageWidth", "ptr", pBitmap, "uint*", width:=0)
DllCall("gdiplus\GdipGetImageHeight", "ptr", pBitmap, "uint*", height:=0)
Expand Down

0 comments on commit 16d5fb3

Please sign in to comment.