Template:Snippet Header: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 11: | Line 11: | ||
{{ #if: {{{ModifierURL5|}}} | '''[http://www.autoitscript.com/forum/user/{{{ModifierURL5|}}} {{{ModifierName5|}}}]''' }} | {{ #if: {{{ModifierURL5|}}} | '''[http://www.autoitscript.com/forum/user/{{{ModifierURL5|}}} {{{ModifierName5|}}}]''' }} | ||
{{ #if: {{{Desc|}}} | | {{ #if: {{{Desc|}}} | {{{Desc|}}} }} | ||
</blockquote> | </blockquote> | ||
Line 17: | Line 17: | ||
{{ #if: {{{AutoItCode|}}} | {{#tag: syntaxhighlight | {{{AutoItCode}}} | lang="autoit"}} }} | {{ #if: {{{AutoItCode|}}} | {{#tag: syntaxhighlight | {{{AutoItCode}}} | lang="autoit"}} }} | ||
{{ #if: {{{ReturnToTop|}}} | | {{ #if: {{{ReturnToTop|}}} | [[#top | ReturnToContents]] }}<noinclude> | ||
{{Snippet Header | |||
|UDFName=_WinAPI_SwapMouseButton | |||
|AuthorURL=35302-guinness | |||
|AuthorName=guinness | |||
|ReturnToTop=1 | |||
|Desc= | |||
|AutoItCode= | |||
Example() | |||
Func Example() | |||
; Swap the left button to generate right-button messages and vice versa. | |||
ConsoleWrite(_WinAPI_SwapMouseButton(True) & @CRLF) | |||
; Wait for the user to see the changes. | |||
Sleep(10000) | |||
; Change the mouse buttons back to their original meanings. | |||
ConsoleWrite(_WinAPI_SwapMouseButton(False) & @CRLF) | |||
EndFunc ;==>Example | |||
; If $fFlag is True, the left button generates right-button messages and the right button generates left-button messages. | |||
; If $fFlag is False, the buttons are restored to their original meanings. | |||
Func _WinAPI_SwapMouseButton($fFlag) | |||
Local $aReturn = DllCall('user32.dll', 'int', 'SwapMouseButton', 'int', $fFlag) | |||
If @error Then | |||
Return SetError(1, 0, 0) | |||
EndIf | |||
Return $aReturn[0] | |||
EndFunc ;==>_WinAPI_SwapMouseButton | |||
}}</noinclude> |
Revision as of 19:45, 12 November 2012
{{{UDFName}}}
{{{AuthorName}}}
_WinAPI_SwapMouseButton
Author: guinness
Example()
Func Example()
; Swap the left button to generate right-button messages and vice versa.
ConsoleWrite(_WinAPI_SwapMouseButton(True) & @CRLF)
; Wait for the user to see the changes.
Sleep(10000)
; Change the mouse buttons back to their original meanings.
ConsoleWrite(_WinAPI_SwapMouseButton(False) & @CRLF)
EndFunc ;==>Example
; If $fFlag is True, the left button generates right-button messages and the right button generates left-button messages.
; If $fFlag is False, the buttons are restored to their original meanings.
Func _WinAPI_SwapMouseButton($fFlag)
Local $aReturn = DllCall('user32.dll', 'int', 'SwapMouseButton', 'int', $fFlag)
If @error Then
Return SetError(1, 0, 0)
EndIf
Return $aReturn[0]
EndFunc ;==>_WinAPI_SwapMouseButton