Total Commander Forum Index Total Commander
Форум поддержки пользователей Total Commander
Сайты: Все о Total Commander | Totalcmd.net | Ghisler.com | RU.TCKB
 
 RulesRules   SearchSearch   FAQFAQ   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Single Post  Topic: Autorun 
Author Message
Orion9



PostPosted: Sun Oct 26, 2025 12:28    Post subject: Reply with quote

Эх, маэстро маэстро... А я ведь так верил.

Ну и где то самое "случайное" перетаскивание кнопок на панели?

Code:
Global gBarWndProc, hBarWnd
Global bwp = Callback("BarWndProc", "hwnd;uint;wparam;lparam")

hBarWnd = RequestInfo(28)
gBarWndProc = DllCall("SetWindowLong" & (auX64 ? "PtrW" : "W"), _
                      "hwnd", hBarWnd, "int", -4, "long_ptr", bwp.Ptr, "ptr")
                     
Func BarWndProc(hWnd, uMsg, wParam, lParam)
    Static IsDrag = 0, _
           hTotal = DllCall("GetModuleHandleW", "Ptr", 0, "handle"), _
           WM_MOUSEMOVE    = 0x0200, _
           WM_LBUTTONDOWN  = 0x0201, _
           WM_LBUTTONUP    = 0x0202           
    Static drag_system = DllCall("LoadCursor", "Ptr", 0, "Ptr", 32646), _
           stop_system = DllCall("LoadCursor", "Ptr", 0, "Ptr", 32648), _
           drag_cursor = DllCall("LoadCursor", "Ptr", hTotal, "Ptr", 22), _
           stop_cursor = DllCall("LoadCursor", "Ptr", hTotal, "Ptr", 21)           
    Switch uMsg
       Case WM_LBUTTONDOWN
          If BitAND(wParam, 0x0008) Then
             MouseGetPos("x","y")         
             IsDrag = 0     
             If DllCall("DragDetect", "hwnd", hWnd, "int64", MakeInt(y, x, 2)) Then
                IsDrag = 1
                WinSetStyle(0x80000, 3, hWnd)
                DllCall("SetLayeredWindowAttributes", "hwnd", hWnd, "ptr", 0, "byte", 128, "dword", 2)         
                DllCall("SetCursor", "Ptr", drag_cursor)
             EndIf
          EndIf   
       Case WM_LBUTTONUP
          If IsDrag = 1 Then
             WinSetStyle(0x80000, 5, hWnd)
             IsDrag = 0             
          EndIf 
       Case WM_MOUSEMOVE
          If IsDrag = 1 And BitAND(wParam, 0x0001) Then
             If WinFromPoint() = hWnd Then
                DllCall("SetCursor", "Ptr", drag_cursor)
             Else
                DllCall("SetCursor", "Ptr", stop_cursor)               
             EndIf
             WinSetText(BitAND(lParam, 0xFFFF) & " - " & BitAND(BitShift(lParam,16), 0xFFFF))
          EndIf   
    EndSwitch
    Return DllCall("CallWindowProcW", _
                   "ptr", gBarWndProc, "hwnd", hWnd, "uint", uMsg, "wparam", wParam, "lparam", lParam)
EndFunc
View user's profile Send private message


Powered by phpBB © 2001, 2005 phpBB Group