Recent

Author Topic: ImageList_CoCreateInstance definition missing  (Read 1033 times)

440bx

  • Hero Member
  • *****
  • Posts: 5595
ImageList_CoCreateInstance definition missing
« on: May 28, 2025, 08:10:51 am »
the definition of  ImageList_CoCreateInstance is missing.  Its C definition is at:
https://learn.microsoft.com/en-us/windows/win32/api/commoncontrols/nf-commoncontrols-imagelist_cocreateinstance

A Pascal definition that must be modified is:
Code: Pascal  [Select][+][-]
  1. function ImageList_CoCreateInstance
  2.            (
  3.             { _in_           } InClsidRef          : REFCLSID;
  4.             { _in_opt_ const } InoptOuterIUnknown  : PIUnknown;
  5.             { _in_           } InInterfaceIdRef    : REFIID;
  6.             { _out_          } OutInterfacePointer : ppointer
  7.            )
  8.          : HRESULT; stdcall; external comctl32;
  9.  
HTH.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

gues1

  • Jr. Member
  • **
  • Posts: 95
Re: ImageList_CoCreateInstance definition missing
« Reply #1 on: May 28, 2025, 09:17:34 am »
If you install Delphi Community Edition (look for license before if you are eligible) you will have access to some hundred of WinApi wrapper, all the Windows api (also deprecated) published by Microsoft.
Some of them are for example ML (AI, Machine learning apis), XBOX apis, etc ...
Every api have a link to proper documentation page on Microsoft learn page.

These is a (poor) explanation link: https://getitnow.embarcadero.com/windows-api-from-winmd/

They are called WinMD and come from Microsoft WinMD metadata, for Win32 and Win64.

I often use them 'cause they are the correct "translation" in Pascal of the WinApi. Also Delphi has some bugs in WinAPi RTL definitions, but those not.

You can enjoy with a new world.
« Last Edit: May 28, 2025, 09:19:56 am by gues1 »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12334
  • FPC developer.
Re: ImageList_CoCreateInstance definition missing
« Reply #2 on: May 28, 2025, 09:39:04 am »
Done I hope.

440bx

  • Hero Member
  • *****
  • Posts: 5595
Re: ImageList_CoCreateInstance definition missing
« Reply #3 on: May 28, 2025, 11:34:52 am »
@gues1,

That's quite interesting. 

Do you happen to know where MS' WinMD metadata is ?  I'd like to have a look at that.

I searched for it but couldn't find it.  Most likely didn't search for the right thing.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

gues1

  • Jr. Member
  • **
  • Posts: 95
Re: ImageList_CoCreateInstance definition missing
« Reply #4 on: May 28, 2025, 11:51:05 am »
@gues1,
That's quite interesting. 
Do you happen to know where MS' WinMD metadata is ?  I'd like to have a look at that.
I searched for it but couldn't find it.  Most likely didn't search for the right thing.
I don't know where they come from. I know that this metadata can be generated (or are generated) by Microsoft compiler. But really don't know how.

Anyway Embarcadero generated the wrappers for all Api from this WinMD (metadata). I saw around that also for other language there are some working around WinMD (may be "GO").

440bx

  • Hero Member
  • *****
  • Posts: 5595
Re: ImageList_CoCreateInstance definition missing
« Reply #5 on: May 28, 2025, 12:03:52 pm »
Thank you @gues1.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.


440bx

  • Hero Member
  • *****
  • Posts: 5595
Re: ImageList_CoCreateInstance definition missing
« Reply #7 on: May 28, 2025, 08:26:59 pm »
After a fair amount of digging I found where to download the metadata from.  The url is:
https://www.nuget.org/packages/Microsoft.Windows.SDK.Win32Metadata/

Unfortunately, ILDasm does not fully expand the tree when doing a dump treeview (the actual function definitions are left out, which is the whole point of having the file.)
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

 

TinyPortal © 2005-2018