2

I try to declare EnumDynamicTimeZoneInformation (https://learn.microsoft.com/en-us/windows/win32/api/timezoneapi/nf-timezoneapi-enumdynamictimezoneinformation) in Delphi like this :

function EnumDynamicTimeZoneInformation(dwIndex: DWORD; lpTimeZoneInformation: PDynamicTimeZoneInformation): DWORD; stdcall; external kernel32 name 'EnumDynamicTimeZoneInformation';

however at runtime i get this error :

The procedure entry point EnumDynamicTimeZoneInformation could not be located in the dynamic link library C:\temp\test\test.exe

What did i do wrong? i m on Windows 8.1 and it's say that this function is supported still windows 8

Minimum supported client Windows 8 [desktop apps | UWP apps]

zeus
  • 12,173
  • 9
  • 63
  • 184
  • 4
    this api exported from *advapi32.dll* but not from *kernel32.dll* - so you wrong declare it. – RbMm Mar 07 '20 at 13:50
  • 1
    so not sure how this correct use in delphi, but in *c/c++* need link with *advapi32.lib* ( *advapi32.dll* ) or with *mincore.lib* or *mmos.lib* - used [*api-ms-win-core-timezone-l1-1-0.dll*](https://learn.microsoft.com/en-us/windows/win32/apiindex/windows-81-api-sets) - resolved to *kernelbase.dll* – RbMm Mar 07 '20 at 14:03
  • Documention, and other sources [like this answer](https://stackoverflow.com/a/22602383/511529), suggest it's kernel32, but that doesn't work as you found out. `advapi32` does, but using the [API Set name](https://learn.microsoft.com/en-us/windows/win32/apiindex/windows-apisets) `'api-ms-win-core-timezone-l1-1-0'` seems the cleanest choice. Windows redirects that to the right dll. Btw, not sure why this is closed as typo. There is a bit more to it than that. – GolezTrol Mar 08 '20 at 07:22
  • 1
    @GolezTrol: You may vote to reopen the question. When I voted to close, I was under the impression that this was nothing more than a trivial typo (did only read the first comment above). – Andreas Rejbrand Mar 08 '20 at 08:39

0 Answers0