delphi - Running an external program using ShellExecute -
delphi - Running an external program using ShellExecute -
this question has reply here:
how open file default text editor? 2 answersas far know ... need set executable programme in shellexecute (like notepad.exe) if user wants utilize other external programme (like notepad++.exe) open file? if possible how that?
my guess want open document using whatever programme user has chosen associate document type. in case pass document shellexecute
rather program:
shellexecute(0, nil, pchar(documentfilename), nil, nil, sw_shownormal);
passing nil
sec parameter, verb, uses default verb document. 'open'
verb. not always. might instead write:
shellexecute(0, 'open', pchar(documentfilename), nil, nil, sw_shownormal);
if want able check errors in sane way need utilize shellexecuteex
rather shellexecute
.
your comments shed little more lite on question, although i'm still clutching @ straws. seem want able open rtf file in user's preferred text editor. using shellexecuteex
passing class name instructs shell treat file if text.
var sei: tshellexecuteinfo; .... zeromemory(@sei, sizeof(sei)); sei.cbsize := sizeof(sei); sei.fmask := see_mask_classname; sei.lpverb := 'open'; sei.lpfile := pchar(documentfilename); sei.nshow := sw_shownormal; sei.lpclass := '.txt'; win32check(shellexecuteex(@sei));
delphi shellexecute
Comments
Post a Comment