Shoutbox

[?] TVN_BEGINLABELEDIT handling - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [?] TVN_BEGINLABELEDIT handling (/showthread.php?tid=88833)

[?] TVN_BEGINLABELEDIT handling by SmokingCookie on 01-31-2009 at 06:54 PM

Hi,

I've got a 'simple' question.

TVN_BEGINLABELEDIT is sent in the form of a WM_NOTIFY message, the last one pointing to an NMHDR structure. In the documentation, they talk about the lParam being a pointer to an NMTVDISPINFO structure. There is no documentation on where to find that specific pointer. I don't think I'll find it in the NMHDR, and the idCtrl part of WM_NOTIFY isn't an NMHDR-pointer either.

Does anyone know where that pointer to NMTVDISPINFO is?

Thanks in advance.


RE: [?] TVN_BEGINLABELEDIT handling by Mnjul on 01-31-2009 at 07:23 PM

quote:
Originally posted by SmokingCookie
they talk about the lParam being a pointer to an NMTVDISPINFO structure
That's it, just use the lParam as though it's a pointer to a NMTVDISPINFO structue :)

I hope I won't confuse you - NMTVDISPINFO is essentially a "substructure" (as "subclass" in OOP sense) of NMHDR
RE: [?] TVN_BEGINLABELEDIT handling by SmokingCookie on 01-31-2009 at 07:29 PM

What do you mean??

Docs say that there's an NMHDR structure in lParam..? (or do I need glasses?)


RE: [?] TVN_BEGINLABELEDIT handling by matty on 01-31-2009 at 07:45 PM

The pointer to NMTVDISPINFO is the same as the pointer to TV_DISPINFO.

What you need to do is use RtlMoveMemory to copy the lParam memory to another location that is of adequate size.

Javascript code:
function OnWindowEvent_MessageNotification(pPlusWnd, nMessage, wParam, lParam) {
        if (nMessage === WM_NOTIFY) {
                /*
                    NMHDR : 12
                    TVITEM : 40
                */

                var NMTVDISPINFO = Interop.Allocate(52);
                Interop.Call('kernel32', 'RtlMoveMemory', NMTVDISPINFO, lParam, 52);
        }
}


RE: [?] TVN_BEGINLABELEDIT handling by SmokingCookie on 01-31-2009 at 07:53 PM

I see. This "NMTVDISPINFO" contains NMHDR and TVITEM, so I have access to both structures using RtlMoveMemory, right?

(Please correct me of I'm wrong)


RE: [?] TVN_BEGINLABELEDIT handling by matty on 01-31-2009 at 09:33 PM

no because NMTVDSPINFO is made up of both NMHDR and TVITEM therefore it is one structure 52 bytes in size. You access each by using ReadDWORD or ReadWORD. The NMHDR structure is from 0-8 and the TVITEM is fro 12-18.


RE: [?] TVN_BEGINLABELEDIT handling by SmokingCookie on 01-31-2009 at 10:14 PM

Well, I got it working, thanks :D