Reputation: 21
After creating a win32 project using visual Studio 2017 community I have added to the menus pop downs that are already there. After I added below 'File' a popup item 'Mypop', I opened the properties of the new option and copied the ID; 'ID_FILE_MYPOP' into my WndProc WM_COMMAND loop.
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
... case ID_FILE_MYPOP: break;
It appears with error message "identifier ID_FILE_MYPOP is undefined".
I can only correct this by opening the resource.h file, it responds "this file is already open in another device do you want to close it?". If I reply yes, then I can see the contents of resource.h file and it includes ID_FILE_MYPOP. Then if I close the resource.h file the error message in WndProc disappears and the menu addition works correctly.
MY QUESTION IS:
Do I have to open and close the resource.h header file every time I add a menu item to resource.rc file?
What application might have the resource.h file open?
If anyone could help me I would really appreciate it.
ps I can also remove the error statement if I open and shut the project solution.
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM
lParam)
{
switch (message)
{
case WM_COMMAND:
{
int wmId = LOWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case ID_FILE_MYPOP:
break;
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
break;
case ID_NEWEDITIDAPPROACH:
break;
case IDM_NEW7:
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
}
break;
...}
Upvotes: 0
Views: 1326
Reputation: 189
Double click the resource file in the solution explorer - the resource editor should open (and this is the app opening the resource.h):
Upvotes: 0