How to get Country In Pascal lazarus / 8-Other ---------------------------------------------------------------------- Nolan · 2022-03-15 07:54 I have a Problem. I am trying to get the country name (Like 2 letter of country) But i have this trouble - Its nnot working my code is looking Like this Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; interface uses  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; type  TForm1 = class(TForm)    Button1: TButton;    procedure Button1Click(Sender: TObject);  private    { Private declarations }  public    { Public declarations }  end; var  Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject);  var  country : String;  Temp: String; begin    country := GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SABBREVCTRYNAME, Temp, 256);    showmessage(country);end; end. But i am getting an Error Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i [dcc32 Error] Unit1.pas(32): E2010 Incompatible types: 'PWideChar' and 'string' On the GetLocalInfo() Line. Please what is wrong? ---------------------------------------------------------------------- Zvoni · 2022-03-15 08:12 Besides the Fact that GetLocaleInfo returns a LongInt you try to assign to a String? ---------------------------------------------------------------------- marcov · 2022-03-15 08:53 From sysutils sources:Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function GetLocaleStr(LID, LT: Longint; const Def: string): AnsiString;var  L: Integer;  Buf: unicodestring;begin  L := GetLocaleInfoW(LID, LT, nil, 0);  if L > 0 then    begin      SetLength(Buf,L-1); // L includes terminating NULL      if l>1 Then      L := GetLocaleInfoW(LID, LT, @Buf[1], L);      result:=buf;    end  else    Result := Def;end; ---------------------------------------------------------------------- wp · 2022-03-15 09:05 Quote from: Nolan on March 15, 2022, 08:54:29 ammy code is looking Like this Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;  But i am getting an Error Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i [dcc32 Error] Unit1.pas(32): E2010 Incompatible types: 'PWideChar' and 'string' On the GetLocalInfo() Line. Please what is wrong? I don't understand this post. I am very sure that this Delphi-like uses clause will not compile here. How then can you report the error about incompatible types? And I've never seen a "dcc32 Error" which looks like a Delphi error. Did you use Delphi to compile your code? Why then do you report the error in a Lazarus forum? Please make your descriptions as precise as possible. We cannot read your mind. ---------------------------------------------------------------------- Zvoni · 2022-03-15 09:12 And this one gives it away.... Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  {$R *.dfm} ---------------------------------------------------------------------- Thaddy · 2022-03-15 09:42 No, dcc32 and the uses clause give it away. Lazarus can handle dfm too.