Solved

import menu from rc file

Posted on 2006-10-22
7
301 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 500 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
This video discusses moving either the default database or any database to a new volume.

747 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

12 Experts available now in Live!

Get 1:1 Help Now