?
Solved

Opening files from delphi.

Posted on 1998-07-10
3
Medium Priority
?
186 Views
Last Modified: 2010-04-04
Can a delphi program (for win NT and 95) open a file with it asociated application?
Note: the program only konws the name of the file, but it doesn´t know the asociated application.
For example:
Can the program open a "readme.txt" with the notepad, whithout knowing that the notepad is asociated with the extention "txt"?
or
Can the program open a "readme.doc" with the word, whithout knowing that the word is asociated with the extention "doc"?
It is like make a doble click in the windows explorer to open a document...

Juan Pablo.-
0
Comment
Question by:jpussacq
[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 1

Expert Comment

by:andrey070798
ID: 1357698
Hi, jpussacq.
In Registry you can find information about programs corresponding to extentions.
After you found the name of the program you can CreateProcess() or WinExec () with name of program and your filename as a parameter.
smth like WinExec ('notepad.exe FileName.txt',  SW_SHOWNORMAL);
  or WinExec (WordPad.exe FileName.doc, SW_SHOWNORMAL);
  If your computer "knows" which extention assosiated to which program you can try to call just WinExec with name of file you want to run (I've checked it in command prompt - works). I've WinNT.
Good luck.
Andrey

0
 
LVL 3

Accepted Solution

by:
KE earned 20 total points
ID: 1357699
Yes !
Use ShellExecute

0
 

Expert Comment

by:subrek
ID: 1357700
Hi, i'm new here ...:)

Have you ever tried the ShellApi.PAS unit ?
There are very useful functions and procedures to e.g. extract an
associated icon with an application which you want to run ...(
and display its associated icon ...)


0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

752 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