Jump to content

Problem with $NM_DBLCLK handling for ListView in 64bit Exe-File


geronimo23
 Share

Recommended Posts

Hi, I have a function like WM_NOTIFY for Double Clicke in a Listview.

Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam)

#forceref $hWndGUI, $MsgID, $wParam

Local $tagNMHDR, $event, $hwndFrom, $code

$tagNMHDR = DllStructCreate("int;int;int", $lParam);NMHDR (hwndFrom, idFrom, code)

If @error Then Return

$event = DllStructGetData($tagNMHDR, 3)

Select

Case $wParam = $ListView

If $event = $NM_DBLCLK

MsgBox(0,"Double Clicked","OK")

Endif

EndSelect

EndFunc

When I compile the file with 32bit - it works.

When I use the 64 Compiler I get no event from the function.

What is wrong in the function ?

Edited by geronimo23
Link to comment
Share on other sites

Hello geronimo23,

Welcome on AutoIt forum !

An example to test :

#include <GuiConstants.au3>

Global Const $WM_NOTIFY = 0x004E
Global $DoubleClicked   = False

GUICreate("Double Click Demo", 400, 300)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")


$ListViewID = GuiCtrlCreateListView("List Column|ze", 10, 20, 380, 250)

For $i = 1 To 10
    GuiCtrlCreateListViewItem("Item|ze " & $i, $ListViewID)
Next

GUISetState()

While GUIGetMsg() <> -3
    Sleep(10)
    If $DoubleClicked Then
        DoubleClickFunc()
        $DoubleClicked = False
    EndIf
WEnd

Func DoubleClickFunc()
    MsgBox(64, "OK", "Double Clicked: " & GUICtrlRead(GUICtrlRead($ListViewID)))
EndFunc

Func WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam)
    Local $tagNMHDR, $event, $hwndFrom, $code
    $tagNMHDR = DllStructCreate("int;int;int", $lParam)
    If @error Then Return 0
    $code = DllStructGetData($tagNMHDR, 3)
    If $wParam = $ListViewID And $code = -3 Then $DoubleClicked = True
    Return $GUI_RUNDEFMSG
EndFunc
Edited by Jikoo
My projects : GCS Search 1.07 (GUI Control Styles Search)* Multilingual tool to help about the old scripts, with a dynamic menu.* Easy way to find missing Include files in old scripts downloaded from forums !* Famous Monoceres script added and improved (visual, drag and drop, automatic)* There is an interactive color converter with palettes too, for fun !The best way to start Autoit3 development (for newbies).
Link to comment
Share on other sites

Ok - I try it again:

I have a function like WM_NOTIFY for Double Clicke in a Listview.

Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam)
  #forceref $hWndGUI, $MsgID, $wParam
  Local $tagNMHDR, $event, $hwndFrom, $code
  $tagNMHDR = DllStructCreate("int;int;int", $lParam);NMHDR (hwndFrom, idFrom, code)
  If @error Then Return
  $event = DllStructGetData($tagNMHDR, 3)
  Select
      Case $wParam = $ListView
             If $event = $NM_DBLCLK
                 MsgBox(0,"Double Clicked","OK")
             Endif
   EndSelect
EndFunc

When I compile the file with 32bit - it works.

When I use the 64 Compiler I get no event from the function.

What is wrong in the function ?

Link to comment
Share on other sites

Hi Jikoo,

I tried your version - but the same result - it do not works with x64 compiling.

When I double Click no MsgBox pop up.

Sorry geronimo23, I can't help you anymore because I use a XP 32 bits. :mellow:

My projects : GCS Search 1.07 (GUI Control Styles Search)* Multilingual tool to help about the old scripts, with a dynamic menu.* Easy way to find missing Include files in old scripts downloaded from forums !* Famous Monoceres script added and improved (visual, drag and drop, automatic)* There is an interactive color converter with palettes too, for fun !The best way to start Autoit3 development (for newbies).
Link to comment
Share on other sites

Maybe, try this solution made by jennico. It doesn't use guiregistermsg()

;---------------------------------------
; my list view click and dclick solution
; without guiregistermsg()
; by jennico
;---------------------------------------
#include "GUIConstants.au3"
#include <ListviewConstants.au3>
#include <WindowsConstants.au3>
;-------main
Dim $pos1
$GUIparent = GUICreate("My listview click and dclick solution without guiregistermsg()", 600, 513)
$setup_IncludeListview = GUICtrlCreateListView("aaa|bbb|cccc|ddddddd", 10, 55, 580, 400, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
; GUICtrlSendMsg($setup_IncludeListview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
; GUICtrlSendMsg($setup_IncludeListview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
For $i = 1 To 50
    GUICtrlCreateListViewItem("1|2222222222222222|33333333333", $setup_IncludeListview)
Next
$click = GUICtrlCreateLabel("Click:", 10, 20, 100, 20)
GUISetState()
;-------popup
$GUIpopup = GUICreate("", 1, 1, 0, 0, $WS_POPUP, -1, $GUIparent);=> sizing variable
;-------loop
Do
    $msg = GUIGetMsg()
    If WinActive($GUIpopup) Then
        GUICtrlSetData($click, "Click: Double !!!");=> your dclick event
;       MouseMove(12 + $pos1[0], 53 + $pos1[1], 0)
        _UnPop()

    ElseIf WinActive($GUIparent) And $msg = $GUI_EVENT_PRIMARYDOWN Then
        $pos = MouseGetPos()
        $pos1 = WinGetPos($GUIparent)
        If $pos[0] - $pos1[0] > 14 And $pos[0] - $pos1[0] < 575 And $pos[1] - $pos1[1] > 96 And $pos[1] - $pos1[1] < 459 Then
            WinMove($GUIpopup, "", $pos[0], $pos[1])
            GUICtrlSetData($click, "Click: Single");=>your click event
            GUISetState(@SW_SHOW, $GUIpopup)
            WinActivate($GUIparent)
            $mousespeed = RegRead("HKCU\Control Panel\Mouse", "DoubleClickSpeed")
            If $mousespeed = "" Then $mousespeed = 500
            AdlibEnable("_UnPop", $mousespeed)
        EndIf
    EndIf
Until $msg = -3
;-------func
Func _UnPop()
    GUISetState(@SW_HIDE, $GUIpopup)
    AdlibDisable()
    WinActivate($GUIparent)
EndFunc   ;==>_UnPop
My projects : GCS Search 1.07 (GUI Control Styles Search)* Multilingual tool to help about the old scripts, with a dynamic menu.* Easy way to find missing Include files in old scripts downloaded from forums !* Famous Monoceres script added and improved (visual, drag and drop, automatic)* There is an interactive color converter with palettes too, for fun !The best way to start Autoit3 development (for newbies).
Link to comment
Share on other sites

Try to use another DLLstruct. I think, hwnd is 64 bit on 64bit, not 32bit :mellow: and secobd parameter is uint_ptr, too

$tagNMHDR = DllStructCreate("HWND;UINT_PTR;UINT", $lParam)

( http://msdn.microsoft.com/en-us/library/bb775514(VS.85).aspx )

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

Link to comment
Share on other sites

Hi ProgAndi,

Thanks for the Link.

It works with this Declaration:

Local Const $tagNMHDR = "hwnd hWndFrom; uint_ptr IDFrom; int Code"

I must declare new $tagNMHDR as local const because autoit use StructureConstants.au3

and $tagNMHDR is here declared as Global Const with int.

DANKE -

Gruss Geronimo

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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