Windows & Linux & Mac Uptime

Learn run time before last boot.

Windows:

systeminfo | find "System Boot Time:"

or

Task Manager -> Performance

Linux & Mac:

uptime

Note: System boot time is wrong on Windows 10.

Solution:

  1. Press Windows key + r
  2. Type services.msc
  3. Click Windows Time
  4. Alternate click and then click Properties
  5. Change Startup type to Automatic
  6. Click Start if the service isn’t started

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;

Change Language of Windows 10 Single Language

  1. Download lp***.cab package for desired language
  2. Run cmd as Administrator
  3. dism /Online /Add-Package /PackagePath:C:\lp.cab

  4. Learn old language package

    dism /Online /Get-Packages

  5. Remove old language package

    dism /Online /Remove-Package /PackageName:Microsoft-Windows-Client-LanguagePack-Package~31bf3856ad364e35~amd64~ru-RU~10.0.10240.16384

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;