-
MENUINFO problem
I did this:
#include<windows.h>
// WinMain
HMENU hmenu;
MENUINFO menuinfo;
menuinfo.fMask=MIM_BACKGROUND;
menuinfo.cbSize=sizeof(MENUINFO);
menuinfo.hbrBack=(HBRUSH)GetStockObject(GRAY_BRUSH );
SetMenuInfo(&menuinfo);
// ...
When compiling this code I get 11 errors. You won't believe why:
MENUINFO is a not-declared name!
// So I looked in the MSDN help, there I found out that the structure was declared in winuser.h and one could include windows.h as well. Ok, so I included winuser.h AND windows.h
#include<winuser.h>
#include<windows.h>
// And so on like before
This time (the same code) I only get 2 errors. But the error is somewhere in winuser.h (exactly line 39 where, it seems, a ";" could have been forgotten by the authors of winuser.h (but, and that lets me hope I finally will be able to include menus in my programs, MENUINFO seems to be no not-declared name any longer when including <winuser.h> directly). Is this an error that only occurs with my winuser.h or did anybody else also have this problem. And if not, what could I do to make functions, that need pointers to MENUINFO structs, work?
-
error line
The error above has nothing to do with the MENUINFO structure.
Compiling any Windows Program like this:
#include<winuser.h>
#include<windows.h>
int WINAPI WinMain(HINSTANCE hinst,HINSTANCE phinst,
LPSTR commline,int showstyle){
// doesn't matter
return 0;
}
will produce the same compiler error.
It has something to do with the line
typedef HANDLE HDWP; (which is around line 39; just beyond a ifndef NOUSER line); If somebody could attach a zipped winuser.h and windows.h this could help me (I'm using VC++ 6 EnterpriseEd) PLEASE ATTACH THEM!
-
winuser.h is included inside windows.h. You should not include both.
>>> If somebody could attach a zipped winuser.h and windows.h
If you have VC++ then you already have these files, why do you want them again? If you suspect they are corrupt, (unlikely), then reinstall them from your installation disk. Asking someone to send you copies of theirs could give you all kinds of trouble if they are for different versions of the compiler/IDE.
SetMenuInfo() takes 2 parameters, the first is the handle to the menu, you are not passing that.
-
**EDIT** *deleted*
adrianw already answered it and pinned the problem down better than I did. :)