Thread: MENUINFO problem

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    60

    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?

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    60

    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!

  3. #3
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    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.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  4. #4
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    **EDIT** *deleted*

    adrianw already answered it and pinned the problem down better than I did.
    Last edited by jdinger; 03-18-2003 at 01:49 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM