Okay, I'm still a fresh out of college programmer (only been doing it for 4 years), so I will try to be as descriptive as possible. I apologize now for anything that doesn't make sense.
I've got a C++ project that using MFC to create forms. I have my main window, and inside it I have 7 tabs, one of them called "Send". On this tab I have several buttons and other controls. One button, the "Add" button, in it's properties, I have set to be the default button (the button I assume fires off when you press Enter). Now, when the form and tab is loaded, one button (the "Find File" button) has focus. Now, if I type in my textbox, and press Enter, my program shuts down (obviously not the effect I was going for). On top of that, I can't seem to find a way to make the "Add" button have focus upon starting the program. In the Send tab's constructor, I added:
CWnd* addEmailButton = GetDlgItem(IDC_ADD_EMAIL_TO_LIST);
addEmailButton->SetFocus();
The problem is, when the GetDlgItem() is called, the first line in the function is:
ASSERT(::IsWindow(m_hWnd))
Using Visual Studio, and mousing over m_hWnd, IntelliSense reports that it's unused. This, obviously, is causing the ASSERT to fail, and thus my program to crash. I would appreciate any and all help given to understand why exactly this is. Thank you.