Solved

Starting program from Windows Explorer

Posted on 1998-12-21
6
141 Views
Last Modified: 2010-04-04
How do I get my program to start and load a file when I click on the file in Windows explorer. I can register the program with Windows Explorer, so that it starts, but I can't get the file passed to the program.
0
Comment
Question by:michaelhiggins
6 Comments
 
LVL 3

Expert Comment

by:KE
ID: 1352402
Hmmm... I'm a little confused sorry.
You say that your can register your program - so I gues that you might need to specify an OPEN command like:
yourprog.exe %1

0
 
LVL 3

Expert Comment

by:Matvey
ID: 1352403
http://bes.trendline.co.il/torry/vcl/system/bianrext.zip

"This is an invisible component that allow you to associate a file extension with a executable program (for example: *.BMP with Paint.Exe)"
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1352404
Hi Michael,

Have you tried using ParamStr(1) within your Delphi app?  You can check to see if ParamCount > 0.  If it is, then you can access ParamStr(1) ... ParamStr(ParamCount) to access the parameters passed to your app.

Cheers,
JB
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 20

Expert Comment

by:Madshi
ID: 1352405
Michael,

if you combine all the comments suggested yet, you should be able to make it run. If you are able to register your program, make sure there's a %1 in "*.ext\shell\command\open\(Default)" after your programs filename (like KE suggested).
Then in your program you can use ParamCount and ParamStr (like JimBob suggested).

Regards... Madshi.
0
 
LVL 10

Expert Comment

by:ptmcomp
ID: 1352406
I'm thinking it should work with 'ProgramName.exe "%1"', too. Where have you registered your program? How did you do this? Do you work with DDE?
0
 

Accepted Solution

by:
teechong earned 50 total points
ID: 1352407
1. Register an extension in HKEY_CLASSES_ROOT (HCR)
2. Associate the executable.
3. Support commandline in the executable

Eg.
Your executable is residing in C:\Program Files\MyProg\prog.exe.
Prog.exe must be coded to take a commandline parameter.
Your registry must have the following keys and values:

Key                              Name        Data
---------------------------      ----------- ----------------
HCR\.mfi                         (Default)   "MyDocFile"
HCR\MyDocFile                    (Default)   "Doc File Description"
HCR\MyDocFile\shell\open\command (Default)   "C:\Program Files\MyProg\prog.exe %1"

For prog.exe to support commandline, you can use the ParamStr() function to retrieve the parameter. If your registry keys are set correctly, Windows will pass any filename with .mfi extension to prog.exe as the commandline parameter.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

910 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

22 Experts available now in Live!

Get 1:1 Help Now