Click here to Skip to main content
15,913,773 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Possible Networking Program Design :: Winsock Pin
valikac5-May-02 5:40
valikac5-May-02 5:40 
GeneralConfused about FindResource Pin
albean4-May-02 5:48
albean4-May-02 5:48 
GeneralRe: Confused about FindResource Pin
l a u r e n4-May-02 6:55
l a u r e n4-May-02 6:55 
GeneralRe: Confused about FindResource Pin
albean4-May-02 9:12
albean4-May-02 9:12 
GeneralRe: Confused about FindResource Pin
Michael Dunn4-May-02 9:25
sitebuilderMichael Dunn4-May-02 9:25 
QuestionSet Combo Box values?? Pin
Aoife4-May-02 3:07
Aoife4-May-02 3:07 
AnswerRe: Set Combo Box values?? Pin
Ravi Bhavnani4-May-02 3:49
professionalRavi Bhavnani4-May-02 3:49 
GeneralJust about had enough, stupid debug error Pin
Alexander Wiseman4-May-02 2:17
Alexander Wiseman4-May-02 2:17 
Hello!

I am working on a custom control derived from CWnd, which I was hoping to put on CodeProject until I tried the control with the Create function (two step creation) in debug mode and it errored out. I then tried the control in Release mode and everything worked fine. Here is what my create function looks like:

//Function: Create
//Job: creates the NavBarCtrl
BOOL CNavBarCtrl::Create(const RECT& rect, CWnd* parent, UINT nID, DWORD dwStyle /* = WS_CHILD | WS_BORDER | WS_TABSTOP | WS_VISIBLE*/)
{
//Make sure variables are valid:
ASSERT(parent && IsWindow(parent->GetSafeHwnd())); //parent must be a valid window
ASSERT(parent->GetDlgItem(nID) == NULL); //must be a unique dialog item

//Create the window:
if(!CWnd::Create(NAVBARCTRL_CLASSNAME, NULL, dwStyle, rect, parent, nID))
return false;

//Done:
return true;
}

The program crashes in debug mode sometime within the call to CWnd::Create. I have properly initialized the class name contained in NAVBARCTRL_CLASSNAME, since I used the same code Chris Maunder does in his grid control. Just a side note, I tried this code in debug mode first on a Windows XP machine, and was unable to get into the heart of the CWnd call to see what was wrong. Then I tried the code on a Windows 2000 machine and was able to debug enough to see that apparently the code was ASSERTing in the call to CWnd::Attach, on this line:
ASSERT(m_hWnd == NULL)

I examined the values for m_hWnd and found that, while it did not point to any place in memory (pointer had not been initialized), the value was not NULL. So I tried setting m_hWnd to NULL right before the call to CWnd::Create, but that didn't help. I am hoping someone can shed some light on this situation because it is really annoying to have to run all the programs that use this control in Release mode, and frankly, I hate miscellaneous errors. I would rather not send the code, but if it will help to solve this problem then I will do whatever.

Thanks in advance!
Eek! | :eek:

Sincerely,
Alexander Wiseman

Est melior esse quam videri
It is better to be than to seem
GeneralRe: Just about had enough, stupid debug error Pin
Neville Franks4-May-02 11:11
Neville Franks4-May-02 11:11 
GeneralRe: Just about had enough, stupid debug error Pin
Alexander Wiseman5-May-02 9:59
Alexander Wiseman5-May-02 9:59 
GeneralSolution found... Pin
Alexander Wiseman6-May-02 9:34
Alexander Wiseman6-May-02 9:34 
GeneralFonts Pin
Sonu Kapoor4-May-02 1:54
Sonu Kapoor4-May-02 1:54 
GeneralRe: Fonts Pin
Tom Archer4-May-02 5:41
Tom Archer4-May-02 5:41 
GeneralRe: Fonts Pin
Sonu Kapoor4-May-02 6:42
Sonu Kapoor4-May-02 6:42 
GeneralRe: Fonts Pin
Tom Archer4-May-02 6:53
Tom Archer4-May-02 6:53 
GeneralQuickest way to get childern of CTreeCtr Pin
generic_user_id4-May-02 0:12
generic_user_id4-May-02 0:12 
GeneralI got it working, nevermind. Pin
generic_user_id4-May-02 0:59
generic_user_id4-May-02 0:59 
GeneralRe: I got it working, nevermind. Pin
Tom Archer4-May-02 5:23
Tom Archer4-May-02 5:23 
GeneralSure, this is what worked for me. Pin
generic_user_id6-May-02 6:20
generic_user_id6-May-02 6:20 
GeneralRe: Sure, this is what worked for me. Pin
Tom Archer6-May-02 14:17
Tom Archer6-May-02 14:17 
GeneralRe: Sure, this is what worked for me. Pin
generic_user_id6-May-02 23:24
generic_user_id6-May-02 23:24 
GeneralEvent handling for dynamically created controls Pin
sanskypotov3-May-02 23:48
sanskypotov3-May-02 23:48 
GeneralRe: Event handling for dynamically created controls Pin
Maxwell Chen4-May-02 0:13
Maxwell Chen4-May-02 0:13 
GeneralRe: Event handling for dynamically created controls Pin
Tom Archer4-May-02 5:44
Tom Archer4-May-02 5:44 
GeneralRe: Event handling for dynamically created controls Pin
Maxwell Chen4-May-02 7:40
Maxwell Chen4-May-02 7:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.