Quelqu'un peut-il me dire pourquoi je compile ce projet (VC++ 6) j'obtient tjs une erreur " error C2665: 'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'unsigned int (void *)'"
// Chap18bDoc.cpp : implementation of the CChap18bDoc class
//
#include "stdafx.h"
#include "Chap18b.h"
#include "Spinner.h"
#include "Chap18bDoc.h"
#include "Chap18bView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CChap18bDoc
IMPLEMENT_DYNCREATE(CChap18bDoc, CDocument)
BEGIN_MESSAGE_MAP(CChap18bDoc, CDocument)
//{{AFX_MSG_MAP(CChap18bDoc)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChap18bDoc construction/destruction
CChap18bDoc::CChap18bDoc()
{
// TODO: add one-time construction code here
}
CChap18bDoc::~CChap18bDoc()
{
}
BOOL CChap18bDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
InitSpinners();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CChap18bDoc serialization
void CChap18bDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CChap18bDoc diagnostics
#ifdef _DEBUG
void CChap18bDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CChap18bDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CChap18bDoc commands
void CChap18bDoc::CalcPoint(int nID, CSpinner *pSpin)
{
RECT lWndRect;
CPoint pPos;
int iLength;
CChap18bView *pWnd;
pWnd = (CChap18bView*)pSpin->GetViewWnd();
pWnd->GetClientRect(&lWndRect);
iLength = lWndRect.right/6;
switch (nID) {
case 0 : pPos.x = (lWndRect.right/4) - iLength;
pPos.y = (lWndRect.bottom/4) - iLength;
break;
case 1 : pPos.x = ((lWndRect.right/4) * 3) - iLength;
pPos.y = (lWndRect.bottom/4) - iLength;
break;
case 2 : pPos.x = (lWndRect.right/4) - iLength;
pPos.y = ((lWndRect.bottom/4) * 3) - (iLength * 1.25);
break;
case 3 : pPos.x = ((lWndRect.right/4) * 3) - iLength;
pPos.y = ((lWndRect.bottom/4) * 3) - (iLength * 1.25);
break;
}
pSpin->SetLength(iLength);
pSpin->SetPoint(pPos);
}
void CChap18bDoc::InitSpinners()
{
int i;
POSITION pos = GetFirstViewPosition();
if (pos != NULL) {
CView* pView = GetNextView(pos);
for (i=0; i<4; i++) {
m_cSpin[i].SetViewWnd(pView);
m_cSpin[i].SetContinue(NULL);
switch(i) {
case 1 : m_cSpin[i].SetContinue(&((CChap18bView*)pView)->m_bThread1);
break;
case 3 : m_cSpin[i].SetContinue(&((CChap18bView*)pView)->m_bThread2);
break;
}
CalcPoint(i, &m_cSpin[i]);
}
}
}
void CChap18bDoc::DoSpin(int nIndex)
{
m_cSpin[nIndex].Draw();
}
UINT CChap18bDoc::ThreadFunc(LPVOID pParam)
{
CSpinner* lpSpin = (CSpinner*)pParam;
BOOL* pbContinue = lpSpin->GetContinue();
while (*pbContinue)
lpSpin->Draw();
return 0;
}
void CChap18bDoc::SuspendSpinner(int nIndex, BOOL bSuspend)
{
if (!bSuspend) {
if (m_pSpinThread[nIndex]) {
HANDLE hThread = m_pSpinThread[nIndex]->m_hThread;
::WaitForSingleObject(hThread, INFINITE);
}
}
else {
int iSpnr;
switch (nIndex) {
case 0 : iSpnr = 1;
break;
case 1 : iSpnr = 3;
break;
}
m_pSpinThread[nIndex] = AfxBeginThread(ThreadFunc,(LPVOID)&m_cSpin[iSpnr]);
}
}