void CStdUtilsTestDlg::OnTestStrings() 
{
	unsigned char iUChar = 1;
	unsigned short iUShort=5;
	int iInt = 10;
	long lLong = 15;
	float fltFloat = (float) 5.3;
	double dblDouble = 7.5;
	bool bBool = true;

try
{
//	LOG_TEMP(StdLogInfo, "Test Val %d, Float: %f", 5403, dblDouble);

	CStdString strVal;

	strVal = (int) iUChar;
	strVal = iUShort;
	strVal = iInt;
	strVal = lLong;
	strVal = fltFloat;
	strVal = dblDouble;

	CStdString strUShort(iUShort), strInt(iInt), strLong(lLong);
	CStdString strFloat(fltFloat), strDouble(dblDouble);
	CStdString strTest1("The Test value is : ");
	CStdString strTest2(" Is the test value.");

	strVal = strTest1 + STR(iInt);
	strVal = strTest1 + STR(lLong);
	strVal = strTest1 + STR(fltFloat);
	strVal = strTest1 + STR(dblDouble);

	strVal = STR(iInt) + strTest2;
	strVal = STR(lLong) + strTest2;
	strVal = STR(fltFloat) + strTest2;
	strVal = STR(dblDouble) + strTest2;

	strVal = "This is a test: " + STR(iInt);
	strVal = "This is a test: " + STR(lLong);
	strVal = "This is a test: " + STR(fltFloat);
	strVal = "This is a test: " + STR(bBool);
	strVal = "This is a test: " + STR("100");

	TRACE_INFO("This is a test. Test Value: " + STR(lLong));
	TRACE_DETAIL("Fitness: " + STR(fltFloat));

	strVal = "This is a test: " + FSTR("%5.2f", fltFloat);

	Test1();
}
catch(CStdErrorInfo oError)
{
	CStdString strError = oError.Log();
	CString strMSError = strError.c_str();
	AfxMessageBox(strMSError);
}
catch(...)
{AfxMessageBox("Unidentified Error");}
}
Example #2
0
ResourceFile::ResourceFile (const char * name)
	: hLib(NULL)
{
// #HK990625 work around WinNT4 LoadProcess bug
char szModuleShort[_MAX_PATH];
string strLong (name);
int cbShortName = GetShortPathName (strLong.c_str(), szModuleShort, _MAX_PATH);
LPCSTR pcModule = NULL;

	if (cbShortName != _MAX_PATH) {
		pcModule = (cbShortName == 0 || cbShortName == ERROR_INVALID_PARAMETER) ? strLong.c_str() : szModuleShort;
		hLib = ::LoadLibrary (pcModule);
	}

	if (LOADLIBRARY_FAILED (hLib)) {
	char buffer[2*_MAX_PATH];

		hLib = NULL;
		wsprintf (buffer, "Application couldn't load resource %.30s", name);
		MessageBox (0, buffer, "TRiASĀ®-Framework", MB_TASKMODAL | MB_ICONHAND | MB_OK);
	} 
}