?
Solved

Open assosiated programs for assosiated files.

Posted on 2003-03-01
3
Medium Priority
?
134 Views
Last Modified: 2012-05-04
I want to make a small prog to open a powerpoint presentation thru powerpoint automaticly.

I just want to get the assosiated program & parameters for a eg. extention '.pps'.

(I know I can just dubble click on the file, but I want to give this to some people that doesn't understand the concept)
0
Comment
Question by:Stream12
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 7

Accepted Solution

by:
Motaz earned 600 total points
ID: 8046922
- Add shellApi to uses clause
- Call ShellExecute(handle, 'open', PChar(FileName), nil, nil, sw_Normal);

where FileName is a string containing power point presentation file name

Motaz
0
 
LVL 1

Expert Comment

by:SimesA
ID: 8046993
This code gets the associated program:

function GetAssociateFileType(const FileType: string): string;
var
  reg: TRegistry;
  FileTypeName: string;
  p: integer;
begin
  result := '';
  reg := TRegistry.Create;
  try
    reg.RootKey := HKEY_CLASSES_ROOT;
    if reg.OpenKey(FileType, false) then begin
      FileTypeName := reg.ReadString('');
      reg.CloseKey;
    end;

    reg.RootKey := HKEY_CLASSES_ROOT;
    if reg.OpenKey(FileTypeName + '\Shell\Open\Command', false) then begin
      result := reg.ReadString('');
      reg.CloseKey;
    end;
    if result <> '' then
      if result[1] = '"' then begin
        delete(result, 1, 1);
        p := Pos('"', result);
        if p <> -1 then
          delete(result, p, length(result) - p + 1);
      end;
  finally
    reg.free;
  end;
end;
0
 

Author Comment

by:Stream12
ID: 8059533
Thank you both,

I tried both answers and both work. Wish I could split the points.

I chose Motaz's anwser because it's shorter.

Also, with SimesA solution I don't get the parameters on output.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month10 days, 14 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question