Jose's Read Only Forum 2023

IT-Consultant: José Roca (PBWIN 10+/PBCC 6+) (Archive only) => Discussion => Topic started by: Olav Bergesen on August 01, 2012, 07:32:24 PM

Title: Working in v8.04, not in v10.03
Post by: Olav Bergesen on August 01, 2012, 07:32:24 PM
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

Title: Re: Working in v8.04, not in v10.03
Post by: José Roca on August 01, 2012, 09:28:20 PM
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)

Title: Re: Working in v8.04, not in v10.03
Post by: Olav Bergesen on August 01, 2012, 10:06:09 PM
Muchas gracias!

Worked like a charm.

Thanks for excellent and quick support!
--
Regards,

Olav B