Solved

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

Posted on 2002-04-10
3
233 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 200 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

867 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

15 Experts available now in Live!

Get 1:1 Help Now