Click here to Skip to main content
16,004,906 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Needed a thesis report Pin
Trollslayer17-Oct-05 13:22
mentorTrollslayer17-Oct-05 13:22 
GeneralRe: Needed a thesis report Pin
Maximilien17-Oct-05 15:31
Maximilien17-Oct-05 15:31 
AnswerRe: Needed a thesis report Pin
Prakash Nadar17-Oct-05 16:57
Prakash Nadar17-Oct-05 16:57 
GeneralRe: Needed a thesis report Pin
ThatsAlok17-Oct-05 18:28
ThatsAlok17-Oct-05 18:28 
QuestionConvert from CObject to inherited class Pin
bugDanny17-Oct-05 8:47
bugDanny17-Oct-05 8:47 
AnswerRe: Convert from CObject to inherited class Pin
PJ Arends17-Oct-05 15:40
professionalPJ Arends17-Oct-05 15:40 
GeneralRe: Convert from CObject to inherited class Pin
bugDanny18-Oct-05 5:49
bugDanny18-Oct-05 5:49 
GeneralRe: Convert from CObject to inherited class Pin
PJ Arends18-Oct-05 6:28
professionalPJ Arends18-Oct-05 6:28 
You are obviously doing something wrong with code you have not posted here so far.

I slapped together a quick MFC console app to show you what I did to make it work
/////////////////////////////////////////////////////////////////////////////
// The one and only application object
 
CWinApp theApp;
 
using namespace std;
 
class CMyObject : public CObject
{
public:
    CMyObject() { i = 0; d = 0.0; }
    int i;
    double d;
};
 
CObList ObList;
 
void DumpList()
{
    if (ObList.GetCount() == 0)
        return;
 
    POSITION pos = ObList.GetHeadPosition();
    while(pos)
    {
        CMyObject *p = (CMyObject *)ObList.GetNext(pos);
        cout << p->i << "  " << p->d << endl;
    }
}

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
	int nRetCode = 0;
 
	// initialize MFC and print and error on failure
	if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
	{
		// TODO: change error code to suit your needs
		cerr << _T("Fatal Error: MFC initialization failed") << endl;
		nRetCode = 1;
	}
	else
	{
		// TODO: code your application's behavior here.
		CString strHello;
		strHello.LoadString(IDS_HELLO);
		cout << (LPCTSTR)strHello << endl;
	}
 
    // Fill the CObList with some data
    for (int x = 1; x < 10; ++x)
    {
        CMyObject *p = new CMyObject;
        p->i = x;
        p->d = x + x / 10.0;
 
        ObList.AddTail(p);
    }
 
    DumpList();
 
    return nRetCode;
}
Not perfect, leaks memory, but it should give you an idea.



"You're obviously a superstar." - Christian Graus about me - 12 Feb '03

"Obviously ???  You're definitely a superstar!!!" - mYkel - 21 Jun '04

"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05

Within you lies the power for good - Use it!
AnswerRe: Convert from CObject to inherited class Pin
John M. Drescher17-Oct-05 16:29
John M. Drescher17-Oct-05 16:29 
GeneralRe: Convert from CObject to inherited class Pin
ThatsAlok17-Oct-05 18:30
ThatsAlok17-Oct-05 18:30 
GeneralRe: Convert from CObject to inherited class Pin
John M. Drescher18-Oct-05 11:01
John M. Drescher18-Oct-05 11:01 
AnswerRe: Convert from CObject to inherited class Pin
Rajesh match17-Oct-05 19:16
Rajesh match17-Oct-05 19:16 
GeneralRe: Convert from CObject to inherited class Pin
bugDanny18-Oct-05 5:47
bugDanny18-Oct-05 5:47 
GeneralRe: Convert from CObject to inherited class Pin
Rajesh match19-Oct-05 1:54
Rajesh match19-Oct-05 1:54 
QuestionC++ DLL vs MFC DLL Pin
Tom Wright17-Oct-05 8:18
Tom Wright17-Oct-05 8:18 
AnswerRe: C++ DLL vs MFC DLL Pin
ThatsAlok17-Oct-05 18:34
ThatsAlok17-Oct-05 18:34 
GeneralRe: C++ DLL vs MFC DLL Pin
Tom Wright18-Oct-05 3:53
Tom Wright18-Oct-05 3:53 
GeneralRe: C++ DLL vs MFC DLL Pin
ThatsAlok18-Oct-05 4:08
ThatsAlok18-Oct-05 4:08 
Questionget msn conversation window elements Pin
smargada17-Oct-05 7:27
smargada17-Oct-05 7:27 
AnswerRe: get msn conversation window elements Pin
David Crow17-Oct-05 7:59
David Crow17-Oct-05 7:59 
AnswerRe: get msn conversation window elements Pin
ThatsAlok17-Oct-05 18:25
ThatsAlok17-Oct-05 18:25 
GeneralRe: get msn conversation window elements Pin
smargada18-Oct-05 4:32
smargada18-Oct-05 4:32 
GeneralRe: get msn conversation window elements Pin
ThatsAlok18-Oct-05 4:38
ThatsAlok18-Oct-05 4:38 
QuestionNeed to detect logged in users - NOT using GetUserName/Ex Pin
Xori17-Oct-05 7:11
Xori17-Oct-05 7:11 
AnswerRe: Need to detect logged in users - NOT using GetUserName/Ex Pin
David Crow17-Oct-05 7:34
David Crow17-Oct-05 7: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.