Thread: Help with hiding CMenu in MS-VS C++ 6

  1. #1
    Registered User
    Join Date
    Aug 2002
    Posts
    1

    Angry Help with hiding CMenu in MS-VS C++ 6

    Please help I have reached the proverbial end of my tether!

    I am using MS-Visual Studio 6 C++. I have a derivation of the infamous scribble application. I want to create a "full screen mode" where I do not show the title, status bar, tool bar or menues. I can achieve all of these except for the menues, when ever I move from one document to another I have to actively deletemenu() any menu from AfxGetMainWnd()->GetMenu();

    Does anybody know how to "hide" CMenus?

    tia

    Dave

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    You would really have to kill the menu off when you switch to 'fullscreen'.

    Use the Win32 API SetClassLong with the GCL_MENUNAME flag set to NULL to do this and to restore it when you return to 'windowed' you replace the 'NULL' with the menu resource identifier, eg:
    Code:
    SetClassLong(CWndMFCClass->m_hWnd,NULL);
    and to restore it:
    Code:
    SetClassLong(CWndMFCClass->m_hWnd,MenuID);
    where CWndMFCClass is a ptr to your CWnd (or derived) object and MenuID is the resource name of the menu (use MAKEINTRESOURCE if the menu id is a numeric rather than string value).

    You may prefer to use the :: scope resolution operator with SetClassLong.

    Alternatively you can unregister the window class and re-register it without a menu but I don't know how much of a hassle this is in mfc. It's certainly a little more hassle in win32 than using SetClassLong to switch the menu on/off, so to speak.

    Hope that helps some.

    edit: Corrected hideous error - very sorry about that.
    Last edited by Ken Fitlike; 09-07-2002 at 12:31 AM.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Speed test result
    By audinue in forum C Programming
    Replies: 4
    Last Post: 07-07-2008, 05:18 AM
  2. Heapsort
    By xENGINEERx in forum C Programming
    Replies: 2
    Last Post: 03-30-2008, 07:17 PM
  3. Generic heapsort
    By Sephiroth1109 in forum C Programming
    Replies: 15
    Last Post: 12-07-2007, 06:14 PM
  4. Ping
    By ZakkWylde969 in forum Tech Board
    Replies: 5
    Last Post: 09-23-2003, 12:28 PM
  5. The Timing is incorret
    By Drew in forum C++ Programming
    Replies: 5
    Last Post: 08-28-2003, 04:57 PM