Crimean
July 1st, 1999, 11:29 AM
I have problems when calling a member function of a class ( if i do not define this function as member i cannot use the pointer for the recordset) within another class
CResultDlg is a dialog class where i call by pressing a button and using .DoModal(); And also CNewWordsView::find_random_record(); phrase gets error. I searched help but could not find how to call a member function from another class.
Thank you.
#My programs name is NewWords and i have created it with App.Wizard
#in NewWordsView.cpp
void CNewWordsView::find_random_record()
{
srand( (unsigned)time( NULL ) );
int random_num=rand();
m_pSet->MoveFirst();
m_pSet->MoveLast();
int max_record=m_pSet->GetRecordCount();
m_pSet->MoveFirst();
int decimal, sign;
char *buffer;
double result;
result=(random_num/32500)*max_record;
buffer = _fcvt( result, 7, &decimal, &sign );
int record_pos=atoi(buffer);
if (record_pos!=(max_record-1))
{ m_pSet->Move(record_pos);
}
else
{
m_pSet->Move(record_pos-1);
}
}
void CResultDlg::OnBtn_Vote()
{
CNewWordsView::find_random_record();
}
CResultDlg is a dialog class where i call by pressing a button and using .DoModal(); And also CNewWordsView::find_random_record(); phrase gets error. I searched help but could not find how to call a member function from another class.
Thank you.
#My programs name is NewWords and i have created it with App.Wizard
#in NewWordsView.cpp
void CNewWordsView::find_random_record()
{
srand( (unsigned)time( NULL ) );
int random_num=rand();
m_pSet->MoveFirst();
m_pSet->MoveLast();
int max_record=m_pSet->GetRecordCount();
m_pSet->MoveFirst();
int decimal, sign;
char *buffer;
double result;
result=(random_num/32500)*max_record;
buffer = _fcvt( result, 7, &decimal, &sign );
int record_pos=atoi(buffer);
if (record_pos!=(max_record-1))
{ m_pSet->Move(record_pos);
}
else
{
m_pSet->Move(record_pos-1);
}
}
void CResultDlg::OnBtn_Vote()
{
CNewWordsView::find_random_record();
}