Modify

Opened 15 years ago

Closed 13 years ago

Last modified 10 years ago

#1479 closed Bug (Fixed)

ListView WM_NOTIFY Message on x64 Returning Wrong Results

Reported by: SkinnyWhiteGuy <mleo2003@…> Owned by: Jpm
Milestone: 3.3.7.2 Component: AutoIt
Version: 3.3.4.0 Severity: None
Keywords: Cc:

Description

I'm on Windows 7 64-bit, trying to use a WM_NOTIFY function to detect when an item is clicked on. When I run the test script in 32-bit mode, everything works fine. When I run it in 64-bit mode, the Index returned is always 0, and the SubItem is the correct index I was looking for. I am using the example script from _GUICtrlListView_ClickItem help entry to test with. I played with the structs being used, changed them around, but it seems to be the data lParam is pointing to is not the sizes MSDN says they should be.

Attachments (1)

Temp.au3 (8.3 KB) - added by SkinnyWhiteGuy <mleo2003@…> 15 years ago.

Download all attachments as: .zip

Change History (21)

Changed 15 years ago by SkinnyWhiteGuy <mleo2003@…>

comment:1 Changed 15 years ago by Jon

I'm not sure what you are reporting? A bug with a UDF? AutoIt? The help file example? Your script? I'm also not sure how I run the script to see whatever error you are talking about. I see a few lines with colored text? I click them, nothing happens? Is it supposed to do anything?

comment:2 Changed 15 years ago by Jon

Nevermind. I see the output in the console now. The index is wrong on x64. A quick glance at the structures look like they are using the correct types. Might need Gary to look at this one before I dig around in there.

comment:3 Changed 15 years ago by Jon

The NMITEMACTIVATE structure is being created as 48 bytes under Win32 and 64 under x64. It should be 72 bytes under x64 - not sure where the missing bytes are yet.

comment:4 Changed 15 years ago by SkinnyWhiteGuy <mleo2003@…>

Sorry about that, should have mentioned the error was shown in the console window.

I wasn't sure if the Struct was too big, or too small. Dumping the binary data of the struct using this (right after $tInfo is created within either NM_CLICK or NM_DBLCLK),

ConsoleWrite(DllStructGetData(DllStructCreate("byte& DllStructGetSize($tInfo) &?", DllStructGetPtr($tInfo)), 1) & @CRLF)

It looks as if the 3rd member (an int from $tagNMHDR) is sent as 64 bit, but should be 32 bit. I tried different alignments, to see if that would help, but there was no change.

comment:5 Changed 15 years ago by SkinnyWhiteGuy <mleo2003@…>

Sorry, code in last post should be:

ConsoleWrite(DllStructGetData(DllStructCreate("byte[" & DllStructGetSize($tInfo) & "]", DllStructGetPtr($tInfo)), 1) & @CRLF)

comment:6 Changed 15 years ago by Valik

If the types are correct but the size is wrong then it sounds to me like the structure is not being aligned correctly.

comment:7 follow-up: Changed 15 years ago by Jpm

May be the same problem as the one we fix in $tagNMLVKEYDOWN

comment:8 in reply to: ↑ 7 Changed 15 years ago by SkinnyWhiteGuy <mleo2003@…>

Replying to Jpm:

May be the same problem as the one we fix in $tagNMLVKEYDOWN

Thanks for the suggestion, I tried it and it works for most cases, except the one I need. The MSDN article for this message says Index should return -1 when there is no item under the click (below the created items). With index changed to int_ptr, it returns 4294967295, which would be -1 as a 32 bit number.

Changing the alignment made the structure even smaller (60 bytes in x64), but still doesn't return the index clicked. When I dump the header after it was realigned, everything looks good, but the full message still shows extra null-byte padding where it doesn't need it.

comment:9 Changed 15 years ago by SkinnyWhiteGuy <mleo2003@…>

Just on a hunch, I decided to check other messages related to the NMHDR struct, and other structs using WM_NOTIFY. So far, I found another help-file example that fails, but another one that works fine. The one that fails is _GUICtrlIpAddress_Create, and the one that works is _GUICtrlButton_Create. I'm not sure what the difference is, but at least I know now it's not related to just the ListView functions (nor is it my error).

comment:10 Changed 14 years ago by Jpm

  • Owner set to Jon
  • Status changed from new to assigned

comment:11 Changed 14 years ago by Jpm

  • Milestone set to 3.3.7.0
  • Owner changed from Jon to Jpm
  • Resolution set to Fixed
  • Status changed from assigned to closed

Fixed by revision [5922] in version: 3.3.7.0

comment:12 Changed 14 years ago by David Leigh <david@…>

When executing _GUICtrlListView_SimpleSort example script on a 32 bit XP machine it works great, but on my 64 bit Win7 machine I get the following:

"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Program Files (x86)\AutoIt3\Examples\Helpfile\_GUICtrlListView_SimpleSort.au3" /autoit3dir "C:\Program Files (x86)\AutoIt3" /UserParams

+>14:32:09 Starting AutoIt3Wrapper v.2.0.1.24 Environment(Language:0409 Keyboard:00000409 OS:WIN_7/ CPU:X64 OS:X64)

Running AU3Check (1.54.19.0) params:-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 from:C:\Program Files (x86)\AutoIt3

+>14:32:09 AU3Check ended.rc:0

Running:(3.3.6.1):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\Program Files (x86)\AutoIt3\Examples\Helpfile\_GUICtrlListView_SimpleSort.au3"

!===========================================================
+======================================================
-->Line(0061): $LVN_COLUMNCLICK
--> hWndFrom: 0x00000000000A0D1C
-->IDFrom: 3
-->Code: -108
-->Item: 0
-->SubItem: -1
-->NewState: 2
-->OldState: 0
-->Changed: 0
-->ActionX: 0
-->ActionY: 0
-->Param: 0
+======================================================
C:\Program Files (x86)\AutoIt3\Include\GuiListView.au3 (6769) : ==> Array variable subscript badly formatted.:
$b_desc = $vDescending[$iCol]
$b_desc = $vDescending[ ERROR
->14:32:11 AutoIT3.exe ended.rc:1

Exit code: 1 Time: 3.246

Adding #AutoIt3Wrapper_UseX64=n fixes it.

This looks to be the same issue as discussed in this thread (wrong structure size in x64), but I thought I'd submit it just in case.
Thanks!

comment:13 Changed 13 years ago by Jon

  • Resolution Fixed deleted
  • Status changed from closed to reopened

comment:14 Changed 13 years ago by TicketCleanup

  • Milestone 3.3.7.0 deleted

Automatic ticket cleanup.

comment:15 Changed 13 years ago by Jon

  • Resolution set to Fixed
  • Status changed from reopened to closed

comment:16 Changed 13 years ago by TicketCleanup

  • Milestone set to Future Release

Automatic ticket cleanup.

comment:17 Changed 13 years ago by Jessie

Thanks guys, I just about lost it loonikg for this.

comment:18 Changed 13 years ago by Jpm

  • Milestone changed from Future Release to 3.3.7.2

comment:19 Changed 10 years ago by bernd

If you change the following in the file StructurConstants.au3 then it works with 32bit and 64bit.

from

Global Const $tagNMLVKEYDOWN = "align 1;" & $tagNMHDR & ";word VKey;uint Flags"

to

Global Const $tagNMLVKEYDOWN = $tagNMHDR & ";word VKey;uint Flags"

This probably applies to other structures in this file.

comment:20 Changed 10 years ago by bernd

Forgot to mention that the bug in the current version is still available.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Jpm.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.