代码如下:
BOOL CVSOConnectorApp::InitInstance()
{
//m_pMainWnd = (CWnd*)malloc(sizeof(m_pMainWnd));
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
char buf[MAXBUFSIZE + 1];
char value[MAXPARAMETERLEN + 1];
CVSOConnectorDlg dlg;//报错地方,debug模式下只要执行到这就会报错,release下是ok的
m_pMainWnd = &dlg;
错误信息如图
你创建变量还要DoModal才会真正生成对话框
CVSOConnectorDlgdlg;dlg.DoModal()
CVSOConnectorDlgdlg;
dlg.Create(对话框资源id);
有的,
CVSOConnectorDlg*dlg=newCVSOConnectorDlg;
m_pMainWnd=dlg;
dlg->serverdetails.setServer(sd.getServer());dlg->serverdetails.setPort(sd.getPort());dlg->serverdetails.setUsername(sd.getUsername());dlg->serverdetails.setPassword(sd.getPassword());dlg->serverdetails.setDomain(sd.getDomain());dlg->serverdetails.setGatewayHostname(sd.getGatewayHostname());dlg->serverdetails.setFullScreen(true);if(pShellManager!=NULL){deletepShellManager;}returndlg->Create(IDD_VSOCONNECTOR_DIALOG);
m_hWnd还是m_pMainWnd为空?
m_pMainWnd是什么类型
要看一下CVSOConnectorDlg类的构造函数中写了什么
将dlg换成CVSOConnectorDlg*,或者全局变量。
编译器bug!!!
classCVSOConnectorDlg:publicCDialogEx
{
//Construction
public:
CVSOConnectorDlg(CWnd*pParent=NULL);//standardconstructor
~CVSOConnectorDlg();
//DialogData
enum{IDD=IDD_VSOCONNECTOR_DIALOG};
protected:virtualvoidDoDataExchange(CDataExchange*pDX);//DDX/DDVsupport
//Implementation
protected:
HICONm_hIcon;
//GeneratedmessagemapfunctionsvirtualBOOLOnInitDialog();afx_msgvoidOnPaint();afx_msgHCURSOROnQueryDragIcon();DECLARE_MESSAGE_MAP()
public:
CMstscax1m_VSOConnector;
ServerDetailsserverdetails;
afx_msgvoidOnBnClickedButton1();
INT_PTRDoModal();
DECLARE_EVENTSINK_MAP()
voidOnDisconnectedMstscax1(longdiscReason);
voidOnConnectedMstscax1();
//afx_msgvoidOnSize(UINTnType,intcx,intcy);
public:
CProgressBarpb;
voidOnConnectingMstscax1();
voidOnLogonErrorMstscax1(longlError);
afx_msgvoidOnSize(UINTnType,intcx,intcy);
CRectm_rect;
//afx_msgvoidOnNcPaint();
afx_msgvoidOnKillFocus(CWndpNewWnd);
afx_msgintOnMouseActivate(CWnd*pDesktopWnd,UINTnHitTest,UINTmessage);
voidOnRemoteProgramResultMstscax1(LPCTSTRbstrRemoteProgram,longlError,BOOLvbIsExecutable);
voidOnRemoteProgramDisplayedMstscax1(BOOLvbDisplayed,unsignedlonguDisplayInformation);
voidOnIdleTimeoutNotificationMstscax1();
voidOnConfirmCloseMstscax1(BOOL*pfAllowClose);
voidOnWarningMstscax1(longwarningCode);
voidOnRequestContainerMinimizeMstscax1();
afx_msgvoidOnClose();
voidOnEnterFullScreenModeMstscax1();
voidOnLeaveFullScreenModeMstscax1();
voidOnRequestGoFullScreenMstscax1();
voidOnRequestLeaveFullScreenMstscax1();
voidOnRemoteDesktopSizeChangeMstscax1(longwidth,longheight);
};
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。