News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Listbox notification question

Started by travism, May 16, 2009, 03:39:50 AM

Previous topic - Next topic

travism

Hey guys sorry for asking so many questions but this project is really testing me since ive tried using everything I dont know how to do so that I can learn more. As they always say you can never ask to many questions... :) So ive given up on the caret part so far but now for when you click a listbox i want it to open the file selected... Im using a dialogbox and I cant figure out how to set the CS_DBLCLKS style so using WM_LBUTTONDBLCLK and WM_NCLBUTTONDBLCLK is out for me to be notified when a double click happens so then i tried LBN_DBLCLK and here was my code for that (My listbox does have LBS_NOTIFY):


WMCMD:
                 cmp d[uMsg],WM_COMMAND
                 jne >TRUE

                cmp d[wParam],LBN_DBLCLK
                jne >FALSE

                        ... Handling code goes here......

               jmp >TRUE


I really don't care to test that the id is the listbox since the form just has one listbox and the listbox takes up the form... But i just cant figure out how to get notified when a double click happens in it :( this is day 2 trying to figure this one out. Ive also tried


WMCMD:
                 cmp d[uMsg],LBN_DBLCLK

                 ..... The usual....

travism

I also just tried this and it still doesn't work... nothing is working  :'(


WMCREATE:
                       cmp d[uMsg],WM_CREATE
                       jne >TRUE

                      invoke GetDlgItem,[hWnd],IDC_LISTBOX
                      invoke SetWindowLong,eax,GWL_WNDPROC,[ListBoxProc]


I tried changing it to addr ListBoxProc also and that wont work either. :(

ToutEnMasm


The LBN_DBLCLK is a notify message,it must be used as this

Quote
   .elseif uMsg == WM_NOTIFY
      mov     ebx, lParam          ; Get pointer to NMHDR
      mov     eax, (NMHDR ptr [ebx]).code      ;ex:LBN_DBLCLK
      mov     edx,(NMHDR ptr [ebx]).hwndFrom
                            .if edx == HandleListbox && eax == LBN_DBLCLK
                            .endif
                             

travism

Hmm that says for NM_DBLCLK? well i tried it both ways anyway and doesnt work.. here is my numerous codes I tried. I tried converting it to goasm syntax..



.DATA
NHDR  NMHDR <?>
.......
.CODE
......
mov ebx,[lParam]
mov [NHDR],ebx
cmp d[NHDR.code],NM_DBLCLK


I also tried changing NM_DBLCLK to LBN_DBLCLK and it still doesnt work... :S


travism

FINALLY got it here is the working code:


WMCMD:
                cmp d[uMsg],WM_COMMAND
                jne >TRUE

                         mov eax,[wParam]
                         cmp d[lParam],IDC_FLIST
                        jne >TRUE
                                 
                                 shr  eax,16                 
                                 cmp ax,LBN_DBLCLK
                                jne >TRUE

                                        .... my code here

                jmp >TRUE


Thanks for all your help people!