I am subclassing a parent window of a listview control so that it sends messages from the listview directly to the main window for processing... that is not the real difficulty. The problem is trapping and identifying NM_DBLCLK messages. I want to know when the listview control is being doubleclicked.

I looked up the value for NM_DBLCLK in the windows.inc file and it is (NM_FIRST - 3) which turns out to be 0xFFFFFFFD. Ok that's fine but why dosent it work? So I open the disassembler and read the actual NM_ message codes the program is generating when I doubleclick on the listview and they are nothing like 0xFFFFFFFD. They all start with 0012F... which is quite confusing. If anybody can help I would really appreciate it.

Johnny
Posted on 2004-01-08 14:05:03 by JohnnyQuest
There is a problem with your attachment

akyprian
Posted on 2004-01-09 12:30:53 by akyprian
Here it is:
Posted on 2004-01-09 14:59:56 by JohnnyQuest
I am subclassing a parent window of a listview control so that it sends messages from the listview directly to the main window for processing... that is not the real difficulty. The problem is trapping and identifying NM_DBLCLK messages. I want to know when the listview control is being doubleclicked.

I looked up the value for NM_DBLCLK in the windows.inc file and it is (NM_FIRST - 3) which turns out to be 0xFFFFFFFD. Ok that's fine but why dosent it work? So I open the disassembler and read the actual NM_ message codes the program is generating when I doubleclick on the listview and they are nothing like 0xFFFFFFFD. They all start with 0012F... which is quite confusing. If anybody can help I would really appreciate it.

Johnny
Posted on 2004-01-09 15:06:01 by JohnnyQuest
JohnnyQuest,
No one can help you easily if you don't post the source code. Ratch
Posted on 2004-01-09 16:31:23 by Ratch
Perhaps it's a little obvious, but NM_DBLCLK is not a message, but a notification code. Check for WM_NOTIFY messages.
Other than that, there's not much one can do to help without the sources :(
Posted on 2004-01-09 17:13:49 by QvasiModo
Hi both Ratch and Qvasimodo are right :grin:

I upoad a sample project to demonstrate the idea.

Regards,

akyprian
Posted on 2004-01-09 17:16:26 by akyprian
I upoad a sample project to demonstrate the idea.

Regards,

akyprian
Posted on 2004-01-09 17:21:01 by akyprian
:grin: Funny messagebox...
Posted on 2004-01-09 17:38:18 by QvasiModo
I'm sorry guys... I thought I had all the project files in there but I left out the asm by mistake. Here is the full project with the asm file. I really appreciate your help.

Johhny
Posted on 2004-01-09 17:46:44 by JohnnyQuest
Akyprian thanks for the custom example man! lol

regards,

Johnny
Posted on 2004-01-09 17:51:56 by JohnnyQuest
IMO here's the problem:


.elseif uMsg==WM_NOTIFY
.if wParam == PortListID ; Get doubleclicks from PortList
[COLOR=RED]push lParam
pop ptrNotifyStruct
mov eax, (NMHDR PTR [ptrNotifyStruct]).code

.if ax == NM_DBLCLK[/COLOR]; NM_DBLCLICK!!!!
; Now determine which column was doubleclicked
Invoke MessageBox,NULL,ADDR szTest, Offset szAppName, MB_OK

.endif
.endif

It should be something like:
mov edx,lParam

mov eax,[edx].NMHDR.code
.if eax == NM_DBLCLK
Posted on 2004-01-09 18:01:33 by QvasiModo
It seems the problem I was having was not with NM_DBLCLK messages it was with using a local variable as a pointer. For some reason this doesnt work:

local structPointer:DWORD

push lParam
pop structPointer
mov eax, .NMHDR.code

.if eax == NM_DBLCLK
..do whatever...

When I replace the structPointer local variable with an actual register like in Akyprian's example the reference works fine.

PUSH EDI
MOV EDI,lParam
MOV EAX,.NMHDR.hwndFrom
.If EAX==hList ....

Johnny
Posted on 2004-01-09 18:15:13 by JohnnyQuest
Man you guys respond FAST! Thanks for all your help!

regards,

Johnny
Posted on 2004-01-09 18:16:50 by JohnnyQuest
Originally posted by JohnFound:
It seems the problem I was having was not with NM_DBLCLK messages it was with using a local variable as a pointer.

The CPU does not handle addressing that way. You need to use a hardcoded immediate value and/or a register. Since local variables are located in the stack and addressed using EBP, your code was interpreted by MASM as:

mov eax,

or something like that. Being your local variable, and 0ch the offset to the struct member. (As if your local variable was holding the actual structure rather than a pointer to it).

Hope that helps :)
Posted on 2004-01-09 18:18:56 by QvasiModo