Solved

Using Different Programs To Open The Same File

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

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

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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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.

863 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

24 Experts available now in Live!

Get 1:1 Help Now