PDA

View Full Version : Why I'm not using MFC anymore



Sadrok
12-11-01, 11:55 AM
So I'm just starting out with a project and layout the screen in a Dialog program.

So I've got a few buttons set up and some of them I want to have icons on it.
Ok, so there is no way I can see to get icons on it in IDE (I'm using VC++ 6)

So I probably must use CButton::SetIcon(HICON) right?
Ok so I do that but I get assertion failure, why???
Because:
CButton::SetIcon runs SendMessage(HWND, ....) and the button's m_hWnd variable is, take a wild guess, NULL!!!, Yeah. So, thus I get assertion failure.

So that's why I'm not using MFC anymore. Now I'm gonna use plain WinAPI programming because then I WILL have a hWnd to work with. BUT.......... :p

It still doesn't work (no errors though)
I use


SendMessage(m_but1, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ICON))
g_hInstance is extern from main cpp which is global = to hInstance in WinMain.
I get no error but no icon on button. Using LoadIcon(blah blah) in the windowclass works though.

Oh and how do I get my resource menu into the window, I put it in the class and createwindow and still didn't get a menu :( oh well