Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using Different Programs To Open The Same File

Posted on 2001-08-11
3
Medium Priority
?
244 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
[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
  • 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 200 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

610 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