Delphi HttpResponse Error Solution

Error: No mapping for the Unicode character exists in the target multi-byte code page

var
HttpClient: THttpClient;
HttpResponse: IHttpResponse;
begin
HttpClient := THTTPClient.Create;
try
HttpResponse := HttpClient.Get(AURL);
//Result := HttpResponse.ContentAsString();
Result := HttpResponse.ContentAsString(TEncoding.ANSI);
finally
HttpClient.Free;
end;
end;

Delphi Elevated Application Drag & Drop

Dragging & dropping files (Explorer) to elevated application:

procedure SetDragAndDropOnSystemsWIthUAC(Wnd : HWND; IsEnabled : boolean);
type
  TChangeWindowMessageFilter = function(Msg : Cardinal; Action : Word) : Bool; stdcall;
const
  Msg_Add = 1;
  WM_COPYGLOBALDATA = $49;
var
  DllHandle : THandle;
  ChangeWindowMessageFilter : TChangeWindowMessageFilter;
begin
  DllHandle := LoadLibrary('user32.dll');
  if DllHandle > 0 then
  begin
    ChangeWindowMessageFilter := GetProcAddress(DllHandle, 'ChangeWindowMessageFilter');
    if Assigned(ChangeWindowMessageFilter) then
    begin
      DragAcceptFiles(Wnd, IsEnabled);
      ChangeWindowMessageFilter(WM_DROPFILES, Msg_Add);
      ChangeWindowMessageFilter(WM_COPYGLOBALDATA, Msg_Add);
    end;
  end;
end;

Get MachineGUID using Delphi

var
  fReg:TRegistry;
  GUIDStr:String;
begin
  try
    fReg:= TRegistry.Create(KEY_WRITE OR KEY_WOW64_64KEY);
    fReg.RootKey:=HKEY_LOCAL_MACHINE;
    if fReg.OpenKeyReadOnly('\SOFTWARE\Microsoft\Cryptography') then
      begin
        GUIDStr:=freg.ReadString('MachineGuid');
        edit1.Text:=GUIDStr;
      end;
  finally
    fReg.Free;
  end;
end;

Delphi Reverse Tab

BLOCK INDENT AND UNINDENT: SHIFT-CTRL-I and SHIFT-CTRL-U

You can indent a whole block of code at once by selecting that block and pressing SHIFT-CTRL-I. The whole block will indent by the “Block Indent” value in Editor Properties. Perfect for if you want to add begin and end around a large block of code!

If you decide you have indented too far, SHIFT-CTRL-U has the opposite effect.

As a side note, you can edit how much these shortcut keys indent by selecting Tools -> Editor Properties and changing the “Block indent” value.