Solved

import menu from rc file

Posted on 2006-10-22
7
318 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.

809 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