Solved

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

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

746 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

11 Experts available now in Live!

Get 1:1 Help Now