Leaderboard
Popular Content
Showing content with the highest reputation on 12/02/2014 in all areas
-
ASM_ButtonHover.zip ASM_ButtonHover.au3 #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <SendMessage.au3> Global $PointerSize = DllStructGetSize(DllStructCreate("PTR")) ,$ControlThread = DllStructCreate("INT TA;INT TB;INT TC") Global $User32Dll = _WinAPI_LoadLibrary("User32.dll"),$AsmVar = DllStructCreate("INT LOOP;PTR PtrAtPos;HWND CurrentHwnd") Global $StructButtonHover =0 ,$StructBHover =DllStructCreate("INT COUNT;PTR BHOVER") , $StructBHSize = DllStructGetSize _ ( DllStructCreate( "HWND HWNDA; HWND HWNDB; INT TPRESS; INT THOVER;PTR NORMAL;PTR OVER;PTR PRESS;INT MSGLOG" )) Global $Kernel32dll = _WinAPI_LoadLibrary( "Kernel32.dll" ) , $StructBHoverPtr = DllStructGetPtr( $StructBHover ) Global $_GtPt=_WinAPI_GetProcAddress($User32Dll,"GetParent"),$_WnFPos=_WinAPI_GetProcAddress($User32Dll,"WindowFromPoint") Global $SdMsg =_WinAPI_GetProcAddress($User32Dll,"SendMessageW"),$RiWin =_WinAPI_GetProcAddress($User32Dll,"RedrawWindow") Global $G_CP =_WinAPI_GetProcAddress($User32Dll,"GetCursorPos"),$GKYState=_WinAPI_GetProcAddress($User32Dll,"GetKeyState") Global $Sleep =_WinAPI_GetProcAddress($Kernel32dll,"Sleep") ,$PositionsSt = DllStructCreate("INT POS[2]") , $ThreadPtr = 0 Global $NewStructButtonHover= 0,$PositionsStPtr= DllStructGetPtr($PositionsSt),$IsPss = LIsPress(),$IsNPss = LIsNotPress() Global $IsPssPtr = DllStructGetPtr($IsPss) , $IsNPssPtr = DllStructGetPtr($IsNPss),$MHover = LMHover(),$MNHover=LMNHover() Global $MHoverPtr = DllStructGetPtr( $MHover ) , $MNHoverPtr = DllStructGetPtr( $MNHover ) , $ThreadAdd = LoadThread( ) Func CreateButtonHover($Text,$L,$T,$W,$H,$NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,$TEXTCOLOOR = 0,$Font = True) Local $tagButtonHover = "HWND HWNDA;HWND HWNDB;INT TPRESS;INT THOVER;PTR NORMAL;PTR OVER;PTR PRESS;INT MSGLOG" Local $STM_SETIMAGE_HOVER = 0x0172 , $SS_BITMAP_HOVER = 0x0000000E _ , $SS_REALSIZECONTROL_HOVER = 0x00000040 , $STN_CLICKED = 0 $controlID1 = GUICtrlCreateLabel("",$L,$T,$W,$H,BitOR($SS_REALSIZECONTROL_HOVER,$SS_BITMAP_HOVER)) if @error Then Return SetError(1,0,0) GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) $hWndA = GUICtrlGetHandle($controlID1) $controlID2 = GUICtrlCreateLabel($Text,$L,$T,$W,$H,BitOR($SS_CENTERIMAGE,$SS_CENTER)) if @error Then GUICtrlDelete($controlID1) Return SetError(2,0,0) EndIf $hWndB = GUICtrlGetHandle($controlID2) $MSGLOG = _WinAPI_MakeLong($controlID2,$STN_CLICKED) GUICtrlSetBkColor ( -1 , $GUI_BKCOLOR_TRANSPARENT) if ($TEXTCOLOOR) Then GUICtrlSetColor(-1,$TEXTCOLOOR) if ($Font) Then GUICtrlSetFont(-1,(($H) / 2) - 1,600,0,"Arial") if Not(DllStructGetData($StructBHover,"COUNT")) Then $StructButtonHover = DllStructCreate($tagButtonHover) DllStructSetData($StructButtonHover,"NORMAL",$NORMAL_hBMP) DllStructSetData($StructButtonHover , "OVER" , $OVER_hBMP) DllStructSetData($StructButtonHover ,"PRESS", $PRESS_hBMP) DllStructSetData($StructButtonHover , "HWNDA" , $hWndA) DllStructSetData($StructButtonHover , "HWNDB" , $hWndB) DllStructSetData($StructButtonHover , "MSGLOG" , $MSGLOG) $ButtonHoverPtr = DllStructGetPtr( $StructButtonHover ) DllStructSetData($StructBHover,"BHOVER",$ButtonHoverPtr) DllStructSetData($StructBHover,"COUNT",1) Else ControlThread(1,True,True) $COUNT = DllStructGetData($StructBHover,"COUNT") $NewtagButtonHover = "BYTE [" & ($COUNT * $StructBHSize) & "];" & $tagButtonHover $NewStructButtonHover = DllStructCreate($NewtagButtonHover) $NewStructButtonHoverPtr = DllStructGetPtr( $NewStructButtonHover ) DllCall("kernel32.dll","none","RtlMoveMemory","ptr", $NewStructButtonHoverPtr, _ "ptr",DllStructGetPtr($StructButtonHover),"ulong_ptr",($COUNT * $StructBHSize)) DllStructSetData($NewStructButtonHover,"NORMAL",$NORMAL_hBMP) DllStructSetData($NewStructButtonHover , "OVER" , $OVER_hBMP) DllStructSetData($NewStructButtonHover ,"PRESS", $PRESS_hBMP) DllStructSetData($NewStructButtonHover , "HWNDA" , $hWndA) DllStructSetData($NewStructButtonHover , "HWNDB" , $hWndB) DllStructSetData($NewStructButtonHover , "MSGLOG" , $MSGLOG) DllStructSetData($StructBHover,"BHOVER",$NewStructButtonHoverPtr) DllStructSetData($StructBHover,"COUNT",$COUNT + 1) $StructButtonHover = $NewStructButtonHover $NewStructButtonHover = 0 ControlThread(1,False) EndIf _SendMessage($hWndA,$STM_SETIMAGE_HOVER,0,$NORMAL_hBMP) if Not($ThreadPtr) Then $ThreadPtr = DllStructGetPtr($ThreadAdd) CreateThread($ThreadPtr,0) EndIf Return SetError (0,$controlID1,$controlID2) EndFunc Func LoadThread() Local $IntSize = DllStructGetSize(DllStructCreate("INT")) ,$JZEnd , $JZTA ,$CThread Local $OffSelpParameter = $PointerSize,$LOOPA,$End,$TA,$OffSetHwndA = 0,$TB,$JMPEND Local $JZEnd , $JMPTB , $LOOPB , $AsmVarPtr = DllStructGetPtr($AsmVar) , $JZCThread For $i = 1 To 2 $_ASMCode = "0x" $LOOPA = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary(3) ;mov eax,3 // 3 Milliseconds $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($Sleep) ;mov eax,$Sleep $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "BF" & HexBinary($AsmVarPtr) ;mov edi,$AsmVarPtr $_ASMCode &= "BB" & HexBinary($StructBHoverPtr) ;mov ebx,$StructBHoverPtr $_ASMCode &= "8B13" ;mov edx,[ebx] $_ASMCode &= "8917" ;mov [edi],edx $_ASMCode &= "8B5B" & Hex($IntSize,2) ;mov ebx,[ebx + $IntSize] $_ASMCode &= "895F" & Hex($IntSize,2) ;mov [edi + $IntSize],ebx $_ASMCode &= "B8" & HexBinary($PositionsStPtr) ;mov eax,$PositionsStPtr $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($G_CP) ;mov eax,GetCursorPos $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "B8" & HexBinary($PositionsStPtr) ;mov eax,$PositionsStPtr $_ASMCode &= "FF70" & Hex($IntSize,2) ;push [eax + $IntSize] $_ASMCode &= "FF30" ;push [eax] $_ASMCode &= "B8" & HexBinary($_WnFPos) ;mov eax,WindowFromPoint $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "8947" & Hex(($IntSize + $PointerSize),2) ;mov [edi + ($IntSize + $PointerSize)],eax $LOOPB = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary($AsmVarPtr) ;mov eax,$AsmVarPtr $_ASMCode &= "8038" & Hex(0,2) ;CMP [eax],0 $_ASMCode &= "74" & Hex(($End - $JZEnd),2) ;JZ $End; $JZEnd = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary($AsmVarPtr) ;mov eax,$AsmVarPtr $_ASMCode &= "8B58" & Hex($IntSize,2) ;mov ebx,[eax + $IntSize] $_ASMCode &= "8B3B" ;mov edi,[ebx] ; // Get HWNDA $_ASMCode &= "8B40" & Hex(($IntSize + $PointerSize),2) ;mov eax,[eax + ($IntSize + $PointerSize)] // Get CurrentHwnd $_ASMCode &= "3BF8" ;CMP edi,eax $_ASMCode &= "74" & Hex(($TA - $JZTA),2) ;JZ $JZTA; $JZTA = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary($AsmVarPtr) ;mov eax,$AsmVarPtr $_ASMCode &= "8B58" & Hex($IntSize,2) ;mov ebx,[eax + $IntSize] $_ASMCode &= "53" ;push ebx $_ASMCode &= "B8" & HexBinary($MNHoverPtr) ;mov eax,$MNHoverPtr $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "EB" & Hex(($TB - $JMPTB),2) ;JMP $TB $JMPTB = BinaryLen($_ASMCode) $TA = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary($AsmVarPtr) ;mov eax,$AsmVarPtr $_ASMCode &= "8B58" & Hex($IntSize,2) ;mov ebx,[eax + $IntSize] $_ASMCode &= "53" ;push ebx $_ASMCode &= "B8" & HexBinary($MHoverPtr) ;mov eax,$MHoverPtr $_ASMCode &= "FFD0" ;call eax $TB = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary($AsmVarPtr) ;mov eax,$AsmVarPtr $_ASMCode &= "8028" & Hex(1,2) ;sub [eax],1 $_ASMCode &= "8B58" & Hex($IntSize,2) ;mov ebx,[eax + $IntSize] $_ASMCode &= "83C3" & Hex($StructBHSize,2) ;add ebx,$StructBHSize $_ASMCode &= "8958" & Hex($IntSize,2) ;mov [eax + $IntSize],ebx $JMPLOOPB = BinaryLen($_ASMCode) $_ASMCode &= "E9" & HexBinary(-(($JMPLOOPB - $LOOPB) + 5)) ;JMP $LOOPB $End = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary(DllStructGetPtr($ControlThread)) ;mov eax,$ControlThread $_ASMCode &= "8038" & Hex(1,2) ;CMP [eax],1 $_ASMCode &= "74" & Hex(($CThread - $JZCThread),2) ;JZ $CThread $JZCThread = BinaryLen($_ASMCode) $JMPLOOPA = BinaryLen($_ASMCode) $_ASMCode &= "E9" & HexBinary(-(($JMPLOOPA - $LOOPA) + 5)) ;JMP LOOPA $CThread = BinaryLen($_ASMCode) $_ASMCode &= "C640" & Hex($IntSize,2) & Hex(1,2) ;mov [eax + $IntSize],1 $_ASMCode &= "B8" & HexBinary(3) ;mov eax,3 // 3 Milliseconds $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($Sleep) ;mov eax,$Sleep $_ASMCode &= "FFD0" ;call eax $JMPEND = BinaryLen($_ASMCode) $_ASMCode &= "E9" & HexBinary(-(($JMPEND - $End) + 5)) ;JMP End $_ASMCode &= "C2" & Hex($PointerSize,2) & Hex(0,2) ;ret ($PointerSize) & "00" // Args Size Next $Address = DllStructCreate("byte[" & BinaryLen($_ASMCode) & "]") DllStructSetData($Address,1,$_ASMCode) Return $Address EndFunc Func LMHover() ;Mouse Hover Local $OffSetTpress = DllStructGetSize( DllStructCreate( "HWND HWNDA;HWND HWNDB" )) Local $TA , $JZTA , $TB , $JMPTB , $OffSetStructBHoverPtr = $PointerSize For $i = 1 To 2 $_ASMCode = "0x" $_ASMCode &= "B8" & HexBinary(0x01) ;mov eax,$VK_LBUTTON $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($GKYState) ;mov eax,GetKeyState $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "25" & HexBinary(0x8000) ; and eax,0x8000 // bitwise AND // eax = BitAND(eax,0x8000) $_ASMCode &= "83F8" & Hex(0,2) ;CMP eax,0 $_ASMCode &= "74" & Hex(($TA - $JZTA),2) ;JZ $JZTA; $JZTA = BinaryLen($_ASMCode) $_ASMCode &= "FF7424" & Hex($OffSetStructBHoverPtr,2) ;push [esp + $OffSetStructBHoverPtr] $_ASMCode &= "B8" & HexBinary($IsPssPtr) ;mov eax,$IsPssPtr $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "EB" & Hex(($TB - $JMPTB),2) ;JMP $JMPTD $JMPTB = BinaryLen($_ASMCode) $TA = BinaryLen($_ASMCode) $_ASMCode &= "FF7424" & Hex($OffSetStructBHoverPtr,2) ;push [esp + $OffSetStructBHoverPtr] $_ASMCode &= "B8" & HexBinary($IsNPssPtr) ;mov eax,$IsNPssPtr $_ASMCode &= "FFD0" ;call eax $TB = BinaryLen($_ASMCode) ;------------------------------// Return 0 //----------------------------------------------------------- $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "C2" & Hex($PointerSize,2) & Hex(0,2) ;ret ($PointerSize) & "00" // Args Size ;------------------------------// Return 0 //-------------------------------------------------------- Next $Address = DllStructCreate("byte[" & BinaryLen($_ASMCode) & "]") DllStructSetData($Address,1,$_ASMCode) Return $Address EndFunc Func LIsPress() Local $OffSetPBmp = DllStructGetSize(DllStructCreate( "HWND HWNDA;HWND HWNDB;INT TPRESS;INT THOVER;PTR NORMAL;PTR OVER")) Local $OffSetTpress = DllStructGetSize( DllStructCreate("HWND HWNDA;HWND HWNDB" )) , $OffSetStructBHoverPtr = $PointerSize Local $STM_SETIMAGE_HOVER = 0x0172 , $OffSetThover = DllStructGetSize( DllStructCreate( "HWND HWNDA;HWND HWNDB;INT TPRESS")) Local $OffSetHwndA=0,$OffSetHBmp=DllStructGetSize(DllStructCreate("HWND HWNDA;HWND HWNDB;INT TPRESS;INT THOVER;PTR NORMAL")) Local $TA , $JZTA , $TB , $JZTB , $JMPTC1 , $TC , $JMPTC2 ,$TC,$OffSetHwndB = DllStructGetSize(DllStructCreate("HWND HWNDA")) For $i = 1 To 2 $_ASMCode = "0x" $_ASMCode &= "8B5C24" & Hex($OffSetStructBHoverPtr,2) ;mov ebx,[esp + $OffSetStructBHoverPtr] $_ASMCode &= "8B43" & Hex($OffSetTpress,2) ;mov eax,[ebx + $OffSetTpress] $_ASMCode &= "83F8" & Hex(0,2) ;CMP eax,0 $_ASMCode &= "74" & Hex(($TA - $JZTA),2) ;JZ $JZTA; $JZTA = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffSetThover,2) ;mov eax,[ebx + $OffSetThover] $_ASMCode &= "83F8" & Hex(0,2) ;CMP eax,0 $_ASMCode &= "74" & Hex(($TB - $JZTB),2) ;JZ $JZTB; $JZTB = BinaryLen($_ASMCode) $_ASMCode &= "EB" & Hex(($TC - $JMPTC1),2) ;JMP $JMPTC1 $JMPTC1 = BinaryLen($_ASMCode) $TB = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffSetHBmp,2) ;mov eax,[ebx + $OffSetHBmp] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($STM_SETIMAGE_HOVER) ;mov eax,$STM_SETIMAGE_HOVER $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndA,2) ;mov eax,[ebx + $OffSetHwndA] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($SdMsg) ;mov eax,SendMessageW $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "B8" & HexBinary(BitOR($RDW_INVALIDATE,$RDW_UPDATENOW)) ;mov eax,BitOR($RDW_INVALIDATE,$RDW_UPDATENOW) $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndB,2) ;mov eax,[ebx + $OffSetHwndB] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($RiWin) ;mov eax,RedrawWindow $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "C643" & Hex($OffSetThover,2) & Hex(1,2) ;mov [ebx + $OffSetThover],1 $_ASMCode &= "EB" & Hex(($TC - $JMPTC2),2) ;JMP $JMPTC2 $JMPTC2 = BinaryLen($_ASMCode) $TA = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffSetPBmp,2) ;mov eax,[ebx + $OffSetPBmp] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($STM_SETIMAGE_HOVER) ;mov eax,$STM_SETIMAGE_HOVER $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndA,2) ;mov eax,[ebx + $OffSetHwndA] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($SdMsg) ;mov eax,SendMessageW $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "B8" & HexBinary(BitOR($RDW_INVALIDATE,$RDW_UPDATENOW)) ;mov eax,BitOR($RDW_INVALIDATE,$RDW_UPDATENOW) $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndB,2) ;mov eax,[ebx + $OffSetHwndB] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($RiWin) ;mov eax,RedrawWindow $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "C643" & Hex($OffSetTpress,2) & Hex(1,2) ;mov [ebx + $OffSetTpress],1 $TC = BinaryLen($_ASMCode) ;------------------------------// Return 0 //----------------------------------------------------------- $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "C2" & Hex($PointerSize,2) & Hex(0,2) ;ret ($PointerSize) & "00" // Args Size ;------------------------------// Return 0 //----------------------------------------------------------- Next $Address = DllStructCreate("byte[" & BinaryLen($_ASMCode) & "]") DllStructSetData($Address,1,$_ASMCode) Return $Address EndFunc Func LIsNotPress() Local $OffSetPBmp = DllStructGetSize(DllStructCreate( "HWND HWNDA;HWND HWNDB;INT TPRESS;INT THOVER;PTR NORMAL;PTR OVER")) Local $OffSetTpress = DllStructGetSize( DllStructCreate("HWND HWNDA;HWND HWNDB" ) ) , $OffSetStructBHoverPtr = $PointerSize Local $STM_SETIMAGE_HOVER=0x0172,$OffSetThover=DllStructGetSize(DllStructCreate("HWND HWNDA;HWND HWNDB;INT TPRESS")),$SSenMsg Local $OffSetHwndB=DllStructGetSize(DllStructCreate("HWND HWNDA")),$OffSetHBmp =DllStructGetSize(DllStructCreate("HWND HWNDA" & _ ";HWND HWNDB;INT TPRESS;INT THOVER;PTR NORMAL")),$OffsetMsgLog = DllStructGetSize(DllStructCreate("HWND HWNDA;HWND HWNDB;INT" & _ " TPRESS;INT THOVER;PTR NORMAL;PTR OVER;PTR PRESS")),$OffSetHwndA = 0 ,$TA,$JZTA,$JMPTB,$TB,$JZTC,$TC,$TD,$JZTD,$JZStopSendMsg Local $IntSize = DllStructGetSize(DllStructCreate("INT")) For $i = 1 To 2 $_ASMCode = "0x" $_ASMCode &= "8B5C24" & Hex($OffSetStructBHoverPtr,2) ;mov ebx,[esp + $OffSetStructBHoverPtr] $_ASMCode &= "8B43" & Hex($OffSetTpress,2) ;mov eax,[ebx + $OffSetTpress] $_ASMCode &= "83F8" & Hex(1,2) ;CMP eax,1 $_ASMCode &= "74" & Hex(($TA - $JZTA),2) ;JZ $JZTA; $JZTA = BinaryLen($_ASMCode) $_ASMCode &= "EB" & Hex(($TB - $JMPTB),2) ;JMP $JMPTB $JMPTB = BinaryLen($_ASMCode) $TA = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary(DllStructGetPtr($ControlThread)) ;mov eax,$ControlThread $_ASMCode &= "8078" & Hex(($IntSize * 2),2) & Hex(1,2) ;CMP [eax + ($IntSize * 2)],1 $_ASMCode &= "74" & Hex(($SSenMsg - $JZStopSendMsg),2) ;JZ $StopSendMsg $JZStopSendMsg = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffSetHwndB,2) ;mov eax,[ebx + $OffSetHwndB] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($_GtPt) ;mov eax,GetParent $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "8BF8" ;mov edi,eax $_ASMCode &= "8B43" & Hex($OffSetHwndB,2) ;mov eax,[ebx + $OffSetHwndB] $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffsetMsgLog,2) ;mov eax,[ebx + $OffsetMsgLog] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($WM_COMMAND) ;mov eax,$WM_COMMAND $_ASMCode &= "50" ;push eax $_ASMCode &= "57" ;push edi $_ASMCode &= "B8" & HexBinary($SdMsg) ;mov eax,SendMessageW $_ASMCode &= "FFD0" ;call eax $SSenMsg = BinaryLen($_ASMCode) ; StopSendMsg $_ASMCode &= "C643" & Hex($OffSetThover,2) & Hex(0,2) ;mov [ebx + $OffSetThover],0 $_ASMCode &= "C643" & Hex($OffSetTpress,2) & Hex(0,2) ;mov [ebx + $OffSetTpress],0 $TB = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffSetThover,2) ;mov eax,[ebx + $OffSetThover] $_ASMCode &= "83F8" & Hex(1,2) ;CMP eax,1 $_ASMCode &= "74" & Hex(($TC - $JZTC),2) ;JZ $JZTC; $JZTC = BinaryLen($_ASMCode) $_ASMCode &= "C643" & Hex($OffSetThover,2) & Hex(1,2) ;mov [ebx + $OffSetThover],1 $_ASMCode &= "8B43" & Hex($OffSetHBmp,2) ;mov eax,[ebx + $OffSetHBmp] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($STM_SETIMAGE_HOVER) ;mov eax,$STM_SETIMAGE_HOVER $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndA,2) ;mov eax,[ebx + $OffSetHwndA] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($SdMsg) ;mov eax,SendMessageW $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "B8" & HexBinary(BitOR($RDW_INVALIDATE,$RDW_UPDATENOW)) ;mov eax,BitOR($RDW_INVALIDATE,$RDW_UPDATENOW) $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndB,2) ;mov eax,[ebx + $OffSetHwndB] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($RiWin) ;mov eax,RedrawWindow $_ASMCode &= "FFD0" ;call eax $TC = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffSetTpress,2) ;mov eax,[ebx + $OffSetTpress] $_ASMCode &= "83F8" & Hex(3,2) ;CMP eax,3 $_ASMCode &= "74" & Hex(($TD - $JZTD),2) ;JZ $JZTD; $JZTD = BinaryLen($_ASMCode) ;------------------------------// Return 0 //----------------------------------------------------------- $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "C2" & Hex($PointerSize,2) & Hex(0,2) ;ret ($PointerSize) & "00" // Args Size ;------------------------------// Return 0 //----------------------------------------------------------- $TD = BinaryLen($_ASMCode) $_ASMCode &= "C643" & Hex($OffSetTpress,2) & Hex(0,2) ;mov [ebx + $OffSetTpress],0 ;------------------------------// Return 0 //----------------------------------------------------------- $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "C2" & Hex($PointerSize,2) & Hex(0,2) ;ret ($PointerSize) & "00" // Args Size ;------------------------------// Return 0 //----------------------------------------------------------- Next $Address = DllStructCreate("byte[" & BinaryLen($_ASMCode) & "]") DllStructSetData($Address,1,$_ASMCode) Return $Address EndFunc Func LMNHover() ;Mouse Not Hover Local $OffSetNBmp = DllStructGetSize( DllStructCreate( "HWND HWNDA;HWND HWNDB;INT TPRESS;INT THOVER" )) Local $OffSetThover = DllStructGetSize( DllStructCreate("HWND HWNDA;HWND HWNDB;INT TPRESS")) , $OffSetHwndA = 0 Local $OffSetTpress = DllStructGetSize(DllStructCreate("HWND HWNDA;HWND HWNDB")) , $STM_SETIMAGE_HOVER = 0x0172 Local $OffSetStructBHoverPtr = $PointerSize , $TA , $JZTA , $TB , $JZTB , $TC , $JMPTC Local $OffSetHwndB = DllStructGetSize(DllStructCreate("HWND HWNDA")) For $i = 1 To 2 $_ASMCode = "0x" $_ASMCode &= "8B5C24" & Hex($OffSetStructBHoverPtr,2) ;mov ebx,[esp + $OffSetStructBHoverPtr] $_ASMCode &= "8B43" & Hex($OffSetThover,2) ;mov eax,[ebx + $OffSetThover] $_ASMCode &= "83F8" & Hex(0,2) ;CMP eax,0 $_ASMCode &= "74" & Hex(($TA - $JZTA),2) ;JZ $JZTA; $JZTA = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffSetNBmp,2) ;mov eax,[ebx + $OffSetNBmp] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($STM_SETIMAGE_HOVER) ;mov eax,$STM_SETIMAGE_HOVER $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndA,2) ;mov eax,[ebx + $OffSetHwndA] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($SdMsg) ;mov eax,SendMessageW $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "B8" & HexBinary(BitOR($RDW_INVALIDATE,$RDW_UPDATENOW)) ;mov eax,BitOR($RDW_INVALIDATE,$RDW_UPDATENOW) $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndB,2) ;mov eax,[ebx + $OffSetHwndB] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($RiWin) ;mov eax,RedrawWindow $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "C643" & Hex($OffSetThover,2) & Hex(0,2) ;mov [ebx + $OffSetThover],0 $TA = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary(0x01) ;mov eax,$VK_LBUTTON $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($GKYState) ;mov eax,GetKeyState $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "25" & HexBinary(0x8000) ; and eax,0x8000 // bitwise AND // eax = BitAND(eax,0x8000) $_ASMCode &= "83F8" & Hex(0,2) ;CMP eax,0 $_ASMCode &= "74" & Hex(($TB - $JZTB),2) ;JZ $JZTB; $JZTB = BinaryLen($_ASMCode) $_ASMCode &= "C643" & Hex($OffSetTpress,2) & Hex(3,2) ;mov [ebx + $OffSetTpress],3 ;------------------------------// Return 0 //----------------------------------------------------------- $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "C2" & Hex($PointerSize,2) & Hex(0,2) ;ret ($PointerSize) & "00" // Args Size ;------------------------------// Return 0 //----------------------------------------------------------- $TB = BinaryLen($_ASMCode) $_ASMCode &= "C643" & Hex($OffSetTpress,2) & Hex(0,2) ;mov [ebx + $OffSetTpress],0 ;------------------------------// Return 0 //----------------------------------------------------------- $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "C2" & Hex($PointerSize,2) & Hex(0,2) ;ret ($PointerSize) & "00" // Args Size ;------------------------------// Return 0 //----------------------------------------------------------- Next $Address = DllStructCreate("byte[" & BinaryLen($_ASMCode) & "]") DllStructSetData($Address,1,$_ASMCode) Return $Address EndFunc Func ControlThread($Flag = 1,$BOOL = True , $Wait = False) ; $Flag = 1 Continue Thread Loop // $BOOL = True Or $BOOL = False ; $Flag = 2 Stop Msg Send // // $BOOL = True Or $BOOL = False ; $Wait True Or False Wait Start Continue Of Thread Loop Switch $Flag Case 1 DllStructSetData($ControlThread, "TA" , 0 ) DllStructSetData($ControlThread, "TB" , 0 ) if ($BOOL) Then DllStructSetData($ControlThread, "TA" , 1 ) if ($Wait) Then While DllStructGetData($ControlThread,"TB") == 0 WEnd Return True Else Return True EndIf Else DllStructSetData($ControlThread, "TA" , 0 ) DllStructSetData($ControlThread, "TB" , 0 ) Return True EndIf Case 2 if ($BOOL) Then DllStructSetData($ControlThread, "TC" , 1 ) Else DllStructSetData($ControlThread, "TC" , 0 ) EndIf Return True Case Else Return False EndSwitch EndFunc Func HexBinary($Value) Return Hex(Binary($Value)) EndFunc Func CreateThread($lpStartAddress,$lpParameter) Local $HANDLE = DllCall("Kernel32.dll","ptr","CreateThread","ptr",0,"int",0,"ptr", _ $lpStartAddress,"ptr",$lpParameter,"DWORD",0,"DWORD*",0) if @error Or $HANDLE[0] = 0 Then Return SetError(1,0,0) Return SetError(0,0,$HANDLE[0]) EndFunc Func LoadBitmap_FromFile($sFileName) Return _WinAPI_LoadImage(_WinAPI_GetModuleHandle(0),$sFileName,0 ,0,0,0x0010) EndFunc Func LoadBitmap_FromResources($resource_Name) Return _WinAPI_LoadBitmap(_WinAPI_GetModuleHandle(0), $resource_Name) EndFunc ButtonHover_Example1.au3 #include <ASM_ButtonHover.au3> $NORMAL_hBMP = LoadBitmap_FromFile("NORMAL1.bmp") $PRESS_hBMP = LoadBitmap_FromFile("PRESS1.bmp") $OVER_hBMP = LoadBitmap_FromFile("OVER1.bmp") $TEXTCOLOOR = 0xFFFFFF $GUI = GUICreate("ASM_ButtonHover") $Button_SM = CreateButtonHover ("Small", 180, 80, 70, 15,$NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,$TEXTCOLOOR) GUICtrlSetFont(-1, 8, 800, 0, "Arial") $Button_ME = CreateButtonHover ("Medium", 180, 120, 90, 30,$NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,$TEXTCOLOOR) GUICtrlSetFont(-1, 12, 800, 0, "Arial") $Button_LO = CreateButtonHover ("Long", 180, 180, 190, 30,$NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,$TEXTCOLOOR) GUICtrlSetFont(-1, 16, 800, 0, "Arial") $Button_LA = CreateButtonHover ("Large", 180, 240, 190, 60, $NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,$TEXTCOLOOR) GUICtrlSetFont(-1, 20, 800, 0, "Arial") GUISetState(@SW_SHOW) While 1 $MSG = GUIGetMsg() StopSendMsg(True) Switch $MSG Case $GUI_EVENT_CLOSE Exit Case $Button_SM MsgBox(0,"MSG","Small Button") Case $Button_ME MsgBox(0,"MSG","Medium Button") Case $Button_LO MsgBox(0,"MSG","Long Button") Case $Button_LA MsgBox(0,"MSG","Large Button") EndSwitch StopSendMsg(False) WEnd Func StopSendMsg($BOOL) ControlThread(2,$BOOL) EndFunc ButtonHover_Example2.au3 #include <ASM_ButtonHover.au3> $NORMAL_hBMP = LoadBitmap_FromFile("NORMAL1.bmp") $PRESS_hBMP = LoadBitmap_FromFile("PRESS1.bmp") $OVER_hBMP = LoadBitmap_FromFile("OVER1.bmp") $TEXTCOLOOR = 0xFFFFFF $GUI = GUICreate("ASM_ButtonHover") $Button_SM = CreateButtonHover ("Small", 180, 80, 70, 15,$NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,$TEXTCOLOOR) GUICtrlSetFont(-1, 8, 800, 0, "Arial") $Button_ME = CreateButtonHover ("Medium", 180, 120, 90, 30,$NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,$TEXTCOLOOR) GUICtrlSetFont(-1, 12, 800, 0, "Arial") $Button_LO = CreateButtonHover ("Long", 180, 180, 190, 30,$NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,$TEXTCOLOOR) GUICtrlSetFont(-1, 16, 800, 0, "Arial") $Button_LA = CreateButtonHover ("Large", 180, 240, 190, 60, $NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,$TEXTCOLOOR) GUICtrlSetFont(-1, 20, 800, 0, "Arial") GUISetState(@SW_SHOW) While 1 $MSG = GUIGetMsg() Switch $MSG Case $GUI_EVENT_CLOSE Exit Case $Button_SM MsgBox(0,"MSG","Small Button") Case $Button_ME MsgBox(0,"MSG","Medium Button") Case $Button_LO MsgBox(0,"MSG","Long Button") Case $Button_LA MsgBox(0,"MSG","Large Button") EndSwitch WEnd1 point
-
Reading INI With Possible Multiple Data
Elephant007 reacted to jguinch for a topic
You can use a separator and put the list of printers in the same line : [Printers] 001117=\\Server\Printer01;\\Server\Printer02 Now, you just have to split the string (with StringSplit for example...)1 point -
Last post processed: #21 Hiho Community, "A dynamic-link library (DLL) is a module that contains functions and data that can be used by another module (application or DLL)." The purpose of this thread is to create a link-list to useful 3rd party / non standard DLL and machine code libraries* and their usage in AutoIt with examples or UDF wrappers. I'll just start with what I use and know of. If you've got additions feel free to post them here and I will integrate them into this first posting. * I decided to add some few pure AutoIt UDFs, as they seem to be powerful enough to be mentioned here ... DLL Collection Thread 01. - AutoIt AutoItObject Use an OOP-like syntax in your scripts and access many COM-Interfaces exposed from the Windows-API. Embed DLLs in script and call functions from memory Pure AutoIt Script (now working under Vista) Hook into a 32bit process WM-Queue Using Hook.dll NomadMemory Reading from and writing to memory ResHacker project Written in AutoIt Resources UDF Embed/use any data/files into/from AutoIt compiled EXE files ScriptOMatic WMI ScriptOMatic tool for AutoIt WinAPIEx UDF WinAPI Extended UDF Library for AutoIt3 02. - Compression & Encryption 7Zip UDF Over 27 functions regarding 7Zip archives Advanced Encryption Standard (AES/Rijndael) UDF Support ECB/CBC/CFB/OFB block chiper mode MD5,SHA1,CRC32,RC4,BASE64,XXTEA machine code version Pure AutoIt Script and runs very fast RSA-Encryption-Plugin Open source C++ code UnRAR.au3 UDF for unpacking *.rar archives Zip32 UDF For working with zip archives (7Zip is recommended) 03. - Data & Document Management Artificial Neural Network UDF Using the Fannfloat (Fast Artificial Neural Network) library Bayesian Networks UDF Create a graphical model of a system or problem and get intelligent results from it, making predictions, inferences, or assumptions based on available evidence, formulas, and probabilities. EzMySql UDF Use MySql Databases with autoit MySql in Autoit with Syntax similar to SQLite UDF (for a more comprehensive MySql UDF see MySQL UDF) MySQL UDF Without ODBC, uses libmysql.dll SQLite Accessing SQLite databases from Autoit, Standard UDF XML DOM wrapper (COM) COM XML wrapper for DOM 04. - File System & Processing Active Directory UDF Functions for accessing and manipulating Microsoft Active Directory TrIDLib Identify file types from their binary signatures 05. - Graphics Au3GlPlugin T2 OpenGL Plugin Evolution Au3Irrlicht 2.0 AutoIt plugin wrapper around the object oriented 3D library called Irrlicht Bitmap Library Simple Bitmap managment without DLLs DirectShow UDF UDF part of AAA Player FreeImage Library 180 Functions Image Search Library Searches a region of the screen for an image Prospeed UDF Realtime Image effect's , sprite management , joystick and mouse support and directX sound Tesseract (Screen OCR) UDF Recognise the text in windows, controls and the desktop 06. - GUI HTMLayout DLL UDF Rendering HTML in AutoIt TaskDialog Opens a native TaskDialog on Vista and a remade one on older Systems with help of the DLL from XTaskDialog Sciter Dll UDF GUIHtml in AutoIt 07. - Hardware Control Vista Master Volume Plugin + OSD Volume Script SDL UDF Joysticks, CDs, 2D Graphics, Timers etc VCTemp View CPU core temp values over the network using dll api WinLock.Dll Block taskmanager or CTRL-ALT-DEL 08. - Internet WinINet.au3 (FTP/HTTP/HTTPS/Gopher+) Wrapper functions around pure WinINet calls WinPcap Autoit3 UDF Access the main functionalities offered by the WinPcap driver: capture, filter, save/read and send data packets on a network interface (Network Sniffer) WinHTTP functions GET, POST using Winhttp.dll 09. - Media BASS Function Library (Sound and Music Functions) Wrapper for Bass, BassEnc, Bass FX, BassSFX, BassAsio and BassCd DLLs BASSMOD BASSMOD is a MOD only (XM, IT, S3M, MOD, MTM, UMX) version of BASS, just 34% of it's size MP3 ID3V1/V2 Reading and writing using AudioGenie3.dll MediaInfo DLL Calls Some examples for correct calls to MediaInfo.dll 10. - Output Create PDF from your application With embeded ActiveX DLL Hunspell Spelling, thesaurus & hyphenation checker for AutoIt using Dlls from the NHunspell-Project. Works with OpenOffice dictionaries. Printing using UDF and a DLL Useful for graphs, forms, labels etc. RMChart - GDI+ Chart-Control AutoIt-UDFs for the RMChart-Control by Rainer Morgen. The DLL can display really pretty Charts like bar charts, line charts or pie charts.1 point
-
iF win7 iF win8
ahmeddzcom reacted to JLogan3o13 for a topic
Or use a switch statement: Switch @OSVersion Case "WIN_8.1" ;do something for WIN 8.1 Case "WIN_8" ;do something for WIN 8 Case "WIN_7" ;do something for WIN 7 Case "WIN_Vista" ;do something for Vista Case "WIN_XP" ;do something for XP EndSwitch The benefit to doing it this way is if you want to have one function that covers multiple circumstances. For example, if you want your script to do one thing if the OS is below Windows 8, you could do something like this: Switch @OSVersion Case "WIN_8.1" ;do something for WIN 8.1 Case "WIN_8" ;do something for WIN 8 Case "WIN_7", "WIN_Vista", "WIN_XP" ;do something for OS prior to Windows 8 EndSwitch1 point -
Here's my latest rendition of FF.au3, which I'm calling b14. This takes the most recent updates from Stilgar and applies the following updates: V0.6.0.1b-14 (by Danp2) - Changed: _FFWindowOpen to allow private browsing - Changed: _FFWindowGetHandle to improve functionality - Fixed: _FFTableWriteToArray - Fixed: __FFStartProcess - Fixed: __FFWaitForRepl Let me know if you run into any issues with this update. Happy Thanksgiving! Dan FF V0.6.0.1b-14.au31 point
-
Do what Dale said, or maybe try this... I think this may work, but it's not well tested. #include <IE.au3> Global $go_IE = _IEAttach("https://www.google.com/?gws_rd=ssl", "url") Global $go_GB70 = _IEGetObjById($go_IE, "gb_70") ; be sure to load your window before running, maybe winactivate or something _IE_ClickElemObjByXY($go_GB70) Func _IE_ClickElemObjByXY(ByRef $o_obj, $n_x = Default, $n_y = Default) If Not IsObj($o_obj) Then Return SetError(1, 0, 0) EndIf #cs ; saved for later Local $o_bodyrect = Execute("$o_obj.document.body.getBoundingClientRect()") If Not IsObj($o_bodyrect) Then Return SetError(2, 0, 0) EndIf Local $a_bodyrect[4] = [ _ Number($o_bodyrect.left), _ ; xpos Number($o_bodyrect.top), _ ; ypos Number($o_bodyrect.right) - Number($o_bodyrect.left), _ ; width Number($o_bodyrect.bottom) - Number($o_bodyrect.top)] ; height #ce ; saved for later Local $o_elemrect = Execute("$o_obj.getBoundingClientRect()") If Not IsObj($o_elemrect) Then Return SetError(3, 0, 0) EndIf Local $a_elemrect[4] = [ _ Number($o_elemrect.left), _ ; xpos Number($o_elemrect.top), _ ; ypos Number($o_elemrect.right) - Number($o_elemrect.left), _ ; width Number($o_elemrect.bottom) - Number($o_elemrect.top)] ; height ; we'll make default center $n_x = ($n_x = Default) ? $a_elemrect[0] + Int($a_elemrect[2] / 2) : $n_x + $a_elemrect[0] $n_y = ($n_y = Default) ? $a_elemrect[1] + Int($a_elemrect[3] / 2) : $n_y + $a_elemrect[1] ; I'll leave error checking here for others Execute("$o_obj.document.elementFromPoint($n_x, $n_y).click()") EndFunc1 point