Thread help
-
I'm trying to creat a new thread so I can call a function that has no user interaction and just processes some files. The process takes a long time so I want to use a thread so I can update its status on the main dialog window. I tried AFXBeginThreat(func.cpp) nada! Any help or direction much appriciated! Thanks, Jim
-
I'm trying to creat a new thread so I can call a function that has no user interaction and just processes some files. The process takes a long time so I want to use a thread so I can update its status on the main dialog window. I tried AFXBeginThreat(func.cpp) nada! Any help or direction much appriciated! Thanks, Jim
or just use CreateThread() function. search the function in samples of VC CD, there are lots examples there and very easy to be used. includeh10
-
I'm trying to creat a new thread so I can call a function that has no user interaction and just processes some files. The process takes a long time so I want to use a thread so I can update its status on the main dialog window. I tried AFXBeginThreat(func.cpp) nada! Any help or direction much appriciated! Thanks, Jim
-
or just use CreateThread() function. search the function in samples of VC CD, there are lots examples there and very easy to be used. includeh10
Or, in fact, don't.
CreateThread
does not set up the C runtime library correctly. You may get away with it in a project that uses the DLL version of the CRT, because the CRT DLL'sDllMain
does mostly sort it out. If you're not using MFC, create a new thread with_beginthreadex
. If you are using MFC, useAfxBeginThread
, because again, some initialisation is required for the new thread. -
I'm trying to creat a new thread so I can call a function that has no user interaction and just processes some files. The process takes a long time so I want to use a thread so I can update its status on the main dialog window. I tried AFXBeginThreat(func.cpp) nada! Any help or direction much appriciated! Thanks, Jim
jimNLX wrote: I tried AFXBeginThreat(func.cpp) nada! Threatening a function is no way to get it to behave! The first parameter to
AfxBeginThread()
is not a filename, but a controlling function for the thread. It has a signature of:UINT MyThreadProc( LPVOID pParam );
Five birds are sitting on a fence. Three of them decide to fly off. How many are left?