Click to See Complete Forum and Search --> : test code fromatting tag


billwilson3
May 30th, 2002, 03:29 PM
TestCode(xxx)
{
Code("literal"
// comment
}



{
Code("literal"
// comment
}

billwilson3
May 30th, 2002, 03:30 PM
return bRet;
}
void CComponentInstallationPpg::SetClickNext()
{
// Maintains the instructional message at the bottom of the screen
CString szMessage;


for (int i = 0; i<theApp.m_AppInfoArray.GetSize();i++)
{
CAppInfoItem item = theApp.m_AppInfoArray[i];
if (item.InstallRequested && !item.InstallAttempted)
{
szMessage.Format("Click Next to install %s",item.SetupTitle);
break;
}
}
SetDlgItemText(IDC_CLICKNEXT_INSTALL,szMessage);
}


long CComponentInstallationPpg::GetAvailableDiskSpace(CString szPath, int nZeroForKbOneForMB)
{
// Get drive letter
CString szDiskDriveLetter = szPath.Left(1);
DWORD dwFreeClusters, dwBytesPerSector, dwSectorsPerCluster, dwClusters;
int iKbytes;

// append the backslash
szDiskDriveLetter += _T(":\\");

if ( !GetDiskFreeSpace( (LPCTSTR)szDiskDriveLetter,
&dwSectorsPerCluster,
&dwBytesPerSector,
&dwFreeClusters,
&dwClusters) )
{ return (-1); } // failed on the get for some reason

switch ( nZeroForKbOneForMB )
{
case 0: // format ret val to Kbytes
return( MulDiv( dwSectorsPerCluster * dwBytesPerSector, dwFreeClusters, 1024 ) );
break;

case 1: // format ret val to Mbytes
iKbytes = MulDiv( dwSectorsPerCluster * dwBytesPerSector, dwFreeClusters, 1024 );
if ( iKbytes <= 1023 ) // format ret val to Kbytes if value to small
return( MulDiv( dwSectorsPerCluster * dwBytesPerSector, dwFreeClusters, 1024 ) );
else // format ret val to Mbytes
return ( (long)iKbytes / 1024 );
break;

default: // toss em kbytes man!!!
return( MulDiv( dwSectorsPerCluster * dwBytesPerSector, dwFreeClusters, 1024 ) );
}
}

void CComponentInstallationPpg::InstallComponentThread(int iComponent)
{
// Update UI
SetDlgItemText(IDC_INSTALLING_TEXT,
"Installing " + theApp.m_AppInfoArray[iComponent].SetupTitle);

// Launch the installation in its own thread
m_iCurrentComponent = iComponent;
m_pThread = AfxBeginThread(_InstallThread,
this, THREAD_PRIORITY_NORMAL, CREATE_SUSPENDED);

// Verify thread started
if (m_pThread == NULL)
{
TRACE(_T("Failed to create transfer thread,Install is aborting\n"));
// EndDialog(IDCANCEL); // for this qad just call oncancel - its faster~)
return;
}

m_pThread->m_bAutoDelete = FALSE; // enables 'delete this' after thread termination
m_pThread->ResumeThread(); // keep some life here

}

UINT CComponentInstallationPpg::_InstallThread(LPVOID pParam)
{
// Cast the object and call the method to install a component
CComponentInstallationPpg* pDlg = (CComponentInstallationPpg*) pParam;
if(pDlg)
if(pDlg->IsKindOf(RUNTIME_CLASS(CComponentInstallationPpg)))
{
pDlg->InstallComponent(pDlg->m_iCurrentComponent);
}
return 0;

}