Jump to content

Recommended Posts

Posted (edited)

It's x86 callback. Currently AutoIt pushes data onto FPU stack regardless of the type of return. This is opposite of what it did before.

The problem with the code before was that float and double types weren't returned by callback functions at all.

...

Indeed, the problem occurs when the line

Global $hKey_Proc = DllCallbackRegister("_Mouse_Proc", "int", "int;ptr;ptr")

is processed.

Func _Mouse_Proc($nCode, $wParam, $lParam) ;function called for mouse events.. Made by _Kurt
    ;define local vars
    Local $info, $mouseData, $Ret, $mi
    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 And WinActive($hGUI)
            $mi = GUIGetCursorInfo()
            If Not @error Then
                If $mi[4] <> $List Then ;activate zooming only when mouse is not hovering listview section
                    If _WinAPI_HiWord($mouseData) > 0 Then
                        Zoom(1)
                    Else
                        Zoom(0)
                    EndIf
                    Return 1
                EndIf
            EndIf
    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

Thx,

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

wraithdu you had a stub or two into bitwise operations. Any thoughts on this? Or anyone else maybe? What are the expectations?

Way back when I was playing with the bitwise ops, my main gripe was the different output from AutoIt versus C, in that an AutoIt bitshift to the right will propagate the sign bit. That doesn't happen in C.

If the bitwise ops will soon support 64-bit numbers, then make it consistent to the 32-bit ops in that regard. I would say to make the behavior consistent to the C bitwise ops, but that's your call.

Posted

Make the behavior mimic C with regards to the sign bit. For BitShift() add a new parameter to specify the size. I see that BitRotate() already has a size so it just needs "Q" for QWORD. It may be best to mimic the flag parameter of BitRotate() for BitShift().

Posted (edited)

Here the problem with the beta shortened.

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

Global Const $MSLLHOOKSTRUCT = $tagPOINT & ";dword mouseData;dword flags;dword time;ulong_ptr dwExtraInfo"
Global $hKey_Proc = DllCallbackRegister("_Mouse_Proc", "int", "int;ptr;ptr")
Global $hM_Module = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0)
Global $hM_Hook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", $WH_MOUSE_LL, "ptr", DllCallbackGetPtr($hKey_Proc), "hwnd", $hM_Module[0], "dword", 0)


Global Const $hGUI = GUICreate("Bug Test", 409, 201, 192, 124)
Global Const $Button1 = GUICtrlCreateButton("Button1", 40, 40, 91, 65)
Global Const $Button2 = GUICtrlCreateButton("Button2", 160, 40, 91, 65)
Global Const $Button3 = GUICtrlCreateButton("Button3", 280, 40, 91, 65)
Global Const $Button4 = GUICtrlCreateButton("Button4", 288, 152, 75, 25)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hM_Hook[0])
            $hM_Hook[0] = 0
            DllCallbackFree($hKey_Proc)
            $hKey_Proc = 0
            Exit
    EndSwitch
WEnd


;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, $Ret, $mi
    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 And WinActive($hGUI)
            $mi = GUIGetCursorInfo()
            If Not @error Then
            EndIf
    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

If you hover with the mouse over the buttons you will see what is happening.

Br,

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

Wow, that's all kinds of goofy running as x86 (works ok as x64).

FYI, check your dllcall parameter types or use the _WinAPI_ functions. I know some of what you have there is "interchangeable", but bad code is bad code. For example, "hwnd" isn't correct anywhere, it should be "handle". There are also some return types that should be "bool", and the proc types should be "wparam" and "lparam" and "lresult". Being proper about it will keep platform and bitness bugs from creeping in. Just my opinion of course, take it or leave it.

  • 2 weeks later...
  • Moderators
Posted

Hi,

The Beta does not like my NoFocusLines UDF. The GUI no longer redraws correctly with controls vanishing and reappearing spontaneously - I even get the entire title bar vanishing on occasion. ;)

Looking at the list of changes made and the UDF code, DllCallbackRegister seems the likely culprit. However, the syntax in the UDF still appears to match that in the Help file. Could someone who understands what changes were made please suggest what I need to change in the UDF? :)

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 (edited)

Nothing. If change log doesn't mention script breaking changes then all of your code should work like before.

When new beta would be out then try again.

Melba23, you could have said what windows you run, what version (bitness) of AutoIt and other stuff.

Edited by trancexx

♡♡♡

.

eMyvnE

  • Moderators
Posted (edited)

trancexx,

Sorry - I will try and do better next time. :)

M23

Edit: Although I hope there will not be a next time! ;)

Edited by Melba23

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

Issue #2111 still appears to be broken in 3.3.9.0 compiled scripts.

Here's my testing example:

;constants
Global Const $tagBOOL = "int"
Global Const $tagSTRING64 = "char[64]"
Global Const $tagSTRING128 = "char[128]"
Global Const $tagSTRING256 = "char[256]"
Global Const $tagSTRING32767 = "char[32767]"
Global Const $tagSTRING_CRED_MAX_USERNAME_LENGTH = "char[513]"
Global Const $tagCREDUI_INFO = "DWORD cbSize;HWND hwndParent;PTR pszMessageText;PTR pszCaptionText;HBITMAP hbmBanner"
;Flags for CredUIPromptForCredentials
Global Const $CRED_MAX_USERNAME_LENGTH = (256+1+256)
Global Const $CREDUI_MAX_PASSWORD_LENGTH = 256
Global Const $CRED_MAX_GENERIC_TARGET_NAME_LENGTH = 32767
Global Const $CRED_MAX_STRING_LENGTH  = 256
Global Const $CREDUI_FLAGS_INCORRECT_PASSWORD = 0x00001  ;indicates the username is valid, but password is not
Global Const $CREDUI_FLAGS_DO_NOT_PERSIST = 0x00002   ;Do not show "Save" checkbox, and do not persist credentials
Global Const $CREDUI_FLAGS_REQUEST_ADMINISTRATOR = 0x00004 ;Populate list box with admin accounts
Global Const $CREDUI_FLAGS_EXCLUDE_CERTIFICATES = 0x00008 ;do not include certificates in the drop list
Global Const $CREDUI_FLAGS_REQUIRE_CERTIFICATE = 0x00010
Global Const $CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX = 0x00040
Global Const $CREDUI_FLAGS_ALWAYS_SHOW_UI = 0x00080
Global Const $CREDUI_FLAGS_REQUIRE_SMARTCARD = 0x00100
Global Const $CREDUI_FLAGS_PASSWORD_ONLY_OK = 0x00200
Global Const $CREDUI_FLAGS_VALIDATE_USERNAME = 0x00400
Global Const $CREDUI_FLAGS_COMPLETE_USERNAME = 0x00800  
Global Const $CREDUI_FLAGS_PERSIST = 0x01000    ;Do not show "Save" checkbox, but persist credentials anyway
Global Const $CREDUI_FLAGS_SERVER_CREDENTIAL = 0x04000
Global Const $CREDUI_FLAGS_EXPECT_CONFIRMATION = 0x20000 ;do not persist unless caller later confirms credential via CredUIConfirmCredential() api
Global Const $CREDUI_FLAGS_GENERIC_CREDENTIALS = 0x40000 ;Credential is a generic credential
Global Const $CREDUI_FLAGS_USERNAME_TARGET_CREDENTIALS = 0x80000 ;Credential has a username as the target
Global Const $CREDUI_FLAGS_KEEP_USERNAME = 0x100000   ;don't allow the user to change the supplied username

If IsArray($cmdline) Then
If UBound($cmdline) > 1 Then
  If $cmdline[1] = "/AdminConsole" Then
   MsgBox(0,"Admin Console",@username & @CRLF & @WorkingDir)
   Exit
  EndIf
EndIf
EndIf
CredTest()
Exit

Func CredTest()
Local $lCreds, $lBslashLoc, $lDomain, $lUser, $lRPID
$lCreds = _CredUIPromptForCredentials(0, "", "", "", " Admin Console", "", "", "", "", -1)
If IsArray($lCreds) Then
  If $lCreds[0] = 1223 Then
   ;user canceled credentials box
   $lDone = 1
  ElseIf $lCreds[1] <> "" Then
   If StringInStr($lCreds[1],"\") Then
    $lBslashLoc = StringInStr($lCreds[1],"\")
    $lDomain = StringLeft($lCreds[1], $lBslashLoc - 1)
    $lUser = StringTrimLeft($lCreds[1], $lBslashLoc)
   ElseIf StringInStr($lCreds[1],"@") Then
    $lBslashLoc = StringInStr($lCreds[1],"@")
    $lUser = StringLeft($lCreds[1], $lBslashLoc - 1)
    $lDomain = StringTrimLeft($lCreds[1], $lBslashLoc)
   EndIf
   If ($lUser <> "") And ($lDomain <> "") And ($lCreds[2] <> "") Then  
    ;RunAs ( "username", "domain", "password", logon_flag, "filename" [, "workingdir" [, show_flag [, opt_flag ]]] )
    $lRPID = RunAs($lUser, $lDomain, $lCreds[2],1,'"' & @ScriptFullPath & '" /AdminConsole', @SystemDir)
    MsgBox(0,"Creds",$lUser & @CRLF & $lDomain & @CRLF & "PWLen: " & StringLen($lCreds[2]) & @CRLF & "PID: " & $lRPID)
    If $lRPID = 0 Then
     ;log- Admin Console - Access Denied. Unknown user name or bad password
     $lMsgRslt = MsgBox(BitOR(0x1,0x30,0x40000)," Admin Console","Access Denied" & @CRLF & @CRLF & "Unknown user name or bad password." & @CRLF & "RunAs process could not be created.",120)
     If ($lMsgRslt = -1) or ($lMsgRslt = 2) Then
      ;user has canceled or the message timed out
      $lDone = 1
     EndIf
    Else
     ;admin console was started
     $lDone = 1
    EndIf
   EndIf
  EndIf
Else
  MsgBox(0,Default,"Array not returned")
EndIf
EndFunc
Func _CredUIPromptForCredentials($lHWndParentUI = 0, $lpszMessageText = "", $lpszCaptionText = "", $lhbmBanner = "", $lpszTargetName = "", $ldwAuthError = "", $lpszUserName = "", $lpszPassword = "", $lpfSave = "", $ldwFlags = "")
Local $sCREDUI_INFO, $spszMessageText, $spszCaptionText
Local $spszTargetName, $spszUserName, $spszPassword, $spfSave, $lCredUIPromptForCredentials, $retArray[4]

;configure CREDUI_INFO structures
$spszMessageText = DllStructCreate($tagSTRING32767)
$spszCaptionText = DllStructCreate($tagSTRING128)
DllStructSetData($spszMessageText, 1, $lpszMessageText)
DllStructSetData($spszCaptionText, 1, $lpszCaptionText)

$sCREDUI_INFO = DllStructCreate($tagCREDUI_INFO)
DllStructSetData($sCREDUI_INFO, "cbSize", DllStructGetSize($sCREDUI_INFO))
DllStructSetData($sCREDUI_INFO, "hwndParent", $lHWndParentUI)
DllStructSetData($sCREDUI_INFO, "pszMessageText", DllStructGetPtr($spszMessageText))
DllStructSetData($sCREDUI_INFO, "pszCaptionText", DllStructGetPtr($spszCaptionText))
DllStructSetData($sCREDUI_INFO, "hbmBanner", $lhbmBanner)

;configure CredUIPromptForCredentials structures
$spszTargetName = DllStructCreate($tagSTRING32767)
$spszUserName = DllStructCreate($tagSTRING_CRED_MAX_USERNAME_LENGTH)
$spszPassword = DllStructCreate($tagSTRING256)
$spfSave = DllStructCreate($tagBOOL)

DllStructSetData($spszTargetName,1,$lpszTargetName)
DllStructSetData($spszUserName,1,$lpszUserName)
DllStructSetData($spszPassword,1,$lpszPassword)
DllStructSetData($spfSave,1,$lpfSave)

;configure default prompting options
If $ldwFlags = -1 Then
  $ldwFlags = BitOR($CREDUI_FLAGS_DO_NOT_PERSIST,$CREDUI_FLAGS_USERNAME_TARGET_CREDENTIALS,$CREDUI_FLAGS_REQUEST_ADMINISTRATOR)
EndIf

;prompting for credentials
$lCredUIPromptForCredentials = DllCall("Credui.dll","DWORD", "CredUIPromptForCredentials","ptr", DllStructGetPtr($sCREDUI_INFO), "ptr", DllStructGetPtr($spszTargetName),"ptr", "", "DWORD", $ldwAuthError, "ptr", DllStructGetPtr($spszUserName),"ULONG", $CRED_MAX_USERNAME_LENGTH, "ptr", DllStructGetPtr($spszPassword), "ULONG", $CREDUI_MAX_PASSWORD_LENGTH, "ptr", DllStructGetPtr($spfSave), "DWORD", $ldwFlags)

;results array
If IsArray($lCredUIPromptForCredentials) Then
  $retArray[0] = $lCredUIPromptForCredentials[0]
  $retArray[1] = DllStructGetData($spszUserName,1)
  $retArray[2] = DllStructGetData($spszPassword,1)
  $retArray[3] = DllStructGetData($spfSave,1)
EndIf

;release structures
$spszMessageText = 0
$spszCaptionText = 0
$sCREDUI_INFO = 0
$spszTargetName = 0
$spszUserName = 0
$spszPassword = 0
$spfSave = 0

Return $retArray
EndFunc
;script end
Posted

Special Note: This is an official beta release but it is not digitally signed. Only Jon has the certificate used for digital signatures and the last time I checked I was not Jon.

3.3.9.1 (29th February, 2012) (Beta)

AutoIt:

- Fixed: ObjGet() forgets non-file monikers since last beta.

- Fixed #1395: DLLCallbacks on Exit.

- Fixed: Ptr() returns null pointer for objects.

- Fixed #1319: Hang at exit for RichEdit user controls.

- Fixed #2138: Fixed GUICtrlRead() on dummy controls was corrupting strings and possibly crashing AutoIt.

- Fixed #1760: #OnAutoItStartRegister ignores single quoted function names.

- Changed: x86 callback function touches FPU stack only when necessary.

- Added: Compound assignment operators for object properties.

UDFs:

- Added #2126: Documentation remark about _ArrayDisplay being able to display a maximum of 65530 items.

- Fixed #2084: Clipboard not being closed if an error occurred with _ClipBoard_SetDataEx.

- Fixed #2125: Writing a 2-dimensional array would only write the first two columns of the array.

- Fixed #2070: Unexpected crash on certain systems when using _GUICtrlStatusBar_GetText.

- Fixed #2132: Documentation of _WinAPI_GetModuleHandle and the parameter to return the handle of the calling process. (Use the Null keyword, not 0.)

Au3Check:

- Changed: Au3Check version numbers now match AutoIt's.

The following changes are script breaking changes:

None so far.

Report issues here.

Download here.

Posted

I verified issue #2111 is fixed with our whacky vendor app & 3.3.9.1 compiled scripts. Thanks again Valik!

And thank you to ALL the AutoIt developers, you rock!!!

Posted

Special Note: This is an official beta release but it is not digitally signed. Only Jon has the certificate used for digital signatures and the last time I checked I was not Jon.

3.3.9.2 (10th March, 2012) (Beta)

AutoIt:

- Fixed: ObjCreate() may not set @error in case of failure.

- Fixed #2146: Crash when closing AutoIt when started from a console window.

- Fixed: DLLStruct type forgotten in comparison operations.

- Fixed: "struct" type parameter in DllCall overwrites possibly following parameters.

- Changed: @error is set to 0 for successful object invocation.

The following changes are script breaking changes:

None so far.

Report issues here.

Download here.

  • 4 weeks later...
Posted

Special Note: This is an official beta release but it is not digitally signed. Only Jon has the certificate used for digital signatures and the last time I checked I was not Jon.

3.3.9.3 (8th April, 2012) (Beta)

AutoIt:

- Added #1191: Explicit size of arrays optional for explicit initialization.

- Added: Array access on expression: StringSplit("a,b", ",")[1]

- Added: Dot access on expression: ObjCreate("Shell.Application").GetSystemInformation("DirectoryServiceAvailable")

- Fixed #1566: Array as its own element issue.

- Fixed #1551: Crash the script when changing array.

- Fixed #2176: DllCallbackRegister crash on x64.

UDFs:

- Added #1158: WinAPIEx integrated (Files-only, no documentation currently).

- Fixed #2162: Documentation link in the IE Management section was broken for _IEFormElementCheckBoxSelect.

- Fixed #2170: _ArrayDisplay fails handling arrays with no elements.

- Fixed: _PathMake not appending backslash to the root path.

Au3Check:

- Added: Compound assignment operators for object properties.

- Added: Array access on expression

- Added: Dot access on expression

- Changed: Explicit size of arrays optional for explicit initialization.

The following changes are script breaking changes:

None so far.

NOTE: WinAPIEx is included in this release. The files exist but there are no documentation or examples. Filenames and functions are subject to change or removal. Functions will be moved out to other files before the final release and the file WinAPIEx.au3 will likely not exist when that happens.

Report issues here.

Download here.

Posted

- Added #1191: Explicit size of arrays optional for explicit initialization.

HOLY C****! HOLY FREAKIN C***** I CANNOT BELIEVE THIS!!!

It's about damn time...

Posted (edited)

If you got that excited about that, just wait till you see the next line.

I didn't really get it, and I forgot to ask, what does it mean?

Ok, nevermind, I see it now, I just sorta failed to pay attention to it when seeing the one above it, both of these two new features are awesome, I can't believe they took this long to do this.

MsgBox(0,"",StringSplit("Test 1|Test 2|Test3","|",2)[1])

Added: Array access on expression: StringSplit("a,b", ",")[1]

Also, I've been waiting for something like this, I always wanted to make a feature request for it but I didn't think they would approve and always thought it was the way it was for some reason unknown to me.

I downloaded the beta, opened the beta directory, highlighted all the files in it and cut n pasted all the beta files into the release version directory overwriting the current installation, all the other previous version are inferior to me now.

Edited by ApudAngelorum

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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