?
Solved

Starting program from Windows Explorer

Posted on 1998-12-21
6
Medium Priority
?
149 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
[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
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 200 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month10 days, 19 hours left to enroll

770 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