Home arrow Delphi-Kylix arrow Page 3 - Creating an Associator
DELPHI-KYLIX

Creating an Associator


Have you ever wondered how installation programs are able to associate a file extension with a program? Or how when you double click on a MS Word file, Microsoft Word automatically starts up and loads that particular file? Well, in this article I will explain how it is done.

Author Info:
By: Jacques Noah
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
August 09, 2006
TABLE OF CONTENTS:
  1. · Creating an Associator
  2. · Continuing with the code
  3. · How to enable the application to load the file that has been clicked
  4. · The entire code

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Creating an Associator - How to enable the application to load the file that has been clicked
(Page 3 of 4 )

When an application starts, it has certain variables at its disposal. One of them is ParamStr();. "ParamStr(n)" is a global variable that contains various pieces of information in the following order:

ParamStr(0) = The current application name and path

ParamStr(1) = The file name that the user clicked on in Explorer or passed through the command line.

We are interested in ParamStr(1) since it will contain the parameters that the user passed to the application.  So to check whether this variable contains something:

Var
Applicationname,Avariable:string;
begin
ApplicationName := ParamStr(0);
If ParamCount = 1 then AVariable := ParamStr(1);
...
//Use AVariable for whatever purpose you want to.....
End;

Make sure to add the above code to your applications' OnCreate event, and it will be able to start if a file that it is associated to is passed.


blog comments powered by Disqus
DELPHI-KYLIX ARTICLES

- Loading an XML Document into the DOM
- Delphi Wrapper Classes and XML
- Delphi and the DOM
- Delphi and XML
- Internet Access: Client Service
- Finishing the Client for an Internet Access ...
- The Client for an Internet Access Control Ap...
- User Management for an Internet Access Contr...
- Important Procedures for an Internet Access ...
- Server Code for an Internet Access Control A...
- Constructing the Interface for an Internet A...
- Building a Server Application for an Interne...
- Building an Internet Access Control Applicat...
- Client Dataset: Working with Data Packets an...
- Using the Client Dataset in an N-Tiered Appl...

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 9 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials