本文整理汇总了C++中CTFileName::ReadFromText_t方法的典型用法代码示例。如果您正苦于以下问题:C++ CTFileName::ReadFromText_t方法的具体用法?C++ CTFileName::ReadFromText_t怎么用?C++ CTFileName::ReadFromText_t使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTFileName
的用法示例。
在下文中一共展示了CTFileName::ReadFromText_t方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Read_t
// Read from stream
void CShader::Read_t(CTStream *istrFile)
{
// read the dll filename and class name from the stream
CTFileName fnmDLL;
CTString strShaderFunc;
CTString strShaderInfo;
fnmDLL.ReadFromText_t(*istrFile, "Package: ");
strShaderFunc.ReadFromText_t(*istrFile, "Name: ");
strShaderInfo.ReadFromText_t(*istrFile, "Info: ");
// create name of dll
#ifndef NDEBUG
fnmDLL = _fnmApplicationExe.FileDir()+fnmDLL.FileName()+/*_strModExt+*/"D"+fnmDLL.FileExt();
#else
fnmDLL = _fnmApplicationExe.FileDir()+fnmDLL.FileName()+/*_strModExt+*/fnmDLL.FileExt();
#endif
CTFileName fnmExpanded;
ExpandFilePath(EFP_READ | EFP_NOZIPS,fnmDLL,fnmExpanded);
// set new error mode
UINT iOldErrorMode = SetErrorMode(SEM_NOOPENFILEERRORBOX|SEM_FAILCRITICALERRORS);
// load dll
hLibrary = LoadLibraryA((const char*)fnmExpanded);
// return last error mode
SetErrorMode(iOldErrorMode);
// check if library has loaded
if(hLibrary==NULL)
{
// report error
istrFile->Throw_t("Error loading '%s' library",(const char*)fnmExpanded);
return;
}
// get pointer to shader render function
ShaderFunc = (void(*)(void))GetProcAddress(hLibrary,(const char*)strShaderFunc);
// if error accured
if(ShaderFunc==NULL)
{
// report error
istrFile->Throw_t("GetProcAddress 'ShaderFunc' Error");
}
// get pointer to shader info function
GetShaderDesc = (void(*)(ShaderDesc&))GetProcAddress(hLibrary,(const char*)strShaderInfo);
// if error accured
if(GetShaderDesc==NULL) {
// report error
istrFile->Throw_t("GetProcAddress 'ShaderDesc' Error");
}
}