Modify

#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@…> on Feb 16, 2010 at 2:25:35 PM.

Download all attachments as: .zip

Change History (21)

by SkinnyWhiteGuy <mleo2003@…>, on Feb 16, 2010 at 2:25:35 PM

Attachment: Temp.au3 added

comment:1 by Jon, on Feb 16, 2010 at 5:51:15 PM

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 by Jon, on Feb 16, 2010 at 7:31:04 PM

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 by Jon, on Feb 16, 2010 at 8:32:24 PM

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 by SkinnyWhiteGuy <mleo2003@…>, on Feb 16, 2010 at 8:40:27 PM

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 by SkinnyWhiteGuy <mleo2003@…>, on Feb 16, 2010 at 8:43:52 PM

Sorry, code in last post should be:

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

comment:6 by Valik, on Feb 16, 2010 at 9:05:10 PM

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 by Jpm, on Feb 17, 2010 at 10:10:44 AM

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

in reply to:  7 comment:8 by SkinnyWhiteGuy <mleo2003@…>, on Feb 17, 2010 at 5:47:48 PM

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 by SkinnyWhiteGuy <mleo2003@…>, on Feb 19, 2010 at 2:13:57 PM

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 by Jpm, on Jun 3, 2010 at 8:30:43 AM

Owner: set to Jon
Status: newassigned

comment:11 by Jpm, on Jul 21, 2010 at 10:06:22 AM

Milestone: 3.3.7.0
Owner: changed from Jon to Jpm
Resolution: Fixed
Status: assignedclosed

Fixed by revision [5922] in version: 3.3.7.0

comment:12 by David Leigh <david@…>, on Feb 8, 2011 at 5:05:59 PM

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 by Jon, on May 24, 2011 at 9:01:51 PM

Resolution: Fixed
Status: closedreopened

comment:14 by TicketCleanup, on May 25, 2011 at 12:00:01 AM

Milestone: 3.3.7.0

Automatic ticket cleanup.

comment:15 by Jon, on May 25, 2011 at 7:45:20 PM

Resolution: Fixed
Status: reopenedclosed

comment:16 by TicketCleanup, on May 25, 2011 at 9:00:01 PM

Milestone: Future Release

Automatic ticket cleanup.

comment:17 by Jessie, on Nov 2, 2011 at 5:42:29 PM

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

comment:18 by Jpm, on Feb 9, 2012 at 3:07:34 PM

Milestone: Future Release3.3.7.2

comment:19 by bernd, on May 1, 2015 at 9:08:27 PM

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 by bernd, on May 1, 2015 at 9:55:23 PM

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

Modify Ticket

Action
as closed The owner will remain Jpm.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.