• Welcome to Jose's Read Only Forum 2023.
 

Working in v8.04, not in v10.03

Started by Olav Bergesen, August 01, 2012, 07:32:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Olav Bergesen

Hello,

I have some code which works in PB/Win v8.04 , but not in v10.03. The code enumerates Windows Registered Filetypes
from the registry, and place them in a combobox along with their associated icons.

The problem is that in v10.03 the icons don't show up in the combobox, but if I use José Roca's header files
instead of those supplied with the compiler; then it works in v10.03 too.

Hopefully, could somebody come up with an idea of what to look for in order to solve this?

Thanks for your attention?

Source code attached this message.
--

Regards,

Olav B


José Roca

The problem must be in IconHandle = ExtractIconEx(FileName, IconPos,PLargeIcon, PSmallIcon, 1)

In the PB10 headers, they have defined the function as:


DECLARE FUNCTION ExtractIconExA LIB "Shell32.dll" ALIAS "ExtractIconExA" ( _
    lpszFile AS ASCIIZ, BYVAL nIconIndex AS LONG, _
    BYVAL phiconLarge AS DWORD PTR, BYVAL phiconSmall AS DWORD PTR, _
    BYVAL nIcons AS DWORD) AS DWORD


whereas I have it defined as:


DECLARE FUNCTION ExtractIconExA IMPORT "SHELL32.DLL" ALIAS "ExtractIconExA" ( _
   BYREF lpszFile AS ASCIIZ _                           ' __in LPCSTR lpszFile
, BYVAL nIconIndex AS LONG _                           ' __in int nIconIndex
, BYREF phiconLarge AS DWORD _                         ' __out HICON *phiconLarge
, BYREF phiconSmall AS DWORD _                         ' __out HICON *phiconSmall
, BYVAL nIcons AS DWORD _                              ' __in UINT nIcons
) AS DWORD                                             ' UINT


So, if you use the PB headers, you will have to use:


IconHandle = ExtractIconEx(FileName, IconPos, BYVAL VARPTR(PLargeIcon), BYVAL VARPTR(PSmallIcon), 1)


Olav Bergesen

Muchas gracias!

Worked like a charm.

Thanks for excellent and quick support!
--
Regards,

Olav B