Solved

Using Different Programs To Open The Same File

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
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.

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