you can solve this in 2 ways:
- way one is to change the code page from UTF8 to Windows - you need to add the
LazUTF8 unit to the
uses section, and to the dependencies you need to add the
LCLBase or
LCL package (if there is none)
- way two is to replace the path with
WideString and use
ILCreateFromPathWprogram OpenFileLocation;
uses
Windows, shlobj, ActiveX,
{LazUTF8} //uncomment for way 1
;
var
SelectedFile: LPITEMIDLIST;
begin
CoInitializeEx(nil, COINIT_MULTITHREADED);
try
////way1
//SelectedFile := ILCreateFromPath(PChar(UTF8ToWinCP(ParamStr(0))));
//way 2
SelectedFile := ILCreateFromPathW(PWideChar(WideString(ParamStr(0))));
if SelectedFile <> nil then
begin
SHOpenFolderAndSelectItems(SelectedFile, 0, SelectedFile, 0);
ILFree(SelectedFile);
end;
finally
CoUninitialize;
end;
end.