CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2007
    Posts
    76

    [RESOLVED] Invisible Menu?

    Alright, so I was going through this tutorial, and converting the code from C to c++, not that hard, but what I came across was that once I added (HFONT) to
    Code:
    hfDefault = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
    and (LPSTR) to
    Code:
    pszFileText = (LPSTR)GlobalAlloc(GPTR, dwFileSize + 1);
    the menubar just dissappeared, any ideas why?
    Last edited by HKothari; January 26th, 2008 at 03:56 PM.

  2. #2
    Join Date
    Jan 2008
    Posts
    10

    Re: Invisible Menu?

    Just to clarify, you are saying that if you remove (HFONT) and (LPSTR) then the menubar is displayed, but if you put them in (changing nothing else) the menubar does not display. But it compiles either way. Is that it? If so, what happens if you just put in (HFONT) and not (LPSTR)? And what exactly are you doing with hfDefault?

  3. #3
    Join Date
    Dec 2007
    Posts
    76

    Re: Invisible Menu?

    If I remove them, it doesn't compile because now the it is in C++ it needs the explicit typecasts, but after adding them, it dissappeared, and hfDefault is just the default font used in a textbox. And no, it doesn't compile without them.

  4. #4
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    Re: Invisible Menu?

    With the information you provided it is difficult to conclude anything. I have the least doubt on either of the 2 because as such both are harmless. What I would suspect is what happens after those lines are executed, especially, the pszFileText one. It is possible you are allocating a ridiculous amount, and/or, writing excess of the bounds and such. Are you making sure you check for the values using debugger single stepping and making sure your code is executing all the right paths ?

  5. #5
    Join Date
    Dec 2007
    Posts
    76

    Re: Invisible Menu?

    Sorry, I think I found my problem, and it had nothing to do with those two, it was just coincidence, it's that my resource files aren't compiling, so I just have to figure out that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured