ceci est mon premier post dans le forum. Je suis nouveau à Autoit mais depuis quelques semaines/mois j'utilise Autoit pour automatiser l'installation de logiciel et la résolution de léger problème. Depuis le début je parcours l'aide Autoit et le forum Français et Anglais pour me dépanner.
Pour vous remercier j'aimerais vous offrir mon premier script à caractère purement ludique.

Si vous avez des questions ou des commentaires vous êtes la bienvenue.
Merci

[spoiler=Script Function:
Mimic Microsoft Intelimouse ZOOM option
Utilisation:
Map a key of your mouse to send (MAJ + ALT + M) (use your mouse driver software)
press that key to activate magnify
press and hold, then scroll the wheel to zoom in and out
press the key to exit magnify]
Code : Tout sélectionner
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.6.1
Author: (MC2)
Script Function:
Mimic Microsoft Intelimouse ZOOM option
Utilisation:
Map a key of your mouse to send (MAJ + ALT + M) (use your mouse driver software)
press that key to activate magnify
press and hold, then scroll the wheel to zoom in and out
press the key to exit magnify
Tested with Windows 7 Ultimate and Logitech M705 mouse with SetPoint 6.30.41 ; driver 5.30.67
Credit :
Great thanks to GaryFrost for that post :
http://www.autoitscript.com/forum/topic/14353-new-mouse-controls-needed/page__view__findpost__p__383523
See http://msdn2.microsoft.com/en-us/library/ms645617.aspx for more info on WM_MOUSEWHEEL
#ce ----------------------------------------------------------------------------
#include <Misc.au3>
#include <GUIConstants.au3>
Global Const $tagTRACKMOUSEEVENT = "dword Size;dword Flags;hwnd hWndTrack;dword HoverTime"
Global Const $WM_MOUSEWHEEL = 0x020A
Global Const $TME_HOVER = 0x1
Global Const $HOVER_DEFAULT = 0xFFFFFFFF
Global $WheelDirection, $wheelActivation, $AlreadyProcessingMagnify
$hGui = GUICreate("Magnify MC2", 20,20,0,0)
$LabelId = GUICtrlCreateLabel("Wheel", 0, 0, 20, 20)
GUISetState(@SW_HIDE)
$hDLL = DllOpen("user32.dll")
OnAutoItExitRegister("sortie")
HotKeySet ("+!m", "Magnify") ; (MAJ + ALT + M)
GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL")
If Not _TrackMouseEvent() Then Exit
While 1
$MsgId = GUIGetMsg()
If $MsgId = $GUI_EVENT_CLOSE Then
EXIT
EndIf
WEnd
; MAJ (10) + ALT (12) + M (4D)
Func Magnify ()
if $AlreadyProcessingMagnify = 0 Then
$AlreadyProcessingMagnify = 1
if ProcessExists ( "magnify.exe" ) Then
GUISetState(@SW_SHOW)
$wheelActivation = 0
WHILE _IsPressed("4D",$hDLL)
$WheelDirection = 0
$MsgId = GUIGetMsg()
IF $WheelDirection > 0 Then
$wheelActivation = 1
ZoomIN()
Else
IF $WheelDirection < 0 Then
$wheelActivation = 1
ZoomOut()
EndIf
EndIf
wend
GUISetState(@SW_HIDE)
if $wheelActivation = 0 Then
ExitMagnifier ()
EndIf
Else
ZoomIn ()
EndIf
$AlreadyProcessingMagnify = 0
EndIf
EndFunc
func sortie()
DllClose($hDLL)
endfunc
func ZoomIn ()
send ("{LWINDOWN}{NUMPADADD}{LWINUP}")
EndFunc
func ExitMagnifier ()
send ("{LWINDOWN}{ESC}{LWINUP}")
EndFunc
func ZoomOut ()
send ("{LWINDOWN}{NUMPADSUB}{LWINUP}")
EndFunc
#cs ----------------------------------------------------------------------------
Mouse Function
#ce ----------------------------------------------------------------------------
Func WM_MOUSEWHEEL($hWndGui, $MsgId, $WParam, $LParam)
$WheelDirection = BitShift($WParam, 16)
GUICtrlSetData ($LabelId,$WheelDirection)
Return 0
EndFunc ;==>WM_MOUSEWHEEL
Func _TrackMouseEvent()
Local $pMouseEvent, $iResult, $iMouseEvent
Local $tMouseEvent = DllStructCreate($tagTRACKMOUSEEVENT)
$iMouseEvent = DllStructGetSize($tMouseEvent)
DllStructSetData($tMouseEvent, "Flags", $TME_HOVER)
DllStructSetData($tMouseEvent, "hWndTrack", $hGui)
DllStructSetData($tMouseEvent, "HoverTime", $HOVER_DEFAULT) ; 400 milliseconds
DllStructSetData($tMouseEvent, "Size", $iMouseEvent)
$ptrMouseEvent = DllStructGetPtr($tMouseEvent)
$iResult = DllCall($hDLL, "int", "TrackMouseEvent", "ptr", $ptrMouseEvent)
Return $iResult[0] <> 0
EndFunc ;==>_TrackMouseEvent