Click here to Skip to main content
15,891,409 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Crashes no matter where Pin
Michael P Butler12-Jun-01 0:08
Michael P Butler12-Jun-01 0:08 
GeneralRe: Crashes no matter where Pin
12-Jun-01 0:26
suss12-Jun-01 0:26 
GeneralRe: Program crashes when I try to assign values to a CListBox in a dialog window created from my main dialog window Pin
Ulf Öhlén12-Jun-01 0:16
Ulf Öhlén12-Jun-01 0:16 
GeneralRe: Program crashes when I try to assign values to a CListBox in a dialog window created from my main dialog window Pin
12-Jun-01 0:24
suss12-Jun-01 0:24 
GeneralNot quite what I do. Pin
12-Jun-01 0:34
suss12-Jun-01 0:34 
GeneralRe: Not quite what I do. Pin
Ulf Öhlén12-Jun-01 0:59
Ulf Öhlén12-Jun-01 0:59 
GeneralNope, that didn't work Pin
12-Jun-01 11:19
suss12-Jun-01 11:19 
GeneralRe: Nope, that didn't work Pin
Ulf Öhlén12-Jun-01 23:19
Ulf Öhlén12-Jun-01 23:19 
I created a small test project and it works OK. This is what I did:

1. Create a standard Dialog-based MFC app
2. Add a new dialog resource to the project (IDD_DIALOG1)
3. Put a listbox on the new dialog
4. Open ClassWizard and coose to create a new CDialog class for new dialog resource (CDialog1).
5. With ClassWizard, add a CListBox member for the list (m_wndList)
6. Add a button to the main dialog and add an OnClick handler like this:
#include "Dialog1.h"
...
void CMainDlg::OnButton1() 
{
	CDialog1 dlg;
	dlg.DoModal();
}

7. Add a WM_INITDIALOG handler in CDialog1:
BOOL CDialog1::OnInitDialog() 
{
	CDialog::OnInitDialog();

	m_wndList.AddString("String to add"); // Assertion here? Call the X Files immediately:-)	

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}


Try this, and if you still get an assertion at CListBox::AddString(), something is very, very strange.


--------------
"Fabricati Diem, Pvnk"
GeneralRe: Not quite what I do. Pin
Michael P Butler12-Jun-01 22:39
Michael P Butler12-Jun-01 22:39 
GeneralLPT Port IO In Win2k Pin
Joseph LeBlanc11-Jun-01 15:54
Joseph LeBlanc11-Jun-01 15:54 
GeneralChar value for line break in an Edit Box Pin
11-Jun-01 14:26
suss11-Jun-01 14:26 
GeneralRe: Char value for line break in an Edit Box Pin
11-Jun-01 14:45
suss11-Jun-01 14:45 
GeneralRe: Char value for line break in an Edit Box Pin
Michael Dunn11-Jun-01 16:29
sitebuilderMichael Dunn11-Jun-01 16:29 
GeneralTHANK YOU Pin
11-Jun-01 17:57
suss11-Jun-01 17:57 
GeneralRe: THANK YOU Pin
Ben Burnett11-Jun-01 19:30
Ben Burnett11-Jun-01 19:30 
GeneralDocking Windows and MDI Pin
Jamie Nordmeyer11-Jun-01 12:17
Jamie Nordmeyer11-Jun-01 12:17 
GeneralCreating controls in the client area Pin
Waleed Eissa11-Jun-01 10:40
Waleed Eissa11-Jun-01 10:40 
GeneralRe: Creating controls in the client area Pin
Igor Sukhov11-Jun-01 22:56
Igor Sukhov11-Jun-01 22:56 
QuestionDeleting folders with SHFileOperation? Pin
Jim A. Johnson11-Jun-01 9:50
Jim A. Johnson11-Jun-01 9:50 
AnswerRe: Deleting folders with SHFileOperation? Pin
Jim A. Johnson12-Jun-01 5:55
Jim A. Johnson12-Jun-01 5:55 
GeneralAdding resource(bitmap) in run-time. Pin
11-Jun-01 9:26
suss11-Jun-01 9:26 
GeneralRe: Adding resource(bitmap) in run-time. Pin
Igor Sukhov11-Jun-01 9:32
Igor Sukhov11-Jun-01 9:32 
GeneralAbout VC++ 7.0 ... Pin
Hadi Rezaee11-Jun-01 7:05
Hadi Rezaee11-Jun-01 7:05 
GeneralRe: About VC++ 7.0 ... Pin
2sky11-Jun-01 7:54
2sky11-Jun-01 7:54 
GeneralCarriage return/Line feed Pin
RobJones11-Jun-01 6:34
RobJones11-Jun-01 6:34 

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.