Re: addstring to list box

From: bobby (bobby_at_discussions.microsoft.com)
Date: 11/18/04


Date: Thu, 18 Nov 2004 11:21:03 -0800

Hello It compiled after I removed a line that I had previously written.But
now the prob is it is not doing anything.On the gui i click the button and
the message should come right.It is not.

this is the part of the code in which commented out the prototype.I s that
correct to do? help me plz

void CSomethingDlg::OnBcreate()
{
//DWORD somethread(LPVOID lpvoid);//he prototype of the thread controlling
function
        AfxBeginThread((AFX_THREADPROC)somethread, this);//starting the thread
worker here

        

}

"Marius Prisecaru" wrote:

>
> "bobby" <bobby@discussions.microsoft.com> wrote in message
> news:B397BB83-04D4-4D64-9DBF-ADBB0D062806@microsoft.com...
> > I did that and now I get new errors!!!
> > something.cpp
> > somethingDlg.cpp
> > Generating Code...
> > Linking...
> > somethingDlg.obj : error LNK2005: "public: static unsigned long __cdecl
> > CSomethingDlg::somethread(void *)" (?somethread@CSomethingDlg@@SAKPAX@Z)
> > already defined in something.obj
> > somethingDlg.obj : error LNK2005: "public: void __thiscall
> > CSomethingDlg::TheThreadFunction(void)"
> > (?TheThreadFunction@CSomethingDlg@@QAEXXZ) already defined in
> something.obj
> > somethingDlg.obj : error LNK2019: unresolved external symbol "unsigned
> long
> > __cdecl somethread(void *)" (?somethread@@YAKPAX@Z) referenced in function
> > "protected: void __thiscall CSomethingDlg::OnBcreate(void)"
> > (?OnBcreate@CSomethingDlg@@IAEXXZ)
> > emulatorDbg/something.exe : fatal error LNK1120: 1 unresolved externals
> > Error executing link.exe.
>
> Make sure you have consistent function signatures in your files. In other
> words, make sure you do it exactly as I specified and define these in only
> one place --- inside the CSomethingDlg class!
>
> Thus, in SomethingDlg.h inside the class definition you should have:
>
> static DWORD something(LPVOID lpVoid);
> void TheThreadFunction();
>
> Then, in SomethingDlg.cpp you should have:
>
> DWORD CSomethingDlg::something(LPVOID lpVoid)
> {
> CSomethingDlg* pThis = (CSomethingDlg*)lpVoid;
> pThis->TheThreadFunction();
> return 0;
> }
>
> void CSomethingDlg::TheThreadFunction()
> {
> .... your thread code w/ PostMessages, etc.
> }
>
> Marius
>
>
>
>