智能终端定制开发 ad
MTK/瑞芯微/高通-Android,智能模块/智能终端方案商

深度定制各类智能终端和智能硬件产品,提供硬件选型咨询、参考设计、元器件推荐、驱动开发、行业模块集成、操作系统定制与算法集成等软硬件定制服务。
contact.aspx

Android核心板产品覆盖2G、3G、4G通讯,双核、四核、八核CPU,可选的平台有MTK6580、MTK6737、MTK6750等,Android版本有5.1 6.0 7.0等。
contact.aspx

可广泛应用于低端智能POS、安防监控、车载设备、低端智能机器人、智能家居、智能硬件、工业智能手持设备、低端智能对讲设备、低端警务或执法设备、智能穿戴、贩卖机、物流柜、智能门禁系统等行业和设备。
contact.aspx

可提供以太网转串口透传,WIFI转串口透传,蓝牙转串口透传,CAN总线模拟量控制输出模块等。
contact.aspx

带3G或4G通讯功能,运行android系统,有多个串口,可以外挂各种模块:条码扫描、RFID、指纹识别、身份证识别、磁条卡、ID卡、GPS/北斗模块等。
contact.aspx

具有4G通讯功能,多个RS232或RS485接口,以太网接口,USB接口,CAN接口,多个AD输入。基于Android系统智能平台,方便APP应用开发。器件严格选型,运行稳定,质量可靠。
contact.aspx

mfc 如何去掉那个初始化的子文档?
[VC 编程] 2008-04-07

采用多文档的默认Project,不改动代码,直接编译运行
会带有一个默认的子文档,

如何去掉,仅在“新建”和“打开”菜单后才出现子文档呢?

CxxxMDIApp类的InitInstance()在创建CMainFrame对象后调用CWinApp的ParseCommandLine()方法解析命令行参数,然后用ProcessShellCommand()方法处理命令行。对于空命令行,ParseCommandLine()方法将会生成一个FileNew命令,让ProcessShellCommand()方法调用CxxxMDIDoc的OnNewDocument()方法创建一个空文档。
为了避免创建空文档,一种可行的方法是修改InitInstance()来实现(字体加速的行):
BOOL CxxxMDIApp::InitInstance()
{
...
 if(cmdInfo.m_nShellCommand != CCommandLineInfo::FileNew)
 {

 if (!ProcessShellCommand(cmdInfo))
  return FALSE;
  }
...
}

 

下面是函数,我屏蔽了三句,也实现了没有初始文档

你看看,会不会有什么“后遗症”?

BOOL CExMultiApp::InitInstance()
{
AfxEnableControlContainer();

// 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

// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));

LoadStdProfileSettings(); // Load standard INI file options (including MRU)

// Register the application’s document templates. Document templates
// serve as the connection between documents, frame windows and views.

CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_EXMULTTYPE,
RUNTIME_CLASS(CExMultiDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CExMultiView));
AddDocTemplate(pDocTemplate);

// create main MDI Frame window
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
m_pMainWnd = pMainFrame;

/********************************************************************
Writed by Nicholas.K.J
created: 2006/02/13
created: 13:2:2006 21:36
*********************************************************************/
// // Parse command line for standard shell commands, DDE, file open
// CCommandLineInfo cmdInfo;
// ParseCommandLine(cmdInfo);
//
// // Dispatch commands specified on the command line
// if (!ProcessShellCommand(cmdInfo))
// return FALSE;
//以上是我屏蔽屏蔽的地方,也是没有了初始文档

// The main window has been initialized, so show and update it.
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();

return TRUE;

 

 

 

 

屏蔽是可以的,但此时程序不再处理命令行参数。当希望处理命令行参数的时候就需要自行编写代码处理。
还可以这样修改(加粗的部分):
CCommandLineInfo cmdInfo;
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
ParseCommandLine(cmdInfo);
由于对于空命令行,ParseCommandLine()不会修改cmdInfo,有效地阻止了在启动时新建文档。

当然还可以结合注册表来实现,例如在InitInstance()调用SetRegistryKey(_T("xxx"));之后,通过调用GetProfileInt()来读取注册表中的值(例如一个名为"NewDocOnStart"的DWORD值),如:
SetRegistryKey(_T("CompanyName"));
INT nNewDocOnStart = 0;
nNewDocOnStart = GetProfileInt(_T("ApplicationName"), _T("NewDocOnStart"), nNewDocOnStart);

然后在下面修改:
CCommandLineInfo cmdInfo;
cmdInfo.m_nShellCommand = nNewDocOnStart ?CCommandLineInfo::FileNew : CCommandLineInfo::FileNothing;
ParseCommandLine(cmdInfo);

 

 

[VC 编程添加评论 | 评论/阅读(0/469)
评论
昵称
主页
内容
递交


Copyright @ 我的开发笔记     2008 - 2017         粤ICP备19155526号-1