Hi,
Unit shlobj has:
SIGDN = longint;But the constants are for example:
SIGDN_FILESYSPATH = $80058000;Maybe SIGDN must be DWord?
Mattias

Mailing lists / fpc-devel / 2026-06
10 messages · 5 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hi,
Unit shlobj has:
SIGDN = longint;But the constants are for example:
SIGDN_FILESYSPATH = $80058000;Maybe SIGDN must be DWord?
Mattias
I think it's deliberately designed that way so such codes are negative numbers in signed 32-bit.
Gareth aka. Kit
J. Gareth "Kit" Moreton wroteI think it's deliberately designed that way so such codes are negative numbers in signed 32-bit.
I spotted it because code fails to compile with a range check error.
Windows docs says these constants are from an enumeration.
Mattias
Hmmm, that's a little bit difficult. What happens if you define the constants as, say, "SIGDN_FILESYSPATH = longint($80058000);"?
Gareth aka. Kit
J. Gareth "Kit" Moreton wroteHmmm, that's a little bit difficult. What happens if you define the constants as, say, "SIGDN_FILESYSPATH = longint($80058000);"?
Then it would compile.
But it seems the C code uses DWord, so why should FPC use longint?
Mattias
Ah, if you mean that SIGDN is defined as a DWord in its C headers but as a LongInt in FPC, then I think it's due to backwards compatibility back when Turbo Pascal and Delphi didn't have an unsigned 32-bit integer type (LongWord), and so such a hexadecimal constant would default to LongInt.
Gareth aka. Kit
Then it would compile. But it seems the C code uses DWord, so why should FPC use longint?…
Historic reasons, most likely.
Of course it should not use longint these days, it must be changed to DWord/Cardinal.
Michael.
Then it would compile. But it seems the C code uses DWord, so why should FPC use longint?…
W dniu 2026-06-25 o 00:51, Mattias Gaertner via fpc-devel pisze:
This is how it's defined in header file:
enum _SIGDN
{
SIGDN_NORMALDISPLAY = 0,
SIGDN_PARENTRELATIVEPARSING = ( int )0x80018001,
SIGDN_DESKTOPABSOLUTEPARSING = ( int )0x80028000, SIGDN_PARENTRELATIVEEDITING = ( int )0x80031001,
SIGDN_DESKTOPABSOLUTEEDITING = ( int )0x8004c000, SIGDN_FILESYSPATH = ( int )0x80058000,
SIGDN_URL = ( int )0x80068000,
SIGDN_PARENTRELATIVEFORADDRESSBAR = ( int )0x8007c001, SIGDN_PARENTRELATIVE = ( int )0x80080001,
SIGDN_PARENTRELATIVEFORUI = ( int )0x80094001
} SIGDN;It looks like it's a signed integer.
https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/ne-shobjidl_core-sigdn#constants
Michał.
Ah, thx, so the FPC constants need the typecast.
Mattias
Op 25-6-2026 om 11:58 schreef Mattias Gaertner via fpc-devel:
Shall I change the definition of constants in the header to longint($8000..) ?