After the execution of this function (which I use to merge a .reg file into the Windows registry), application freezes: the file is merged I see the usual prompts which ask for merging file and confirming the merging has been successful, then The Explorer window when I started my app brings to front and my application can't get focus.
function TfrmMain.RunAsAdmin(hWnd: HWND; aFile,
aParameters: String): Boolean;
Result := False;
FillChar(sei, SizeOf(sei), 0);
sei.cbSize := SizeOf(sei);
sei.Wnd := hWnd;
sei.fMask := SEE_MASK_NOCLOSEPROCESS or SEE_MASK_UNICODE;
sei.lpFile := PChar(aFile);
sei.lpParameters := PChar(aParameters);
sei.nShow := SW_SHOWNORMAL;
if ShellExecuteEx(@sei) then
GetExitCodeProcess(sei.hProcess, ExitCode) ;
until (ExitCode <> STILL_ACTIVE) or
result := True;
Thanks to all in advance.