-
December 21st, 2009, 11:45 AM
#1
Code Using Multithreading
This is my first program in VC++.net. Am developing a GUI appln tool for receiving datas from a Processor based PCBs. Here i have to use Multithreading. I've no previous experience on using Thread. From the help of MSDN, I've tried to make it. The code layout is as follows...
<code>
void OnBnClickedReceive()
{
DWORD threadId;
int value = 10;
CreateThread(NULL, 0, File_edit, &value, 0, &threadId
}
DWORD WINAPI File_edit(LPVOID lp)
{
// processing....
}
</code>
But the Error messages came as
'CNewSerialPrintDlg::FileData_edit': function call missing argument list; use '&CNewSerialPrintDlg::FileData_edit' to create a pointer to member'
Not getting any ideas to fix it.. Plz help n give me details for a thread development.
-
December 21st, 2009, 01:00 PM
#2
Re: Code Using Multithreading
Didn't you notice that the code tags didn't work? Who knows what else you don't notice. If you want to be a programmer you'll have to learn to pay attention to detail.
-
December 22nd, 2009, 12:13 AM
#3
Re: Code Using Multithreading
Sorry i was in hurry when I posted that..
Am reposting my exact codes..Plz help me.
Code:
void CNewSerialPrintDlg::OnBnClickedReceive()
{
// TODO: Add your control notification handler code here
HANDLE m_RecvThread=NULL;
DWORD ThreadID = 0;
m_RecvThread = ::CreateThread(NULL,
0,
FileData_edit,
NULL,
0,
&ThreadID);
}
DWORD WINAPI CNewSerialPrintDlg::FileData_edit(LPVOID lp)
{
//bla.. bla...
return 0;
}
The error message is:
'CNewSerialPrintDlg::FileData_edit': function call missing argument list; use '&CNewSerialPrintDlg::FileData_edit' to create a pointer to member
Plz help me to fix it
-
December 22nd, 2009, 01:16 AM
#4
Re: Code Using Multithreading
The thread function needs to be static or outside the class scope.
Regards,
Ramkrishna Pawar
-
December 22nd, 2009, 05:41 AM
#5
Re: Code Using Multithreading
Static means I have to declare all the variables n member functions as static. Am I right?
thatś not easy.... So scope out of class means. Should I declare it as private???
plz specify??
-
December 22nd, 2009, 06:12 AM
#6
Re: Code Using Multithreading
Out of class means a public function. You can also try the CWinThread class instead of creating the thread using CreateThread API.
Regards,
Ramkrishna Pawar
-
December 22nd, 2009, 06:17 AM
#7
Re: Code Using Multithreading
I've declared the thread function as public only..
Sorry 2 say,it's my first VC++ project. So how may I use WinThread().... plz. and will it fix the error coming.
In my developing tool,have to identify certain datas all time continuously..thats wy I chose Multithreading by using CreateThread(). And the process function declared as FileData_edit. All parts u may c from the code posted..
-
December 22nd, 2009, 06:20 AM
#8
Re: Code Using Multithreading
The function FileData_edit can not be non-static, it has to be global function (without a class) or static member function of the class.
I am sorry but I think as a part of learning, you should try fixing it from the information I am supplying.
Regards,
Ramkrishna Pawar
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|