Solved

Using Different Programs To Open The Same File

Posted on 2001-08-11
3
225 Views
Last Modified: 2012-05-04
Okay guys, bear with me.

I'm an avid gamer, and I play a game called Unreal Tournament.

I also create levels for this game.

A level/map file in Unreal Tournament has a .unr extension.

What I'm looking to do here is modify the menu you get when you right click on a file in Windows. You know, you get Open, Print, Send To >, Cut, Copy, etc.

When you install WinZip or WinRAR it adds things to this menu, like "Add to file.zip" or "Add to archive..."

When you right click on a .unr file, it replaces the word "Open" with "Play this Unreal level." And it opens the file using unrealtournament.exe.

I'd like to add another Open option below "Play this Unreal level" that says "Edit using UnrealED" which will open the file using UnrealED.exe.

The phrase "Play this Unreal level" only appears when you right click a .unr file in Explorer. I'd like "Edit using UnrealED" to appear in the same fashion - only when a .unr file is clicked, and below the "Play this level" item.

I'm guessing this is a registry entry thing.

Can someone tell me how to do this programmatically?

Thank you!

-Dan
0
Comment
Question by:SuperMario
  • 2
3 Comments
 
LVL 7

Expert Comment

by:peterchen092700
ID: 6376359
stat explorer, choose "View / Folder Settings", choose "File Types" tab.  (hope this is the same in your version - positions tend to change, nd I have no english windows here - yuck.)

Select the .unr file type, and click "edit". Near bottom of thedialog is a list with operations for that file (there you might see "Play this Unreal level" already)

click "new", type a name (like "Edit this level"), and as application, type <leveleditor> "%1" (including quotes), where leveleditor is the full path of the level editor (like c:\unreal\editor.exe, or whatever it's called....)

Click through the OK cascade, it should work...

Good luck ;)
Peter

0
 
LVL 8

Accepted Solution

by:
mnashadka earned 50 total points
ID: 6376610
I'm assuming that you want to do this programmatically, which is why it would be posted in the C++ section.  In the registry under HKEY_CLASSES_ROOT, find the entry for .unr (you may have to create it yourself if it's not already there).  Under there, an entry for "shell" should be there (again, you may have to create it yourself).  Then, inside shell, an entry for everything that you want the right-click to use can be created there.  You would add a key for Edit using UnrealED there.  The default value for this key is the entry as Peter said earlier: <program path> "%1" or something similar to that.

You just need to look at RegCreateKeyEx, RegOpenKeyEx, RegSetValueEx, and RegCloseKey for the syntax.  The documentation is pretty good.  If you try to open the key, and it doesn't exist, you'll get something other than an ERROR_SUCCESS, so you create the key.  After you've created the keys, set the value for "Default".  I hope this helps you.
0
 
LVL 7

Expert Comment

by:peterchen092700
ID: 6376966
then it should have been "Windows Programming" ;)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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. …
  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 pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

730 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