CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2008
    Posts
    59

    Smile 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.

  2. #2
    Join Date
    May 2002
    Location
    Lindenhurst, NY
    Posts
    867

    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.

  3. #3
    Join Date
    Oct 2008
    Posts
    59

    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

  4. #4
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: Code Using Multithreading

    The thread function needs to be static or outside the class scope.
    Regards,
    Ramkrishna Pawar

  5. #5
    Join Date
    Oct 2008
    Posts
    59

    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??

  6. #6
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    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

  7. #7
    Join Date
    Oct 2008
    Posts
    59

    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..

  8. #8
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    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
  •  





Click Here to Expand Forum to Full Width

Featured