Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

import menu from rc file

Posted on 2006-10-22
7
Medium Priority
?
345 Views
Last Modified: 2013-11-20

hello experts,

how can i import a menu from a rc file (see below for layout) to visual c++ 6?


layout:

134 MENU
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
POPUP "TRAY_POPUP"
{
  MENUITEM "Item1!", 32771
  MENUITEM SEPARATOR
  MENUITEM "Item2", 32772, CHECKED
  MENUITEM "Item3", 32783, CHECKED
  POPUP "&Sub1"
  {
    MENUITEM "SubItem1", 32775
    MENUITEM "SubItem2", 32782
  }
  MENUITEM "Item4", 32774
}
}
0
Comment
Question by:Mark_FreeSoftware
  • 4
  • 3
7 Comments
 
LVL 22

Accepted Solution

by:
mahesh1402 earned 2000 total points
ID: 17786777
You want to load resource file located in another exe/dll ? if so you may use AfxFindResourceHandle / AfxSetResourceHandle to load resource from exe/dll.

use the win32 API  LoadMenu() function to load your menu from a resource file (.EXE or .DLL) , then use the win32 API  SetMenu() function to assigns a new menu to the specified window.

http://msdn.microsoft.com/library/us/winui/winui/windowsuserinterface/resources/menus/menureference/menufunctions/loadmenu.asp

http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/resources/menus/menureference/menufunctions/setmenu.asp

-MAHESH
0
 
LVL 13

Author Comment

by:Mark_FreeSoftware
ID: 17787180

yes,i want to load resource file from another app,  but i want to modify the menu,
so i have to import it in visual c++ so i can alter it
0
 
LVL 22

Expert Comment

by:mahesh1402
ID: 17787964
No dont need to import another application....you can load resource directly from another application exe/dll using AfxFindResourceHandle.

As I said above you retrieve resource handle of another application using AfxFindResourceHandle / AfxSetResourceHandle... and with LoadMenu you may load menu from resource of particular application / dll. Refer docs on above link for more info.

-MAHESH
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 13

Author Comment

by:Mark_FreeSoftware
ID: 17789194
>>you retrieve resource handle of another application using AfxFindResourceHandle / AfxSetResourceHandle... and with LoadMenu you may load menu

but how can i add extra items to the menu?
i must be missing somthing completely...
0
 
LVL 22

Expert Comment

by:mahesh1402
ID: 17789683
Use CMenu MFC class..

Use CMenu::LoadMenu() to load menu from another application resource as said above and then use CMenu member functions CMenu::AppendMenu CMenu::InsertMenu to add / insert items to menu..

Refer :

http://msdn2.microsoft.com/en-us/library/177ay1x0.aspx

http://msdn2.microsoft.com/en-us/library/kb145b0a.aspx

http://msdn2.microsoft.com/en-us/library/89c2aa4b.aspx

-MAHESH
0
 
LVL 13

Author Comment

by:Mark_FreeSoftware
ID: 17790171

thank you, i'll look into that at the end of this week
(busy for school now)
0
 
LVL 13

Author Comment

by:Mark_FreeSoftware
ID: 17829178

thank you, works like a charm!
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Integration Management Part 2
Suggested Courses

971 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