views:

137

answers:

2

I'm using the Win API function EnumUILanguages on a Windows XP Embedded build that has Chinese and French shell language packs (MUI) installed, however the API call only returns one language code: 0409 (the base en-US installed language).

If I look in the registry under HKLM\SYSTEM\CurrentControlSet\Control\Nls\MUILanguages\ then I can see all of the available languages (0409, 040C, 0804). I'd prefer to use the API call over accessing the registry directly.... any suggestions as to why this API call returns just the only language?

Thanks, Duncan


Update: A little code and information - I'm calling this from a form with a memo box and a button. Press the button, the WinAPI call is initiated and a pointer to the Strings property of the TMemoBox passed so the call back function can write to it.

// The Button handler
procedure TForm1.btnEnumLangsClick(Sender: TObject);
var
  dwFlags : DWORD;
  callback : TEnumUILanguagesProc;
begin
  dwFlags := 0; // Same as MUI_LANGUAGE_ID for WinXP compat

  EnumUILanguagesW( @EnumUILanguages_Callback,
    dwFlags,
    LParam(memoUILangs.Lines) // Pointer to Memo box text lines
  );

end;


// API Callback function:
function EnumUILanguages_Callback(lpUILanguageString: PWideChar;
  List: TStringList): BOOL; stdcall;
begin
  // Add language ID to the memo box
  List.Add(lpUILanguageString);
  // Return true so the callback continues to run
  Result := True;
end;
+2  A: 

EnumUILanguages only calls the callback as long as you return true in the callback. Could it be that you return false right in the first callback and EnumUILanguages stops?

HalloDu
Good guess, given the lack of information in the question.
gabr
Thanks HalloDu, I wasn't returning anything from my callback function (I'd actually declared it as a Delphi procedure). It is now a function that returns true, however the problem persists. I've updated the original question with code samples. Please advise you need more details - many thanks!
Duncan
A: 
Paul-Jan
http://msdn.microsoft.com/en-us/goglobal/bb688164.aspx dwFlags: Reserved. Must be zero.
Gerry
Sorry, missed out on the XP restriction. Embedded, no less.
Paul-Jan