Solved

Using Different Programs To Open The Same File

Posted on 2001-08-11
3
211 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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

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. …
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
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.
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.

810 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