procedure TForm_Main.SGrid_DocsDblClick(Sender: TObject);
var
RetVal: THandle;
strTemp: string;
begin
strTemp:= StringReplace(strDocPath + '/' + sListPath[SGrid_Docs.Row],
'/', '\', [rfReplaceAll]);
StatusBar1.SimpleText:= 'Opening ' + sListPath[SGrid_Docs.Row];
Screen.Cursor:= crHourGlass;
if FileExists(strTemp)
then
begin
RetVal:= ShellExecute(Handle, 'open',
PChar(strTemp), nil, nil,
SW_SHOWNORMAL);
end
else
begin
showmessage(strDocPath + '/' + sListPath[SGrid_Docs.Row] +
' not found [procedure ListBoxDblClick]');
Screen.Cursor:= crDefault;
Exit;
end;
if RetVal > 32 // no error
then StatusBar1.SimpleText:= 'Double click to open document'
else
begin
Windows.Beep(200, 500);
StatusBar1.SimpleText:= IntToStr(RetVal) + ' ' + strDocPath + '/' +
sListPath[SGrid_Docs.Row];
if RetVal = SE_ERR_NOASSOC
then StatusBar1.SimpleText:=
'No file type associated with ' +
ExtractFileName(strDocPath + '/' + sListPath[SGrid_Docs.Row]);
end;
Screen.Cursor:= crDefault;
end;