|
-
October 29th, 2005, 12:33 PM
#1
Problem with CEvent
hi ,
I have an aplication that has a dialog and inside this dialog I have another dialog that is on a work thread. When I show the outer dialog I run the thread on the inner dialog and have to wait its finish to continue working with the outer dialog. I dicided to use a CEvent to signilize the end of the thread. The problem is that when I compile the aplication in the line that I declared the CEvent object I recieved the error:
:\EstWin\CalcNota.cpp(103) : error C2143: syntax error : missing ';' before '*'
An on the references to CEvent object I got:
c:\EstWin\CalcNota.cpp(103) : error C2501: 'p::CEvent' : missing storage-class or type specifiers
c:\EstWin\CalcNota.cpp(103) : error C2501: 'p::Evento' : missing storage-class or type specifiers
c:\EstWin\CalcNota.cpp(109) : error C2039: 'Evento' : is not a member of 'p'
(p is the structure used to pass the parameters).
Related code:
Code:
struct p // structure used to pass the parameters.
{
CDialog* CDial;
CString String;
int* Semaforo;
bool bSoCotas;
CEvent* Evento; //--- Event to signilize the end of the thread
}Parametros;
....
//--- the outer dialog
BOOL CalcNota::Create(int* pSemaforo,CWnd* pWnd) //--- modeless.
{
Parametros.Evento = CreateEvent(NULL, TRUE, FALSE,"Calculo Nota De Serviço");
return CDialog::Create(IDD,pWnd);
}
//--- Thread function
//--- Calculanota is the inner dialog
UINT MyControllingFunction( LPVOID pParam ) //--- Thread for the inner calculation
{
CalculaNota CalculaNotaDeServico(Parametros.String,Parametros.CDial,Parametros.Semaforo,Parametros.bSoCotas);
CalculaNotaDeServico.MontaSecoes();
((CEvent*)((struct p*)pParam)->Evento)->SetEvent(); //---End of calculation
return 0;
}
...
//--- function that start the thread
void CalcNota::OnIniciarcalc()
{
CMainFrame* MainFrame = (CMainFrame*)AfxGetMainWnd();
CString NomeProj(((CMainFrame*)AfxGetMainWnd())->PegaProjetoAtual());
Parametros.String = ((CMainFrame*)AfxGetMainWnd())->PegaProjetoAtual();
Parametros.CDial = this;
Parametros.bSoCotas = IsDlgButtonChecked(IDC_CALCSOCOTA) != 0;
T = AfxBeginThread(MyControllingFunction,Parametros.Evento,THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED);
T->m_pMainWnd = MainFrame;
T->ResumeThread(); //--- Executes the tread.
}
These erros usualy occurs when the header is not included. I seached on MSDN and there is no reference to header on this issue. What can be wrong?
Thanks in advance
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|