News:

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

Macros from Win32.hlp

Started by Jimg, July 30, 2005, 03:54:44 PM

Previous topic - Next topic

Jimg

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?

Vortex

There is no such a macro in Masm but you can build it. Probably, it's a construct related to C

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Jimg

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

PBrennick

Jimq,
What would we do?  Decompile the help file, search and delete all references to the word 'macro' and then recompile it?  :green2

Paul
The GeneSys Project is available from:
The Repository or My crappy website

Jimg

Among other things, yes!

I've already done this once, just to get the "find" button to show up.

PBrennick

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
The GeneSys Project is available from:
The Repository or My crappy website

Jimg

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.

PBrennick

Jimq,
Oh, yeah, that is irritating.  Maybe I will do the same thing.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

GregL

ListView_SetItemState Macro

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.


Jimg

Thanks Greg.  So it is pure 'C' stuff then.

hutch--

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
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

PBrennick

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
The GeneSys Project is available from:
The Repository or My crappy website

Jimg

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!