ShellExecute question

Is there a way to use ShellExecute to open the default word processor for a new blank document?  If not, is there a way to do this?

Thanks.
alexiatAsked:
Who is Participating?
 
ChristianWimmerCommented:
Unfortunately, I don't know any code in Delphi. JCL and JVCL implements a function that you could adapt to your needs:
from JCL/JVCL:
 
procedure AssociateFileExtension(IconPath, ProgramName, Path, Extension: string);
begin
  with TRegistry.Create do
  begin
    RootKey := HKEY_CLASSES_ROOT;
    OpenKey(ProgramName, True);
    WriteString('', ProgramName);
    if IconPath <> '' then
    begin
      OpenKey(RC_DefaultIcon, True);
      WriteString('', IconPath);
    end;
    CloseKey;
    OpenKey(ProgramName, True);
    OpenKey('shell', True);
    OpenKey('open', True);
    OpenKey('command', True);
    WriteString('', '"' + Path + '" "%1"');
    Free;
  end;
  with TRegistry.Create do
  begin
    RootKey := HKEY_CLASSES_ROOT;
    OpenKey('.' + extension, True);
    WriteString('', ProgramName);
    Free;
  end;
  RebuildIconCache;
end;

Open in new window

0
 
ChristianWimmerCommented:
Many wps shows a blank document if they are ran without any parameters.
You can retrieve the linked application for a file extension using the LookupRegisteredApp function source supplied by this codeproject article :
http://www.codeproject.com/KB/shell/ExecApp.aspx
0
 
alexiatAuthor Commented:
I don't suppose you know of anything written in Delphi, not in C?
0
 
alexiatAuthor Commented:
Thanks.  I searched and couldn't find anything but figured you experts would know for sure.  As usual, deadlines loom and I didn't want to spin my wheels.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.