Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with MAKEINTRESOURCE/ creating Menu?Please help!!!

Status
Not open for further replies.

Sunny2

Programmer
Sep 11, 2003
15
CA
Hi..I am trying to learn VC++.NET.

Well, I am trying to create this Main Menu using Win32.

This is the code that I have...

#include <afxwin.h>

class CResFrame : public CFrameWnd
{
public:
CResFrame()
{
Create(NULL, &quot;Resources Fundamentals&quot;, WS_OVERLAPPEDWINDOW,
CRect(200, 120, 640, 400), NULL, MAKEINTRESOURCE(IDR_MENU_RES));
}
};

class CResApp: public CWinApp
{
public:
BOOL InitInstance()
{
m_pMainWnd = new CResFrame;
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();

return TRUE;
}
};

CResApp theApp;




Problem: Well, I created a menu in the resource view and I have called it's ID to IDR_MENU_RES, for the Indentifier to be recognized, I am using the macro (MAKEINTRESOURCE(IDR_MENU_RES)) as above in the code, this should work, but it's giving this error.

error C2065: 'IDR_MENU_RES' : undeclared identifier

I have no idea why? Please help...



Sunny
 
Hmm, it should have changed it if you edited the properties. Make sure you have resource.h included along with afxwin! (#include &quot;resource.h&quot;) There are several ways you can double check to see if the identifier is correct. Look in your resource.h file. Is there a #define IDR_MENU_RES? Secondly, you can check your .rc file by opening it with a text editor and see if you can find the IDR_MENU_RES indentifier. But, from the code I see above, it just looks like you forgot to #include &quot;resource.h&quot; :)

-Bones
 
Thanks Bones,

you are right, I didn't include resource header file in my source file.

Thanks

Sunny
 
Glad I could help :) (The real reason I noticed that is because I did the same thing more times than I would like to admit lol.)

-Bones
 
Sunny2, don't say thanks in the forum. There is a specific action you should perform if the post was helpful.

Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top