vc6下的代码,vs2008运行在win7下出错[下面的框架可能不正确和/或缺失,没有为 kernel32.dll 加载符号]

csdnhbc20 2016-01-07 11:05:14
我程序里用了cj60lib库
vc6,vs2008在win7下编译都可以通过
但是运行的时候就出错了,说是主线程的调用 m_pMainWnd->ShowWindow(SW_MAXIMIZE);
出错 ,说是m_pMainWnd指针为空。我打了断点,主窗口根本就没有执行创建。
这段代码是以前在xp上用vc6开发的,现在用win7就出错了,不知道怎么回事。
我用vs2008调试了一下,报了个这样的错
............................这里一大段堆栈帧
[下面的框架可能不正确和/或缺失,没有为 kernel32.dll 加载符号]
ntdll.dll!77ba3aab3()
ntdll.dll!77ba3a86()
我在下一页贴出代码
...全文
10602 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
马少华 2017-08-24
  • 打赏
  • 举报
回复
静态库容易出bug,现在的mfc程序的基类有些都跟原来不一样,好多类都加了Ex, 有些还有操作系统版本的问题 类似这样的 #if WIN_VER > 0x0400 条件编译。 如果有源码就重新编辑一下吧。不然就要找厂家。
daxin19910724 2016-04-15
  • 打赏
  • 举报
回复
我遇到这个问题,新建了一个工程,重新跑就好了,具体原因,我也没明白
  • 打赏
  • 举报
回复
你这个简单。新建立一个空的mfc工程。单文档的。看看那个新工程里面的iniinstance里面的函数的m_pMainWnd是怎么出来的。拷贝那个过来。就ok了 该死的验证码。回答一个问题。 常常认错。得打好几次验证码。才能输入进来
Poopaye 2016-01-07
  • 打赏
  • 举报
回复
至少你贴出的代码里没有任何地方为m_pMainWnd赋值
csdnhbc20 2016-01-07
  • 打赏
  • 举报
回复
我看了下代码, class CMainFrame : public CCJFrameWnd { } class AFX_EXT_CLASS CCJFrameWnd : public CFrameWnd { } 不知道是不是继承的原因导致RUNTIME_CLASS(CMainFrame),没有被执行创建
csdnhbc20 2016-01-07
  • 打赏
  • 举报
回复
BOOL CHotelSysApp::InitInstance() { AfxEnableControlContainer(); CString strProcessID = "E70180CE_75C1_2A6A_A753_5A0509F351C9"; HANDLE handle = OpenMutex(MUTEX_ALL_ACCESS | SYNCHRONIZE,false,strProcessID.operator LPCTSTR()); if(!handle) CreateMutex(NULL,true,strProcessID.operator LPCTSTR()); else PostThreadMessage(WM_QUIT,0,0); // 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) if(!ConnectDB()) return FALSE; CDepartmentDlg dpartlg; if(dpartlg.DoModal() == IDCANCEL) return FALSE; m_strDepart = dpartlg.m_strDepart; CLoginDlg dlg(m_strDepart); if(dlg.DoModal() == IDCANCEL) return FALSE; m_user = dlg.m_man; m_or.m_strCode = m_user.m_strUser; m_or.m_strName = m_user.m_strName; CTime dt = CTime::GetCurrentTime(); m_or.m_strDate = dt.Format("%d-%m-%y"); GetBKPath(m_strBKPath); InputToOperatorRecord(); // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views. CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CHotelSysDoc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(CHotelSysView)); AddDocTemplate(pDocTemplate); // 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; InitPersonType(); InitRoomType(); InitOpenRoom(); InitRoom(); InitRoomState(); m_pRoomMapDlg = new CRoomMapDlg; m_pRoomMapDlg->Create(IDD_ROOM_MAP,m_pMainWnd); m_pRoomMapDlg->ShowWindow(m_bShowRoom); //AfxGetMainWnd()->ShowWindow(SW_MAXIMIZE); //AfxGetMainWnd()->UpdateWindow(); m_pMainWnd->ShowWindow(SW_MAXIMIZE); m_pMainWnd->UpdateWindow(); return TRUE; }

7,540

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 VC.NET
社区管理员
  • VC.NET社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧