本文整理汇总了C++中CButeMgr::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ CButeMgr::Init方法的具体用法?C++ CButeMgr::Init怎么用?C++ CButeMgr::Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CButeMgr
的用法示例。
在下文中一共展示了CButeMgr::Init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _tmain
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
if (!TdGuard::Aegis::GetSingleton().Init() ||
!TdGuard::Aegis::GetSingleton().DoWork())
{
return 1;
}
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
printf("Fatal Error: MFC initialization failed\r\n");
return 1;
}
if (argc < 3)
{
printf("Property Help Generator\r\nSyntax: PropHelpGen <object file> <output bute file>\r\n");
return 1;
}
// The class module and bute filename
char *lpszModule=argv[1];
char *lpszButeFilename=argv[2];
// Check to see if the file exists
if (_access(lpszModule, 0) != 0)
{
printf("Error: File %s not found\r\n", lpszModule);
return 1;
}
// Load the object file
HCLASSMODULE hModule;
int nVersion;
int nStatus = cb_LoadModule(lpszModule, NULL, &hModule, &nVersion);
// Handle any errors
switch (nStatus)
{
case CB_NOERROR:
{
break;
}
case CB_CANTFINDMODULE:
{
printf("Error: Cannot load module %s\r\n", lpszModule);
return 1;
}
case CB_NOTCLASSMODULE:
{
printf("Error: Cannot get ObjectDllSetup function\r\n");
return 1;
}
case CB_VERSIONMISMATCH:
{
printf("Error: Server/Object version mismatch\r\n");
return 1;
}
}
// If the file does not exist, then create the file
if (_access(lpszButeFilename, 0) != 0)
{
CFile file;
if (!file.Open(lpszButeFilename, CFile::modeCreate | CFile::modeNoTruncate))
{
printf("Error: Unable to open the file: %s\r\n", lpszButeFilename);
return 1;
}
file.Close();
}
// Initialize ButeMgr
CButeMgr buteMgr;
buteMgr.Init(MessageDisplay);
// Parse the file
if (!buteMgr.Parse(lpszButeFilename))
{
return 1;
}
// Indicate that properties are being added
printf("Adding properties...\r\n");
// Get the classes
int nClasses=cb_GetNumClassDefs(hModule);
ClassDef **pClasses=cb_GetClassDefs(hModule);
// Go through each class
int i;
for (i=0; i < nClasses; i++)
{
// This turns to TRUE once a property for this class has been added
BOOL bClassAdded=FALSE;
//.........这里部分代码省略.........