Solved

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

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

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

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…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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 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.

752 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