how to create new thread
-
Hi, I need to create new thread if I click on particular button in my MFC application.I have added following code.
AfxBeginThread( CRuntimeClass* pfnThreadProc,LPVOID pParam,
int nPriority = THREAD_PRIORITY_NORMAL,UINT nStackSize = 0,
DWORD dwCreateFlags = 0,LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL);
UINT CTestcycleDlg::pfnThreadProc(LPVOID pParam )
{
}I am getting errors one of thoes error is
error C2275: 'CRuntimeClass' : illegal use of this type as an expression
I have created user interface thread.Is it correct.Where I need to close thread and how to closehemlat wrote:
AfxBeginThread( CRuntimeClass* pfnThreadProc,LPVOID pParam, int nPriority = THREAD_PRIORITY_NORMAL,UINT nStackSize = 0, DWORD dwCreateFlags = 0,LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL);
What is this? Are you trying to call
AfxBeginThread()
, or just duplicate the prototype?"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
Hi, I need to create new thread if I click on particular button in my MFC application.I have added following code.
AfxBeginThread( CRuntimeClass* pfnThreadProc,LPVOID pParam,
int nPriority = THREAD_PRIORITY_NORMAL,UINT nStackSize = 0,
DWORD dwCreateFlags = 0,LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL);
UINT CTestcycleDlg::pfnThreadProc(LPVOID pParam )
{
}I am getting errors one of thoes error is
error C2275: 'CRuntimeClass' : illegal use of this type as an expression
I have created user interface thread.Is it correct.Where I need to close thread and how to closehemlat wrote:
UINT CTestcycleDlg::pfnThreadProc(LPVOID pParam )
i think you forget to make function static
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You
-
Rajesh R Subramanian wrote:
Actually, there is. Please read the docs[^]
Good reference
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You
-
hemlat wrote:
AfxBeginThread( CRuntimeClass* pfnThreadProc,LPVOID pParam, int nPriority = THREAD_PRIORITY_NORMAL,UINT nStackSize = 0, DWORD dwCreateFlags = 0,LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL);
What is this? Are you trying to call
AfxBeginThread()
, or just duplicate the prototype?"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
Actually I dont know how to create thread.I have tried with above code.I am seaching the code for thread creation.
hemlat wrote:
I am seaching the code for thread creation. Quote Selected Text
Still?! Are you kidding me? I gave you link to an excellent UI thread tutorial yesterday. Did you read it or not? Why are you "searching" for code, BTW? You're supposed to write code if you are a programmer of any kind.
It is a crappy thing, but it's life -^ Carlo Pallini
-
hemlat wrote:
I am seaching the code for thread creation. Quote Selected Text
Still?! Are you kidding me? I gave you link to an excellent UI thread tutorial yesterday. Did you read it or not? Why are you "searching" for code, BTW? You're supposed to write code if you are a programmer of any kind.
It is a crappy thing, but it's life -^ Carlo Pallini
-
Thanks for your reply.Just now I have started working.Morning I was busy with some other task.Just I replyed to his message he was asking me what I was doing.I started working on Link which u hv sent.
-
I need to create worker thread.Because I need to put my functionality in thread function. Can you suggest any link which will show how to create worker thread
-
I need to create worker thread.Because I need to put my functionality in thread function. Can you suggest any link which will show how to create worker thread
hemlat wrote:
Can you suggest any link which will show how to create worker thread
Did you even bother to read the article that Rajesh provided? If you had, you would have noticied a link to this. :rolleyes:
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-