Click to See Complete Forum and Search --> : [RESOLVED] Invisible Menu?
HKothari
January 26th, 2008, 02:37 PM
Alright, so I was going through this tutorial (http://www.winprog.org/tutorial/app_two.html), and converting the code from C to c++, not that hard, but what I came across was that once I added (HFONT) to
hfDefault = (HFONT)GetStockObject(DEFAULT_GUI_FONT);and (LPSTR) to pszFileText = (LPSTR)GlobalAlloc(GPTR, dwFileSize + 1); the menubar just dissappeared, any ideas why?
MaxPower
January 26th, 2008, 06:44 PM
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?
HKothari
January 27th, 2008, 07:22 AM
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.
kirants
January 27th, 2008, 01:31 PM
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 ?
HKothari
January 28th, 2008, 05:24 AM
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.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.