15,911,030 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by 2buck56 (Top 9 by date)
2buck56
22-Nov-10 15:51pm
View
Richard, I thought I had tried *ar << but I must not have because that does work. This was just a learning experience as I don't think there is any real advantage to using *ar versus using ar and br for store and load operations. But it does give me knowledge for future use. Thanks for all your help.
2buck56
22-Nov-10 14:56pm
View
Hmmm..... This code:
CArchive* ar = new CArchive(&f, CArchive::store);
for(x=0; x<7; x++)
{
numarray[x][0] = m_ListCtrl.GetItemText(x,0);
ar << numarray[x][0];
numarray[x][1] = m_ListCtrl.GetItemText(x,1);
ar << numarray[x][1];
}
The compiler gives this error:
error C2678: binary '<<' : no operator found which takes a left-hand operand of type 'CArchive *' (or there is no acceptable conversion)
2buck56
22-Nov-10 12:37pm
View
Richard, thanks for the suggestion. However, I've tried using CArchive* ar with new and delete. Even after you delete the ar pointer, you cannot re-use it. The compiler complains with the same error message. If I am going to have to create 2 objects anyway, I might as well use ar for writing and br for reading.
2buck56
8-Nov-10 15:38pm
View
_Superman, thanks for all your help. That works perfectly now. The class constructor and private member variable in CEditData did the job. For calling from the CSmartBlockDlg class into the CEditData class I stayed with creating another instance of CEditData.
The next time I need to do this I will have this project for a reference. The Dialog based class created problems for me.
2buck56
8-Nov-10 13:10pm
View
Can you show me a couple of code snippets on how to get the addresss of the Dialog box and pass it to the other function? I did this: CWnd *pWnd = GetDlgItem(IDD_SMARTBLOCK_DIALOG); and passed pWnd to the other function.
I changed the other function to this: void CEditData::CheckData(int DataType, CWnd *myData) but in the CheckData function when i use myData-> the CAddList is not available.
When I call the CEditData function from the CDialog class I will create another object for that. Since I will only be doing some math over there it doesn't matter if it is done with the original class or another instance.
I'm starting to get to the point I'm seriously considering forgetting about the other class and just have my original Dialog class do everything. I was trying to avoid 1500 lines of code in one class but there may not be a way to do that.
2buck56
7-Nov-10 21:29pm
View
I'm not sure I understand. I don't want a new object of the class. I just want to call a function in the original class (CSmartBlockDlg) and have it populate the original ListCtrl. However, I changed the code in the CEditData class to this:
CSmartBlockDlg myObj;
myObj.CListAdd(0);
That works and the compiler warning goes away. I wind up in the CListAdd function because my MessageBox pops up and tells me I am there. However, the ListCtrl does not populate with the data that is in the CListAdd function. If I call the CListAdd function from within another function of CSmartBlockDlg, the ListCtrl does populate with the data.
2buck56
7-Nov-10 10:58am
View
From within the CDialog button function I call the other function this way:
CEditData *pInfo;
pInfo = NULL;
pInfo->CheckData(0); // call function in EditData.cpp
Then from within the EditData::CheckData function I call the CDialog function this way:
CSmartBlockDlg *pList;
pList = NULL;
pList->CListAdd(0); // call ListAdd in Smart BlockDlg.cpp
I found that if I comment out the pInfo = NULL and the pList = NULL, it works. But I get compiler warnings:
uninitialized local variable 'pList' used and uninitialized local variable 'pInfo' used
And I don't think warnings should be ignored.
2buck56
5-Nov-10 21:55pm
View
I couldn't get the reference method to work. I'm not sure exactly how that would be coded. I did this:
CSmartBlockDlg test;
test.m_ListCtrl.InsertItem(0, _T("TESTING"));
It compiles but when I run it I get a "Debug Assertion Failed" error.
I created a function in CSmartBlockDlg named CListAdd(char Data). When I run test.CListAdd(char) to call the function and pass it a char it runs with no problem and passes the char. So I guess I will create a CListDel and CListGet function and do it that way since it appears impossible to directly access the original m_ListCtrl variable.
2buck56
5-Nov-10 17:48pm
View
I'm sorry but I don't understand what you mean. Where did you get m_CDialog from?
My actual dialog class is named CSmartBlockDlg. And m_ListCtrl is the identifier within that class.
I could add something like CSmartBlockDlg.AddListItem. But I will also be removing items. When that happens I will need to re-read the entire list back into the class I am in so I can use the results to repopulate an array that is being sent to a piece of hardware through the USB port. So I really need full access to the List Control from within my other class.
Show More