Solved

import menu from rc file

Posted on 2006-10-22
7
319 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
countEvens challenge 2 113
child constructor and parent constructor, overriding and overloading 6 92
scoreUp challenge 14 68
wordcount challenge 11 144
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

680 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