Solved

Starting program from Windows Explorer

Posted on 1998-12-21
6
144 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
Industry Leaders: 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 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Simple Delphi Question 9 106
Create a path if not exists 7 108
how to change, disabled button color FMX ? 1 51
Tidtcpserver listening on multiports? 1 46
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

726 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