Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

assign my application to catch double-click on *.tcs file

Posted on 2002-04-10
3
Medium Priority
?
244 Views
Last Modified: 2010-04-02
i have my prog.exe built ov DevStudio C++
I want to have different script files named *.tcs that i can run with my prog.exe

when i double click a tcs file i want my prog.exe to read lines from the clicked tcs file


0
Comment
Question by:ofirg
3 Comments
 
LVL 12

Expert Comment

by:pjknibbs
ID: 6933316
Then add the appropriate entries to the Registry. In HKEY_CLASSES_ROOT you'll see dozens of examples of how extensions should be handled, but basically you need to add something like:

HKEY_CLASSES_ROOT\.tcs --Default key should contain something like TCSFile

HKEY_CLASSES_ROOT\TCSFile\shell\open\command --String value which should contain the full path to your executable followed by %1.

If you set it up like this and then double-click a TCS file, your program will be launched with the full pathname of the TCS file as its only command line parameter.

0
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 600 total points
ID: 6933318
The double clicking filename information available on the main functions argv argc.

But if u want to set the file association for that, u have to do something in windows...that is

1. Take the folder operation from one folder's Tools->Folder Options...
2. Get the third tab named "File Types"
3. Press New button, type the extension and press OK.
You can see your file type
4. Press the "Advanced" button in the "Details for 'TCS' extension" group.
5. Press new on that dialog
6. Type "Open" under the Action edit box
7. Type the application name with path under the 'Application used to perform action' edit box And press OK, and again OK.

This will make the file association for your file.

If already an association exists, u have to remove that forst

GOOD LUCK
0
 
LVL 6

Expert Comment

by:thienpnguyen
ID: 6933323
"When creating applications, it's often necessary to
store information as a file on the hard drive. You
may choose to create your own extension and then
associate that extension with your application
through Windows.

Basically, you need to add two keys to the registry
under HKEY_CLASSES_ROOT. Say your extension in
".ext", then the first key you add is the
extension itself:  
 
HKEY_CLASSES_ROOT\
    .ext\  

and set the "default" string value of this key to
an "internal name" for your file type - for example
MyApp.Document:  
 

HKEY_CLASSES_ROOT\  
  .ext\  
     Default = "MyApp.Document"  

You then create another key with this name:
 

HKEY_CLASSES_ROOT\  
  MyApp.Document\  

Create a sub-key of this called "shell", a sub-key
of *this* called "open" and a further sub-key of
"open" called "command". The default value uder this
key is the location and name of your your
application folled by "%1" which represents the
filename parameter that Windows will pass to
your executable:

HKEY_CLASSES_ROOT\  
  MyApp.Document\  
    shell\  
      open\  
        command\  
          Default = "C:\myapp\myapp.exe %1"  

"
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

916 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