So im using this code to start a thread...

namespace Monitor4vc {
public ref class Stats 
{
public:
Stats()
{
}

~Stats(){}

void set(int prid, String ^url, String ^pst, String ^pth){
pid=prid;
httpUrl=url;
post=pst;
path=pth;
}
void start(){
thread=_beginthread(OpenProc,0,NULL);//Error
}
private:          
		ArrayList playing;
		ArrayList quitp;
		HANDLE thread;
        int pid;
        String ^httpUrl, ^post, ^path;
        HANDLE Proc;
//		ArrayList ^quit;

public:
void OpenProc(void *asdnothin){
   Proc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, (DWORD)pid);
   if(!Proc)
   {
      return;
   }
   //////////////////////////////////
    HANDLE  tkh;
    LUID thy_l;
    OpenProcessToken(Proc, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &tkh);
     LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &thy_l);
     //////////////////////////////
     Player pl;
     char f=0xFF;
     ArrayList thisRound;

etc...

and its giving me this error

1>e:\prgms\monitor 4 vc++\monitor 4 vc++\status.h(37) : error C3867: 'Monitor4vc::Stats::OpenProc': function call missing argument list; use '&Monitor4vc::Stats::OpenProc' to create a pointer to member

ive ran into this so many times, can someone tell me how to fix it?

Recommended Answers

All 5 Replies

The first parameter must be either a static method of a class or a global function. You can't pass class methods unless they are declared static.

The first parameter must be either a static method of a class or a global function. You can't pass class methods unless they are declared static.

so should i call this from another class?
like

player p; 
_beginthread(p.OpenProc,0,NULL);

?

i need it to not be static so i can access all the variables...

so should i call this from another class?
like

player p; 
_beginthread(p.OpenProc,0,NULL);

?

i need it to not be static so i can access all the variables...

The first parameter must be either a static method of a class or a (pointer to) ordinary (not only global ;)) function.
See, for example: http://www.codeproject.com/KB/threads/krunner.aspx

What I have sometimes done is make the first parameter a static method then make the third parameter (arglist) the this pointer of the class instance. That way the thread can access the public objects of the class.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.