每道理啊,完全一样的代码(用Windiff比较过的)怎么编译后就不一样了,真是奇怪

Jans 2001-05-07 07:03:00
这是那个App的InitInstance()函数
这两段代码很短的看上去完全一样,为什么编译后不一样(多次测试发现),差别就在双击打开文件时,一个能打开,一个则出错,难道是VC编译器自己的问题?浪费了我很多时间高手请看看:
正确的代码:

#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("Noise Demo Platform"));

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

{
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);

if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated)
{
return TRUE;
}


CSplashWnd::EnableSplashScreen(cmdInfo.m_bShowSplash);
}


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

CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_NOISEDTYPE,
RUNTIME_CLASS(CNoiseDemoPlatformDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CNoiseDemoPlatformView));
AddDocTemplate(pDocTemplate);

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

// pMainFrame->InitializeMenu(pDocTemplate,
// IDR_NOISEDTYPE, IDR_MAINFRAME, IDR_MAINFRAME);

// Enable drag/drop open
m_pMainWnd->DragAcceptFiles();

// Enable DDE Execute open
EnableShellOpen();
RegisterShellFileTypes(TRUE);

// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
cmdInfo.m_nShellCommand=CCommandLineInfo::FileNothing;
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.
m_nCmdShow|=SW_SHOWMAXIMIZED;
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
ShowTipAtStartup();
return TRUE;
有问题的:
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
SetRegistryKey(_T("Noise Demo Platform"));
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
{
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated)
{
return TRUE;
}

CSplashWnd::EnableSplashScreen(cmdInfo.m_bShowSplash);
}

// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_NOISEDTYPE,
RUNTIME_CLASS(CNoiseDemoPlatformDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CNoiseDemoPlatformView));
AddDocTemplate(pDocTemplate);

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

// pMainFrame->InitializeMenu(pDocTemplate,
// IDR_NOISEDTYPE, IDR_MAINFRAME, IDR_MAINFRAME);

// Enable drag/drop open
m_pMainWnd->DragAcceptFiles();

// Enable DDE Execute open
EnableShellOpen();
RegisterShellFileTypes(TRUE);

// Parse command line for standard shell commands, DDE, file open

CCommandLineInfo cmdInfo;
cmdInfo.m_nShellCommand=CCommandLineInfo::FileNothing;
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.
m_nCmdShow|=SW_SHOWMAXIMIZED;
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
ShowTipAtStartup();
return TRUE;
...全文
33 点赞 收藏 3
写回复
3 条回复
Jans 2001年05月07日
众位大哥不要笑话
我确实对此问题不太清楚原因
我还是耐着性子找到了
不过还是很迷惑,我想这也许是VC的Bug吧这么倒霉让我遇上了
这一句有问题(原文Copy):
EnableShellOpen();
改正后:
EnableShellOpen();
好像就是把几个空格改成Tab,就莫名其妙的好了
他妈的 VC
回复 点赞
fulaoxiao 2001年05月07日
绝对同意smint(smint) 
回复 点赞
smint 2001年05月07日
把不同的地方注出来阿.还要人家自己找阿?累
回复 点赞
发动态
发帖子
VC/MFC
创建于2007-09-28

7898

社区成员

42.1w+

社区内容

VC/MFC相关问题讨论
社区公告
暂无公告