首页上一页 1 下一页尾页 1 条记录 1/1页
VC数据库开发完全手册固定资产设备管理系统
发表在C语言图书答疑
2010-12-04
是否精华
是
否
版块置顶:
是
否
BOOL CEquipmentApp::InitInstance()
{
AfxEnableControlContainer();
// ::CoInitialize(NULL);
AfxOleInit();
datamanage = new CDataManage();
datamanage.ConnectDatabase("Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=EquipmentManage");
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
CEquipmentDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return TRUE;
}
int CEquipmentApp::ExitInstance()
{
// TODO: Add your specialized code here and/or call the base class
// delete datamanage;
return CWinApp::ExitInstance();
}
以上代码 datamanage = new CDataManage(); 为动态内存分配代码,请教一下怎么没有内存释放代码呢
{
AfxEnableControlContainer();
// ::CoInitialize(NULL);
AfxOleInit();
datamanage = new CDataManage();
datamanage.ConnectDatabase("Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=EquipmentManage");
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
CEquipmentDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return TRUE;
}
int CEquipmentApp::ExitInstance()
{
// TODO: Add your specialized code here and/or call the base class
// delete datamanage;
return CWinApp::ExitInstance();
}
以上代码 datamanage = new CDataManage(); 为动态内存分配代码,请教一下怎么没有内存释放代码呢