Solved

Starting program from Windows Explorer

Posted on 1998-12-21
6
140 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

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 my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

760 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

18 Experts available now in Live!

Get 1:1 Help Now