Jump to content

Recommended Posts

Posted (edited)

With Beta mouse wheel is working only in one way:

#include <WindowsConstants.au3>
#include <WinAPI.au3>

HotKeySet("{ESC}", "_Exit")

Global $wheel = 100
;~ Global Const $WM_MOUSEWHEEL = 0x020A ;wheel up/down
Global Const $MSLLHOOKSTRUCT = $tagPOINT & ";dword mouseData;dword flags;dword time;ulong_ptr dwExtraInfo"
;Register callback
$hKey_Proc = DllCallbackRegister("_Mouse_Proc", "int", "int;ptr;ptr")
$hM_Module = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0)
$hM_Hook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", $WH_MOUSE_LL, "ptr", DllCallbackGetPtr($hKey_Proc), "hwnd", $hM_Module[0], "dword", 0)


Do
Until Not Sleep(50)


Func _Exit()
    DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hM_Hook[0])
    $hM_Hook[0] = 0
    DllCallbackFree($hKey_Proc)
    $hKey_Proc = 0
    Exit
EndFunc


;http://www.autoitscript.com/forum/index.php?showtopic=81761
Func _Mouse_Proc($nCode, $wParam, $lParam) ;function called for mouse events.. Made by _Kurt
    ;define local vars
    Local $info, $mouseData

    If $nCode < 0 Then ;recommended, see http://msdn.microsoft.com/en-us/library/ms644986(VS.85).aspx
        $ret = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hM_Hook[0], "int", $nCode, "ptr", $wParam, "ptr", $lParam) ;recommended
        Return $ret[0]
    EndIf
    $info = DllStructCreate($MSLLHOOKSTRUCT, $lParam)
    $mouseData = DllStructGetData($info, 3)

    ;Find which event happened
    Select
        Case $wParam = $WM_MOUSEWHEEL
            If _WinAPI_HiWord($mouseData) > 0 Then
                $wheel += 1
            Else
                $wheel -= 1
            EndIf
            ConsoleWrite($wheel & @CRLF)
    EndSelect
    ;This is recommended instead of Return 0
    $ret = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hM_Hook[0], "int", $nCode, "ptr", $wParam, "ptr", $lParam)
    Return $ret[0]
EndFunc ;==>_Mouse_Proc

In v3.3.0.0 is the return of _WinAPI_HiWord($mouseData) is +- 120

In Beta 65416 / 120!

Why is this now different? Is HiWord now returning 64bit instead of 32bit?

Return of $mouseData on wheel movement:

- 00000000FF880000

+ 00780000

...

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted

BitShift has changed:

MsgBox(0, '', BitShift(4287102976, 16))

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Posted

Nutster,

Static is still not resizing arrays: :)

>Running:(3.3.1.5):C:\Program Files\AutoIt3\beta\autoit3.exe "C:\Program Files\AutoIt3\Beta\Examples\Helpfile\Static.au3" 
C:\Program Files\AutoIt3\Beta\Examples\Helpfile\Static.au3 (37) : ==> Cannot make existing variables static.:
Static $Values[$State + 1]
Static ^ ERROR
->12:23:13 AutoIT3.exe ended.rc:1

M23

Static was not changed. We know.
Posted

BitShift has changed:

MsgBox(0, '', BitShift(4287102976, 16))

Please open a bug report. And if it's not asking too much, please try every other number-related functions and see if they are broken, too. My guess is yes, many things are broken.
  • Moderators
Posted

Static was not changed. We know.

Sorry.

Note to self: Read the notes under the first spoiler before posting! :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

BitShift has changed:

MsgBox(0, '', BitShift(4287102976, 16))

I did not look deeply in funktion _WinAPI_HiWord() to see that it is BitShift() :)

Anyway, bug found.

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted

Really ugly temporary hack (you'll go to hell if you use it):

ConsoleWrite(0xFFF & @CRLF)
ConsoleWrite(_BitShift(0xFFFFFFFF, 20) & @CRLF)
ConsoleWrite(0xFFFF & @CRLF)
ConsoleWrite(_BitShift(0xFFFFFFFF, 16) & @CRLF)
ConsoleWrite(0xFFFFF & @CRLF)
ConsoleWrite(_BitShift(0xFFFFFFFF, 12) & @CRLF)

Func _BitShift($iNum, $iShift)
    If ($iShift <= -32) Or ($iShift >= 32) Then Return SetError(1, 0, $iNum)
    If $iShift = 0 Then Return $iNum
    If $iShift < 0 Then
        ; negative shifts seem to work ok
        Return BitShift($iNum, $iShift)
    Else
        ; handle right shifts of negative numbers
        ; the magic: strip sign bit, shift, add back top bit in new position
        If $iNum < 0 Then Return BitOR(BitShift(BitAND($iNum, 0x7FFFFFFF), $iShift), 2 ^ (31 - $iShift))
    EndIf
    Return BitShift($iNum, $iShift)
EndFunc
Posted (edited)

I did not look deeply in funktion _WinAPI_HiWord() to see that it is BitShift() :)

Anyway, bug found.

UEZ

reported. #1285

Checked also BitAnd, BitNot and BitOr and found the error in BitNot, too.

This is enough to hack-fix it, since BitOr still converts to 32bit:

Func _BitShift($iNum, $iShift)
    Return BitShift(BitOR($iNum, 0), $iShift)
EndFunc
Func _BitNot($iNum)
    Return BitNot(BitOR($iNum, 0))
EndFunc
Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Posted

Ugh. Sorry guys. I'll revert this rubbish and go back to all the functions truncating at 32-bit until somebody who actually knows what the fuck they are doing can take a crack at better 64-bit support.

Posted

Really ugly temporary hack (you'll go to hell if you use it):

ConsoleWrite(0xFFF & @CRLF)
ConsoleWrite(_BitShift(0xFFFFFFFF, 20) & @CRLF)
ConsoleWrite(0xFFFF & @CRLF)
ConsoleWrite(_BitShift(0xFFFFFFFF, 16) & @CRLF)
ConsoleWrite(0xFFFFF & @CRLF)
ConsoleWrite(_BitShift(0xFFFFFFFF, 12) & @CRLF)

Func _BitShift($iNum, $iShift)
    If ($iShift <= -32) Or ($iShift >= 32) Then Return SetError(1, 0, $iNum)
    If $iShift = 0 Then Return $iNum
    If $iShift < 0 Then
        ; negative shifts seem to work ok
        Return BitShift($iNum, $iShift)
    Else
        ; handle right shifts of negative numbers
        ; the magic: strip sign bit, shift, add back top bit in new position
        If $iNum < 0 Then Return BitOR(BitShift(BitAND($iNum, 0x7FFFFFFF), $iShift), 2 ^ (31 - $iShift))
    EndIf
    Return BitShift($iNum, $iShift)
EndFunc

And you are completely wrong :)

I believe you are actually reproducing the bug (and more). It's exactly signed/unsigned issue as ProgAndy showed.

♡♡♡

.

eMyvnE

Posted

_DebugSetup() seems to be blocking user input. Is that suppose to happen?

Posted (edited)

@trancexxx

Did you bother to try it? Did the examples produce the correct results? Then what's wrong about it?

Incidentally did you try ProgAndy's either?

ConsoleWrite(BitShift(BitOR(0xFFFFFFFF, 0), 16) & @CRLF)

Still produces -1 in 3.3.1.4 / 3.3.1.5.

Edited by wraithdu
Posted

@trancexxx

Did you bother to try it? Did the examples produce the correct results? Then what's wrong about it?

Incidentally did you try ProgAndy's either?

ConsoleWrite(BitShift(BitOR(0xFFFFFFFF, 0), 16) & @CRLF)

Still produces -1 in 3.3.1.4 / 3.3.1.5.

What are you talking about?!? You lost me completely.

Btw, seems like you are confusing 'logical shift' and 'arithmetic shift'.

♡♡♡

.

eMyvnE

Posted (edited)

What are you talking about? I have no idea what that last comment is supposed to mean. The current BitShift() has a bug, my hack fixes it and produces the correct results, same as >> and << in C++. You wanna provide some example of what you're trying to say? I fail to see where I'm wrong. Don't just come out and say 'And you are completely wrong' without something to back it up.

Edited by wraithdu
Posted

Enough. It doesn't matter. I'll take a look and if AutoIt is broken I'll revert it back to the 3.3.0.0 behavior (Or Jon will if he beats me to checking on this). Debating this further is pointless.

Posted (edited)

What are you talking about? I have no idea what that last comment is supposed to mean. The current BitShift() has a bug, my hack fixes it and produces the correct results, same as >> and << in C++. You wanna provide some example of what you're trying to say? I fail to see where I'm wrong. Don't just come out and say 'And you are completely wrong' without something to back it up.

Yes, sory if I offended you. I thought you would take it differently.

I'm talking about >>>

You are saying that the current (3.3.0.0) BitShift() is with bug?

edit: I see there were new happenings while I was typing.

Edited by trancexx

♡♡♡

.

eMyvnE

Posted (edited)

I'm not sure if this is exactly related, but I tried this on my x64 machine. It would explain what is going on with BitShift() if it is now internally using 64 bit numbers.

$s = DllStructCreate("ptr")
DllStructSetData($s, 1, 0xAFFFFFFF)
ConsoleWrite(DllStructGetData($s, 1) & @CRLF)

produces the output

0xFFFFFFFFAFFFFFFF

where I would expect it to produce

0x00000000AFFFFFFF
Edited by wraithdu
Posted

Nutster,

Static is still not resizing arrays: :)

>Running:(3.3.1.5):C:\Program Files\AutoIt3\beta\autoit3.exe "C:\Program Files\AutoIt3\Beta\Examples\Helpfile\Static.au3"    
C:\Program Files\AutoIt3\Beta\Examples\Helpfile\Static.au3 (37) : ==> Cannot make existing variables static.:
Static $Values[$State + 1]
Static ^ ERROR
->12:23:13 AutoIT3.exe ended.rc:1

M23

I know. I have not submitted the update to this issue yet. I am working on it this weekend.

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Posted

Advanced warning: Static will not be in the next beta going forward. It will be re-added after the beta starts again post next release.

In other words... don't start using it yet.

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...