Solved

Opening files from delphi.

Posted on 1998-07-10
3
184 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

730 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