Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6982831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:20:24+00:00 2026-05-27T18:20:24+00:00

i am trying to call EnumSystemLocales in Delphi. For example: { Called for each

  • 0

i am trying to call EnumSystemLocales in Delphi. For example:

{ Called for each supported locale. }
function LocalesCallback(Name: PChar): BOOL; stdcall;
begin
   OutputDebugString(Name);
   Result := Bool(1); //True
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
   EnumSystemLocales(@LocalesCallback, LCID_SUPPORTED);
end;

The problem is that the callback is only being called once.

Note: EnumSystemLocales is returning true, indicating success.

The remarks of EnumSystemLocales says that my callback must return true to continue enumerating (or more correctly, must not return false to continue enumerating):

The function enumerates locales by passing locale identifiers, one at
a time, to the specified application-defined callback function. This
continues until all of the installed or supported locale identifiers
have been passed to the callback function or the callback function
returns FALSE.

On the documentation of the callback function:

BOOL CALLBACK EnumLocalesProc(
  __in  LPTSTR lpLocaleString
);

a commenter has come across a problem with the definition of “not false”:

This function must return 1, not (DWORD) -1 to continue processing

This makes me think that delphi’s definition of

True: BOOL;

is different than Window’s. (That’s why i tried a return value of BOOL(1) – which still fails).

Next i wonder if it’s not even supposed to be stdcall.

Either way, can someone suggest how, in Delpi, to call EnumSystemLocales?


Edit: Also tried:

  • Result := BOOL(-1);
  • Result := BOOL($FFFFFFFF);
  • Result := BOOL(1);
  • Result := True;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:20:25+00:00Added an answer on May 27, 2026 at 6:20 pm

    try declarating the LocalesCallback function like this

    function LocalesCallback(Name: PChar): Integer; stdcall;
    

    check this sample

    {$APPTYPE CONSOLE}
    
    {$R *.res}
    
    uses
      Windows,
      SysUtils;
    
    function LocalesCallback(Name: PChar): Integer; stdcall;
    begin
       Writeln(Name);
       Result := 1;
    end;
    
    begin
      try
        EnumSystemLocales(@LocalesCallback, LCID_SUPPORTED);
      except
        on E: Exception do
          Writeln(E.ClassName, ': ', E.Message);
      end;
      Readln;
    end.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to call a function after I load some XML into Actionscript, and
I'm trying to call the OpenThemeData (see msdn OpenThemeData ) function but I couldn't
I am trying to call a c# function from f# where the c# function
Trying to call the projects controller and the editproject function and pass an id
When trying to call this function in my code i get the error in
Im trying to call the function: friend ostream& operator<<(ostream& out, stack::myItem& theItem); that is
Im trying to call functions with same signature. Example: There are two functions with
In the following I am trying call action script function from js function. What
Am trying to call a JS script from a function library in another script.
Im trying to call the following code: Ext.namespace(menu); menu.menuItems = function(){ var menuItems= [{

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.