CListCtrl in Help About Dialog Box

Hi. I’ve used a CListCtrl before in my FormView, but I haven’t used it in a 
Help About dialog before and I’m having trouble.

MyApp.cpp has code something like this:

Void CMyApp::OnAppAbout()
{

    CAboutDlg aboutDlg;


    aboutDlg.m_myListCtrl.InsertColumn(0, “Name”, LVCFMT_LEFT);

}

I get the assert in the call to InsertColumn(). It’s in the return statement 
in InsertColumn() where the assert occurs (in afxcmn.inl).

Any idea? Thanks.

0
Joe (497)
11/27/2006 7:38:01 PM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
437 Views

Similar Articles

[PageSpeed] 26

That's because the list control hasn't been created yet (because the dialog
box hasn't been created yet).
So you have 2 choices. One is to move the InsertColumn call into
CAboutDlg::OnInitDialog. Second one is to make the About dialog modeless and
call the InsertColumn after you call aboutDlg.Create(...);

AliR.


"Joe" <Joe@discussions.microsoft.com> wrote in message
news:9CCC3F6C-C4AD-435C-9F3C-F7F3F6D59548@microsoft.com...
> Hi. I've used a CListCtrl before in my FormView, but I haven't used it in
a
> Help About dialog before and I'm having trouble.
>
> MyApp.cpp has code something like this:
>
> Void CMyApp::OnAppAbout()
> {
>
>     CAboutDlg aboutDlg;
>
>
>     aboutDlg.m_myListCtrl.InsertColumn(0, "Name", LVCFMT_LEFT);
>
> }
>
> I get the assert in the call to InsertColumn(). It's in the return
statement
> in InsertColumn() where the assert occurs (in afxcmn.inl).
>
> Any idea? Thanks.
>


0
AliR3470 (3235)
11/27/2006 7:42:11 PM
AliR - thanks for the info! When I’ve used a CListCtrl before it was always 
on the main window of a CFormView and I always put the initialization code in 
CMyView::OnInitDialog(). Guess that’s why I didn’t have this problem before. 
;-)
0
Joe (497)
11/27/2006 8:02:02 PM
Since the list control does not exist, it is not possible to add anything to it.  It
doesnot exist until the DoModal is done.  The ASSERT call is appropriate, because you
asked it to do something to a nonexistent control.

Initialize the control contents in OnInitDialog.
					joe

On Mon, 27 Nov 2006 11:38:01 -0800, Joe <Joe@discussions.microsoft.com> wrote:

>Hi. I�ve used a CListCtrl before in my FormView, but I haven�t used it in a 
>Help About dialog before and I�m having trouble.
>
>MyApp.cpp has code something like this:
>
>Void CMyApp::OnAppAbout()
>{
>
>    CAboutDlg aboutDlg;
>
>
>    aboutDlg.m_myListCtrl.InsertColumn(0, �Name�, LVCFMT_LEFT);
>
>}
>
>I get the assert in the call to InsertColumn(). It�s in the return statement 
>in InsertColumn() where the assert occurs (in afxcmn.inl).
>
>Any idea? Thanks.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
11/27/2006 8:45:14 PM
Joe, yeah thanks – I think I still have too much turkey in my system. ;-) As 
AliR and you suggested I already created a CAboutDialog::OnInitDialog() 
method and am initializing the List Control in there – which is working fine 
(as expected).
0
Joe (497)
11/27/2006 9:16:01 PM
Reply:

Similar Artilces:

Chart Help Please!
Hello all, I have a very simple chart... The data looks like this: A B Data1 3.65 Data2 7.00 The data charts fine and looks good but right now the bar for Data1 and Data2 are the same color. is there a way to have the bar for data1 one color while data2 is a different color? Thank you all for you excellent help!! In 2003 Select the series and Format Data Series>Options>Vary colors by point. In 2007 Select the series and Format>Date Series>Fill>Vary colors by point. Gord Dibben MS Excel MVP On Sat, 28 Nov 2009 11:32:02 -080...

mail queue help
I get some emails for users who the sender has miss spelled their or has it in the wrong format etc. I how do I have exchange to delete this from the queue automatically. I have the filter if not in active directory box checked. thanks "Eddie" <Eddie@discussions.microsoft.com> wrote: >I get some emails for users who the sender has miss spelled their or has it >in the wrong format etc. I how do I have exchange to delete this from the >queue automatically. I have the filter if not in active directory box >checked. thanks Enabling the directory checking on the...

Index | Match Formula (help)
I'm using this formula =INDEX(Sheet2!$A$1:$E$30,MATCH(A2,Sheet2!$A$1:$A$30,0),MATCH(B2,Sheet2!$A$1:$E$1,0)) to return a value from a table. I've copied this formula do a column of cells and getting the #N/A message in the cell. I understand why this is taking place, because the cells are null. Can I include in this fromula something to make this return an blank value if the cells dont have data entered yet. Sheet1 has the null cells not the table. Cell A2 and B2. I'm entering data in these cells as needed but would like to have the index formula copied and ready to find when...

Pls Help on Mapi Problem
Hi, we are getting this: "cant open this item. the mapi spooler has already begun transmitting this message" in our outlook 2000, Personal Folder, emails will not go out, they all sit in the outbox. Can someone point me in the right direction. Thanks Jay >From: jay@gjan.com (jay=A0patel) >Hi, >we are getting this: >"cant open this item. the mapi spooler has already begun >transmitting this message" >in our outlook 2000, Personal Folder, emails will not go >out, they all sit in the outbox. >Can someone point me in the right direction....

Filter on subform using unbound text box
Hello Forum Members: I'd like to have some help on the following codes on the Access 2000: On the Form Header, I have an unbound text box called FindWord, in which I type some words to search. The code below works on the main form. {code} Private Sub cmdFilter_Click() Dim strWhere As String Dim lngLen As Long If Not IsNull(Me.FindWord) Then strWhere = strWhere & "([English] Like ""*" & Me.FindWord & "*"") AND " End If lngLen = Len(strWhere) - 5 If lngLen <= 0 Then MsgBox "Nothing is speci...

no list box for dropdown CComboBox
I'm using VC6 and MFC. I also have RichEdit. In a modeless dialog box (Dialog Editor) I have 2 CComboBoxes. The program works fine but with this exception: when I select the drop down arrow on either one of the CComboBoxes I don't get the list box! (I call InitStorage(20, 30) on both CComboBoxes.) How do I get a drop down list box when I select it with an arrow? It's got to be something simple! (If I haven't given all the details just let me know.) Any help would be much appreciated. Scott Select the combo box in the resource editor. Now click on the arrow button port...

Names in Workbook Box
In one of my worksheets, I have defined each of 32 NFL teams using some sort of abbreviation, using "Insert...Name...Define". Is it possible to copy (and paste) these abbreviations in the Names in Workbook box into another workbook??? In other words, I want to use my abbreviations in a workbook yet to be constructed. Thank you, FLKulchar I do not know for sure, but I would have thought that this is the sort of thing Jan Karel Pieterse's Name Manager add-in handles. It is free, so try it out at http://www.jkp-ads.com/OfficeMarketPlaceNM-EN.htm -- HTH RP (remove nothere...

Help Please
Evening A while back I was missing / lost / corrupted a "calandar" folder in outlook. Some one pointed me in the direction of a utility that let one recreate / remove corrupted "calandar" folder. Fogot the nake of the files but I seem to remember you had to run a script to help with this matter... Antone outthere remember what hthis procedutre was and the files used to fix these "system untouchable folders????" Thanks much Cast8Away AKA Dobbie May Your Sock Count Always Be Even Cast8Away@ya.hoo.me <Cast8Away@ya.hoo.me> wrote: > A while back I w...

CListCtrl Header height change??
CListCtrl Header height change?? Is it possible to change the height of a CListCtrl Header.? Thanks Markus ...

EXCEL HELP!!
I want to number a column 4000-5000, I don't want to sit and type all those numbers out by hand. Is there a way to number consecutively?? Please help?? Hi in A1 enter the following formula =ROW()+3999 copy this formula down for 1000 rows -- Regards Frank Kabel Frankfurt, Germany jenniferwillis@wrmf.com wrote: > I want to number a column 4000-5000, I don't want to sit > and type all those numbers out by hand. Is there a way to > number consecutively?? Please help?? Jennifer Frank's method will do what you want, but it will leave formulas in the cells, which you may ...

Query Expression help
What is the correct expression to get average handle time per return, rather than per batch (returns are logged in batches that vary in quantity). Currently using this espression to get AHT per batch- Handle Time: [Sign In Time]-[Sign Out Time] I would like to divide this sum by [Processed], which is already an expression Processed: [Filed]+[Sent to Accounting]+[Pended] to ger AHT per return. I tried- Handle Time: sum([Sign In Time]-[Sign Out Time])/[Processed], but that doesn't work. Help! Perhaps the following, although I suspect that will not give you the results you expect. S...

Copying Formulas in 2003 HELP HELP HELP
My question is a little unique. My formula is G1*1.1 I put the result in H1. I can drag a formula down in a column, and it increments the row number, but the resulting answer is the same in H2 as it was in H1. If I press F2 in H2 then enter, the answer is correct. My spreadsheet is almost 15,000 lines, and I do not want to have to F2 each cell in the H column....... Any ideas or suggestions? Thanks...... Roxy Hi Roxy check tools / options / calculation - ensure that it is set to automatic Cheers JulieD "RoxyB94" <RoxyB94@discussions.microsoft.com> wrote in mes...

Access Combo Box
I need some help in setting up Access combo box. I would greatly help someone could help me with the below problem. I am using three comboboxes in my form. Comb Box 1, Combo Box 2, Combo Box 3. The row source for each of the combo box is a seperate table. Table 1 acts as row source for Combo Box 1 Table 2 acts as row source for Combo Box 2 However for combobox 3, I was trying to use 4 different tables as row source. I am trying to set up a criteria such that row source for comb box depends on what is selected in combo box 1 & 2 sorry if I made the question overly complicated. Just as ...

help function
I am using Office 2007 and Vista. The help function in Excel and the other Office programs does not work any more. Does anybody know how to reactivate this function? Marinus. This is normally handled through the installation. With custom installations, you can choose to add or remove help files. They(MS) setup this choice because some users do not want the help files. The help files do require considerable storage space. Anyways, you should be able to reinstall the help files from disc. Dennis "Marinus van Holst" <m.holst@hccnet.nl> wrote in message news:#KrAswl...

Problems with CListCtrl
I'm having trouble with a CListCtrl object. I'm trying to automatically set the selected items of the list from my code. I try the following statement: m_List.SetItem (pos, 0, LVIF_STATE, NULL, 0, LVIS_SELECTED, LVIS_SELECTED, 0); The SetItem function returns non-zero, which supposedly means it was successful. However, I don't see any selection showing up. I even called RedrawItem on this list item, but it didn't help either. Anyone know about this? -Eric >I'm having trouble with a CListCtrl object. I'm trying to automatically >set the selected ite...

CTreeCtrl and CListCtrl problem
I use create a single document struct using MFC(explore style).The left of the window is CLeftView class(which inherit CTreeView).The right is CBrowserView which inherit CListView.I want to display the content of a directory in the right(CListview) when user click the item of the ctreectrl. In the LeftViw I add method "void CLeftView::OnClickItem (NMHDR* pNMHDR, LRESULT* pResult)" because I want to know which item be clicked by user. ////////////////Leftview////////////////////// CTreeCtrl& mtree=GetTreeCtrl(); HTREEITEM item=mtree.GetSelectedItem(); data=mtree.GetItemDat...

CListCtrl and sub item editting
Hi, Is it possible to implement CListCtrl sub item editting without creating a custom ctrl? I am using VS2003. TIA Tony >Is it possible to implement CListCtrl sub item editting without creating a >custom ctrl? Tony , There's no built-in support for this, so no, you have to provide some implementation for this. Have a look on sites such as CodeGuru and CodeProject, they'll have examples. Dave Thanks Dave, I've seen examples, I just wasnt sure if I needed my own ctrl. Regards Tony "David Lowndes" <DavidL@example.invalid> wrote in message news:k...

ignore street number on Combo Box Autoexpand
I have a list of street names in a form's Comb Box, some of the streets have more than one door number. I want the user to be able to type the first letter, that for example, is the letter 'M' for Main Street, and then the Combo Autoselect go to the first avaliable address beginning with 'M' which in the example below is '53 Main Street'. Is this possbile? eg: South Street West Street 53 Main Street 21 Main Street Main Street East Street North Street On Jan 5, 8:04 am, efandango <efanda...@discussions.microsof...

Please help, problem with Outlook 2002 freezing
I am having an odd problem with Outlook 2002 hanging when started. It makes it to right to the point where it tries to check for new mail, then hangs. When I close it and do the end program deal, then try to reopen it, it seems to work fine. This happens everytime I use Outlook. Any ideas anyone??? Thanks! find and delete the *.srs file for your profile. http://www.outlook-tips.net/beginner/filepath.htm if you need help finding it. -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Need Help with Common Tasks? http://www.outlook-tips.net/beginner/ Outlook...

Validation
With validation you get an arrow for a pull down, when you are standing in the cell. If you not standing in this cell you do not know there is a pulldown menu. Does one of you know if it is possible that the arrow is shown everytime. thnks Not with data validation, the arrow, as you have discovered, is only visible when the cell is selected. If you want it the other way, you will unfortunately need to 'roll your own' validation with comboboxes from the 'control toolbox' and write code for the validation -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England nick_...

help!!!
microsoft word isnt letting me make changes to an already saved document, when i go to type, the toolbar at the bottom of the screen says "this modification is not allowed because the selection is locked" it wont even let me open a fresh new document, it says the same thing when i go to type on a blank document. how do i fix this???? It sounds like you are probably using a trial version of the software that has now expired or you have not activated your copy of the software? If so, see: http://us20.trymicrosoftoffice.com/faq.aspx -- Hope this helps. Please re...

I need help charting
I am new to charting. I need to chart 5 different companies with a cost bid and a cost hit by company. Can you explain how. Very confused. Thanks. Hi, Don't know what a cost hit is? Maybe you can show us some sample data and tell us what kind of chart you need - pie, line, column....? -- Thanks, Shane Devenshire "mgm" wrote: > I am new to charting. I need to chart 5 different companies with a cost bid > and a cost hit by company. Can you explain how. Very confused. > > Thanks. > Hi, Thanks for your response. For example 5 companies, hit and...

Help, documents on desktop not loading
Hello, Hope you can help, I have saved some excel sheets to my desktop but when I double click to open all i get is the following message "cannot find the file c:/doc&sett......... make sure path and filename...etc although if i open excel and go through the file menu these open without a problem. I have went through all the usual routes and everything is pointing too the right place. Anyone got any ideas please Thank you in advance Sometimes one of these works when you're having trouble with double clicking on the file in windows explorer: Tools|Options|General|Ignore...

Help on help
At work I use Windows XP Professional Version 2002 SP2 with Excel 2002. When I need help, I press F1 from anywhere, I get the normal help with tabs of "Contents", "Answer Wizard", and "Index". This is the same help for a long time and it's great to answer most questions. But at home I use Windows XP Home Edition with Office 2003. I press F1 in Excel and it tries to search the web. I'D REALLY LIKE THE OLD HELP THAT I HAVE AT THE OFFICE!! Does anyone know if this is a setting that can be changed??? THANK YOU! Although the help in 2003 will neve...

REQ help: powerpoint printouts have blank lines down the middle
When printing powerpoint slides at work there is a clearly defined blank rectangle running the entire length of the slide dividing the image on the slide. Oddly enough if an image is placed on top of the original image that 2nd image is not affected. IE) if I were to print out a slide with a screenshot of googlemaps and had pasted a picture in the center to depict a building or landmark the googlemap image would have a blank rectangle, but the pasted image would not be divided/affected. This issue only affects powerpoint slides. There are no issues with .jpgs, ..pdfs, word, e...