Click here to Skip to main content
15,889,808 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Working with CFile!!!! Pin
Maxwell Chen28-Jan-08 22:16
Maxwell Chen28-Jan-08 22:16 
GeneralRe: Working with CFile!!!! Pin
Cedric Moonen28-Jan-08 22:06
Cedric Moonen28-Jan-08 22:06 
GeneralRe: Working with CFile!!!! Pin
rowdy_vc++28-Jan-08 22:38
rowdy_vc++28-Jan-08 22:38 
GeneralRe: Working with CFile!!!! Pin
Maxwell Chen28-Jan-08 23:05
Maxwell Chen28-Jan-08 23:05 
GeneralRe: Working with CFile!!!! Pin
Rajesh R Subramanian28-Jan-08 22:51
professionalRajesh R Subramanian28-Jan-08 22:51 
QuestionProblem in AfxBeginThread Pin
gReaen28-Jan-08 21:35
gReaen28-Jan-08 21:35 
GeneralRe: Problem in AfxBeginThread Pin
Cedric Moonen28-Jan-08 22:01
Cedric Moonen28-Jan-08 22:01 
GeneralRe: Problem in AfxBeginThread Pin
Iain Clarke, Warrior Programmer28-Jan-08 22:34
Iain Clarke, Warrior Programmer28-Jan-08 22:34 
To expand on what Cedric has said...

Why is MyFunc taking a void? Would it not be a good idea to make the parameter of the same pointer type as AfxBeginThread is wanting? That was you can avoid errors in other places in your code.

This is from VC++6 - The prototype may have changed in later versions, but I doubt it. Just be sure to check.

oid myFunc(AFX_THREADPROC pfnThreadProc, LPVOID pParam)
{
HANDLE cmd_thread;
CWinThread* pCmdThread = AfxBeginThread(pfnThreadProc, pParam);
cmd_thread = pCmdThread->m_hThread;
..........
}


It's rare for me to not pass a parameter to a thread - after all, it needs to know why it exists... Or at least a window handle to post an "I'm done" message.

To answer your next question, functions you pass must have the following prototype to be valid for AfxBeginThread:

typedef UINT (AFX_CDECL *AFX_THREADPROC)(LPVOID);

eg:
UINT AFX_CDECL MyThread (void *)
{
   // exciting thread!
  Sleep (10000);
  return 97;
}


I hope that helped.

Iain.
GeneralRe: Problem in AfxBeginThread Pin
gReaen28-Jan-08 23:11
gReaen28-Jan-08 23:11 
GeneralPlot graph using MFC Pin
Kennis28-Jan-08 21:34
Kennis28-Jan-08 21:34 
GeneralRe: Plot graph using MFC Pin
Cedric Moonen28-Jan-08 21:44
Cedric Moonen28-Jan-08 21:44 
GeneralRe: Plot graph using MFC Pin
Maxwell Chen28-Jan-08 21:48
Maxwell Chen28-Jan-08 21:48 
GeneralOops! Pin
Maxwell Chen28-Jan-08 21:52
Maxwell Chen28-Jan-08 21:52 
QuestionRe: Plot graph using MFC Pin
CPallini28-Jan-08 22:50
mveCPallini28-Jan-08 22:50 
GeneralRe: Plot graph using MFC Pin
Iain Clarke, Warrior Programmer28-Jan-08 23:07
Iain Clarke, Warrior Programmer28-Jan-08 23:07 
GeneralRe: Plot graph using MFC Pin
Maxwell Chen28-Jan-08 23:10
Maxwell Chen28-Jan-08 23:10 
QuestionRe: Plot graph using MFC Pin
Mark Salsbery29-Jan-08 5:57
Mark Salsbery29-Jan-08 5:57 
GeneralRe: Plot graph using MFC Pin
Kennis29-Jan-08 16:24
Kennis29-Jan-08 16:24 
GeneralRe: Plot graph using MFC Pin
Mark Salsbery30-Jan-08 5:08
Mark Salsbery30-Jan-08 5:08 
QuestionRe: Plot graph using MFC Pin
Mark Salsbery30-Jan-08 5:15
Mark Salsbery30-Jan-08 5:15 
GeneralRe: Plot graph using MFC Pin
Kennis30-Jan-08 15:06
Kennis30-Jan-08 15:06 
Questioncould anyone tell me what's the error with this code? Pin
ashwiny28-Jan-08 20:14
ashwiny28-Jan-08 20:14 
AnswerRe: could anyone tell me what's the error with this code? Pin
Stephen Hewitt28-Jan-08 20:15
Stephen Hewitt28-Jan-08 20:15 
AnswerRe: could anyone tell me what's the error with this code? Pin
Hamid_RT28-Jan-08 20:43
Hamid_RT28-Jan-08 20:43 
AnswerRe: could anyone tell me what's the error with this code? Pin
CPallini28-Jan-08 21:27
mveCPallini28-Jan-08 21:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.