The MASM Forum

General => The Workshop => Topic started by: jimg on April 06, 2018, 04:40:40 AM

Title: How do I do IID_IImageList TGUID '{46EB5926-582E-4017-9FDF-E8998DAA0950}'
Post by: jimg on April 06, 2018, 04:40:40 AM
Still on my neverending quest to get the images from the desktop syslistview32 in 64bit windows.

All I can get is the handle to the imagelist that the desktop listview uses.

How do I copy an imagelist for my own uses given only the handle?

The only function I've found is HIMAGELIST_QueryInterface. https://msdn.microsoft.com/en-us/library/windows/desktop/bb761510(v=vs.85).aspx (https://msdn.microsoft.com/en-us/library/windows/desktop/bb761510(v=vs.85).aspx)

Parameters:

himl [in]
    Type: HIMAGELIST
    The handle to the image list.
riid [in]
    Type: REFIID
    The identifier of the interface being requested. Normally IID_IImageList or IID_IImageList2.
ppv [out]
    Type: void**  (?)
    When this method returns, contains the address of the interface pointer requested in riid. If the object does not support the interface specified in riid, ppv is NULL.

So... I finally found the value of IID_IImageList:

IID_IImageList TGUID  '{46EB5926-582E-4017-9FDF-E8998DAA0950}'

How do I enter this constant in masm?
Title: Re: How do I do IID_IImageList TGUID '{46EB5926-582E-4017-9FDF-E8998DAA0950}'
Post by: Siekmanski on April 06, 2018, 06:31:59 AM
You can write it this way,

.const
IID_IImageList TEXTEQU <{046EB5926h,0582Eh,04017h,{09Fh,0DFh,0E8h,099h,08Dh,0AAh,009h,050h}}>
Title: Re: How do I do IID_IImageList TGUID '{46EB5926-582E-4017-9FDF-E8998DAA0950}'
Post by: jimg on April 06, 2018, 06:43:00 AM
Thank you.  I was expecting something in a .data statement rather than an assembler string, let me think about what you are saying.
Title: Re: How do I do IID_IImageList TGUID '{46EB5926-582E-4017-9FDF-E8998DAA0950}'
Post by: Siekmanski on April 06, 2018, 07:00:34 AM
For COM interfaces I use this macro to place the interface constant in the data section,

.const
GUID_ADDR MACRO guid_text:REQ
LOCAL guid_data
.data
guid_data GUID guid_text
.code
EXITM <addr (guid_data)>
ENDM

IID_IImageList TEXTEQU <{046EB5926h,0582Eh,04017h,{09Fh,0DFh,0E8h,099h,08Dh,0AAh,009h,050h}}>

LPPPV   typedef PTR DWORD

.data
ppv     LPPPV NULL
HIMAGELIST dd 0

.code
    invoke    HIMAGELIST_QueryInterface,HIMAGELIST,GUID_ADDR(IID_IImageList),addr ppv


This way you can make an include file with all the interface constants.
And when you only need some of them you don't bloat your executable.
Title: Re: How do I do IID_IImageList TGUID '{46EB5926-582E-4017-9FDF-E8998DAA0950}'
Post by: jimg on April 06, 2018, 07:17:13 AM
wow :dazzled:
let me just step back through the looking glass...
Title: Re: How do I do IID_IImageList TGUID '{46EB5926-582E-4017-9FDF-E8998DAA0950}'
Post by: Siekmanski on April 06, 2018, 07:31:06 AM
 :biggrin:
I think you need to translate the "IImageList" interface as well.
And then you need a "com invoke" macro to execute the interface members.
Title: Re: How do I do IID_IImageList TGUID '{46EB5926-582E-4017-9FDF-E8998DAA0950}'
Post by: jimg on April 06, 2018, 07:41:09 AM
Thanks Again.
More than I bargained for.  That must be why I'm getting-
"Entry Point Not Found
The procedure entry point HIMAGELIST_QueryInterface
could not be located in the dynamic link library (name of my .exe)."

I don't know why I thought this would be straight forward.
Title: Re: How do I do IID_IImageList TGUID '{46EB5926-582E-4017-9FDF-E8998DAA0950}'
Post by: Siekmanski on April 06, 2018, 07:50:55 AM
Programming COM interfaces is a lot of work.  :t
The "HIMAGELIST_QueryInterface" function is available in Comctl32.lib ( Comctl32.dll )

If you need a COM example, find one of my D3D9 sources I have posted and see how it can be done in Masm.
Title: Re: How do I do IID_IImageList TGUID '{46EB5926-582E-4017-9FDF-E8998DAA0950}'
Post by: jimg on April 06, 2018, 07:58:24 AM
The big surprise was I had no idea it involved com when I started :icon_rolleyes:
Title: Re: How do I do IID_IImageList TGUID '{46EB5926-582E-4017-9FDF-E8998DAA0950}'
Post by: Siekmanski on April 06, 2018, 08:14:40 AM
Maybe Comctl32.lib is a wrapper library and you don't have to mess with COM and use only functions instead.
I don't know and sadly don't have the time to investigate it.  :(

ImageList_CoCreateInstance function, creates com objects,
https://msdn.microsoft.com/en-us/library/windows/desktop/bb761518(v=vs.85).aspx

EDIT: I think it can be done without COM programming, found a post on the old forum that uses "ImageList_Draw"

http://www.masmforum.com/board/index.php?topic=9964.0

http://msdn.microsoft.com/en-us/library/windows/desktop/bb761389%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/hh270414%28v=vs.85%29.aspx

Title: Re: How do I do IID_IImageList TGUID '{46EB5926-582E-4017-9FDF-E8998DAA0950}'
Post by: jimg on April 06, 2018, 08:52:52 AM
Okay.  Lots to look at here.  Thanks.   (As an aside, I'm always amazed at how much I like the old board.  Even though the text seems the same size, it always looks sharper and easier to read than the new.  The new always seems a bit fuzzy to me.  Perhaps the white background rather than the blue-gray.  Hope Hutch isn't listening.)
Title: Re: How do I do IID_IImageList TGUID '{46EB5926-582E-4017-9FDF-E8998DAA0950}'
Post by: hutch-- on April 06, 2018, 09:23:56 AM
 :biggrin:
Title: Re: How do I do IID_IImageList TGUID '{46EB5926-582E-4017-9FDF-E8998DAA0950}'
Post by: Lonewolff on April 06, 2018, 09:29:27 AM
@Siekmanski - Hey dude, I am trying to learn COM myself also. Wrapping the DX11 functions I need to get a bare bones application running.

Do you have a link to your DX9 library so I can take a look and see if I can follow how you went about it?

I am pretty up to speed with the workings of DX11 and have done quite a bit in C++ with it. But it would be extremely cool to replicate what I have done in C++ back in ASM.  8)

Just need a few hints to get up and walking in the right direction.
Title: Re: How do I do IID_IImageList TGUID '{46EB5926-582E-4017-9FDF-E8998DAA0950}'
Post by: Siekmanski on April 06, 2018, 10:03:58 AM
What a coincidence, I just answered your previous topic with the same question.  :biggrin:

Title: Re: How do I do IID_IImageList TGUID '{46EB5926-582E-4017-9FDF-E8998DAA0950}'
Post by: nidud on April 06, 2018, 10:13:20 AM
deleted
Title: Re: How do I do IID_IImageList TGUID '{46EB5926-582E-4017-9FDF-E8998DAA0950}'
Post by: Lonewolff on April 06, 2018, 10:32:48 AM
Quote from: Siekmanski on April 06, 2018, 10:03:58 AM
What a coincidence, I just answered your previous topic with the same question.  :biggrin:

Ha! You did too.  8)

I'll continue this there :)