Solved

Opening files from delphi.

Posted on 1998-07-10
3
180 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
3 Comments
 
LVL 1

Expert Comment

by:andrey070798
Comment Utility
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
Comment Utility
Yes !
Use ShellExecute

0
 

Expert Comment

by:subrek
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now