Click here to Skip to main content
15,906,574 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Floating point arithmetic Pin
Maxwell Chen28-Jan-08 23:57
Maxwell Chen28-Jan-08 23:57 
GeneralRe: Floating point arithmetic Pin
User 345557728-Jan-08 23:57
User 345557728-Jan-08 23:57 
GeneralRe: Floating point arithmetic Pin
CPallini29-Jan-08 0:13
mveCPallini29-Jan-08 0:13 
GeneralRe: Floating point arithmetic Pin
User 345557729-Jan-08 1:46
User 345557729-Jan-08 1:46 
GeneralRe: Floating point arithmetic Pin
Maxwell Chen29-Jan-08 4:33
Maxwell Chen29-Jan-08 4:33 
GeneralThe villain is found! Pin
User 34555776-Feb-08 1:06
User 34555776-Feb-08 1:06 
QuestionTimer Intervals Pin
Derick Magagula28-Jan-08 22:03
Derick Magagula28-Jan-08 22:03 
GeneralRe: Timer Intervals Pin
Cedric Moonen28-Jan-08 22:09
Cedric Moonen28-Jan-08 22:09 
GeneralRe: Timer Intervals [modified] Pin
Maxwell Chen28-Jan-08 22:09
Maxwell Chen28-Jan-08 22:09 
GeneralRe: Timer Intervals Pin
David Crow29-Jan-08 3:07
David Crow29-Jan-08 3:07 
GeneralRe: Timer Intervals Pin
Maxwell Chen29-Jan-08 4:35
Maxwell Chen29-Jan-08 4:35 
GeneralRe: Timer Intervals Pin
CPallini28-Jan-08 22:54
mveCPallini28-Jan-08 22:54 
QuestionWorking with CFile!!!! Pin
rowdy_vc++28-Jan-08 21:57
rowdy_vc++28-Jan-08 21:57 
GeneralRe: Working with CFile!!!! Pin
Maxwell Chen28-Jan-08 22:04
Maxwell Chen28-Jan-08 22:04 
GeneralRe: Working with CFile!!!! Pin
Cedric Moonen28-Jan-08 22:12
Cedric Moonen28-Jan-08 22:12 
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 

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.