Ok, time for the next dumb question.
When using the win32.hlp file, there is often mention of macros that are available. For example-
QuoteThe LVM_SETITEMSTATE message changes the state of an item in a list view control. You can explicitly send this message or by using the ListView_SetItemState macro.
I've always used sendmessage but in the back of my mind, I always meant to find out how to use these macros. What is the exact form of the line of assembler to call this macro? My first guess would be-
ListView_SetItemState hLv,ebx,ecx,LVIF_STATE
but masm hates that. Second, third, and fourth guesses were no better. Is this just some leftover 'C' junk or can we actually use these macros?
There is no such a macro in Masm but you can build it. Probably, it's a construct related to C
Jim,
You would need to work out the actual API call required to do what you are after. It certainly is a target for writng a macro but you need the technical data to do it first.
Thanks all, that is what I suspected. It's just irritating to constantly have these references to non-existant macros or at least not knowing weither they exist or not. Thanks again, I'll just ignore the references. Perhaps we need to create our own asm-centric win32.hlp :wink
Jimq,
What would we do? Decompile the help file, search and delete all references to the word 'macro' and then recompile it? :green2
Paul
Among other things, yes!
I've already done this once, just to get the "find" button to show up.
Jimq,
Do you mean it defaults to find? That is something I never thought of and is very useful. It is the only tab I every use.
Paul
Well, not defaults to find exactly, but the find button is always available, so that you don't have to hit index first to get to the find screen.
Jimq,
Oh, yeah, that is irritating. Maybe I will do the same thing.
Paul
ListView_SetItemState Macro (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/listview/macros/listview_setitemstate.asp)
It's in 'commctrl.h'.
#define ListView_SetItemState(hwndLV, i, data, mask) \
{ LV_ITEM _ms_lvi;\
_ms_lvi.stateMask = mask;\
_ms_lvi.state = data;\
SNDMSG((hwndLV), LVM_SETITEMSTATE, (WPARAM)(i), (LPARAM)(LV_ITEM *)&_ms_lvi);\
}
As stated above, you would have to translate it to a MASM macro.
Thanks Greg. So it is pure 'C' stuff then.
Jim,
Give this a blast as it may do the job. I have no code set up to test it but it just loads the structure and does a SendMessage().
ListView_SetItemState MACRO handl,i,data,mask
IFNDEF @lvi@
.data?
@lvi@ LV_ITEM <>
.code
ENDIF
mov eax, mask
mov @lvi@.mask, eax
mov eax, data
mov @lvi@.data, eax
invoke SendMessage,handl,LVM_SETITEMSTATE,i,ADDR @lvi@
ENDM
Hutch,
If I read that script from the header file correctly, what I see is a generic SendMessage macro that can be used to send ANY message. That would be a very powerful addition to your preprocessor set. Very easy to create, also.
Paul
Very nice Hutch.
Thanks everybody. If you look at the first post, that macro was just an example, something I happened to be looking at just then, not a particular macro I needed. I just wanted to know about the macros described in win32.hlp in general, and I now have the answer, ignore them!