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
Solved

Starting program from Windows Explorer

Posted on 1998-12-21
6
143 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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 96
FMX enumerated colours 2 115
Help on project with Soap 10 57
How to Get Images From Server to Client using App Tethering 1 25
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

840 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