Код: Выделить всё
RegisterCommand 62016 "RotateIcon"
Global ROTATE_THREAD = 0
Func RotateIcon()
If ROTATE_THREAD > 0 Then
ROTATE_THREAD = 0
Return
EndIf
RunThread("ThreadRotateIcon", IsPressed(0x11))
EndFunc
Func ThreadRotateIcon(FileIcons)
ROTATE_THREAD = 1
Local hIcon = SendMessage(AUTORUN_TCHANDLE, 0x7f, 2, 0)
While ROTATE_THREAD > 0
Sleep(100)
If FileIcons Then
IconRotateDraw()
Else
RotateDeviceContext()
EndIf
Wend
SendMessage(AUTORUN_TCHANDLE, 0x80, 0, hIcon)
WinRedraw(2)
EndFunc
Func IconRotateDraw()
Static nIco = 0
nIco += 1
If nIco > 4 Then nIco = 1
Local sFile = COMMANDER_PATH & "\Icons\TC" & nIco & ".ico"
Local hIco = DllCall("shell32\ExtractIconW", _
"ptr", AUTORUN_TCHANDLE, _
"wstr", sFile, _
"uint", 0, _
"ptr")
Local hWnd = WinFind(AUTORUN_TCHANDLE, _
(AUTORUN_TCARCH = 32 ? "TMyPanel" : "Window"), _
(AUTORUN_TCARCH = 32 ? 6 : 10))
#Local hWnd = RequestInfo(15)
Local hDC = DllCall("GetWindowDC", "ptr", hWnd, "ptr")
Local x, y, w, h
WinGetPos("x", "y", "w", "h", hWnd)
DllCall("DrawIconEx", _
"ptr", hDC, _
"int", w - 20, _
"int", 1, _
"ptr", hIco, _
"int", 16, _
"int", 16, _
"uint", 0, _
"ptr", 0, _
"uint", 0x0003)
SendMessage(AUTORUN_TCHANDLE, 0x80, 0, hIco)
SendMessage(AUTORUN_TCHANDLE, 0x80, 1, hIco)
DllCall("ReleaseDC", "ptr", AUTORUN_TCHANDLE, "ptr", hDC)
DllCall("DestroyIcon", "ptr", hIco)
EndFunc
Func RotateDeviceContext()
Static c = 0
c += 1
If c > 4 Then c = 1
Local x, y, w, h
Local hIco = SendMessage(AUTORUN_TCHANDLE, 0x7f, 2, 0)
Local hWnd = WinFind(AUTORUN_TCHANDLE, _
(AUTORUN_TCARCH = 32 ? "TMyPanel" : "Window"), _
(AUTORUN_TCARCH = 32 ? 6 : 10))
#Local hWnd = RequestInfo(15)
Local hdcWndDC = DllCall("GetWindowDC", "ptr", hWnd, "ptr")
Local hdcMemDC = DllCall("CreateCompatibleDC", "ptr", hdcWndDC, "ptr")
Local hdcBltDC = DllCall("CreateCompatibleDC", "ptr", hdcWndDC, "ptr")
Local hbmDB1 = DllCall("CreateCompatibleBitmap", "ptr", hdcWndDC, "int", 16, "int", 16,"ptr")
Local hbmDB2 = DllCall("CreateCompatibleBitmap", "ptr", hdcWndDC, "int", 16, "int", 16,"ptr")
DllCall("SelectObject", "ptr", hdcMemDC, "ptr", hbmDB1, "ptr")
DllCall("SelectObject", "ptr", hdcBltDC, "ptr", hbmDB2, "ptr")
DllCall("DrawIconEx", _
"ptr", hdcMemDC, _
"int", 1, _
"int", 1, _
"ptr", hIco, _
"int", 16, _
"int", 16, _
"uint", 0, _
"ptr", 0, _
"uint", 0x0003)
Local pt = Buffer(24)
pt.Zero()
If c = 1 Then
pt.SetNum(0, "int", 16, "int", 0, _
"int", 0, "int", 0, _
"int", 16, "int", 16)
ElseIf c = 2 Then
pt.SetNum(0, "int", 16, "int", 16, _
"int", 16, "int", 0, _
"int", 0, "int", 16)
ElseIf c = 3 Then
pt.SetNum(0, "int", 0, "int", 16, _
"int", 16, "int", 16, _
"int", 0, "int", 0)
ElseIf c = 4 Then
pt.SetNum(0, "int", 0, "int", 0, _
"int", 0, "int", 16, _
"int", 16, "int", 0)
EndIf
DllCall("PlgBlt", _
"ptr", hdcBltDC, _
"ptr", pt.Ptr, _
"ptr", hdcMemDC, _
"int", 0, _
"int", 0, _
"int", 16, _
"int", 16, _
"ptr", 0, _
"int", 0, "int", 0)
WinGetPos("x", "y", "w", "h", hWnd)
DllCall("BitBlt", _
"ptr", hdcWndDC, _
"int", w - 20, _
"int", 2, _
"int", 16, _
"int", 16, _
"ptr", hdcBltDC, _
"int", 1, _
"int", 1, _
"dword", 13369376)
DllCall("DeleteObject", "ptr", hbmDB1)
DllCall("DeleteObject", "ptr", hbmDB2)
DllCall("DeleteObject", "ptr", hdcMemDC)
DllCall("DeleteObject", "ptr", hdcBltDC)
DllCall("ReleaseDC", "ptr", AUTORUN_TCHANDLE, "ptr", hdcWndDC)
EndFunc