我在一个VC工程中使用Create()函数创建一个窗体,为什么一到Create()这里程序就会崩溃呢?以下是Create()函数的定义以及调用的语句,各位大侠帮我看看啊,到底是哪里有问题呢,尽量说详细一点哈,我是个菜鸟
定义(不知道为什么有两个?):
  virtual BOOL Create(LPCTSTR lpszClassName,
LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect,
CWnd* pParentWnd, UINT nID,
CCreateContext* pContext = NULL)
{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); }    BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect, CWnd* pParentWnd, UINT nID,
CFile* pPersist = NULL, BOOL bStorage = FALSE,
BSTR bstrLicKey = NULL)
{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
pPersist, bStorage, bstrLicKey); }调用:
  bool CDiCom4K::Init(short ComNo,CString ComSet,CWnd* pParent,int ID)
{   
BSTR bStrLicense = ::SysAllocStringLen(pwchLicenseKey,sizeof(pwchLicenseKey)/sizeof(WCHAR)); 
Create(NULL,0,CRect(0,0,0,0),pParent,ID,NULL,FALSE,bStrLicense);
}

解决方案 »

  1.   

    Create函数不会崩溃的··肯定是你别的地方影响到他了才崩溃的··你跟进去看看啊
      

  2.   

    我是说我的程序崩溃啊...怎么跟?我不明白为啥会用两个create()的定义,到底我用的是哪个呢?还有那些参数到底什么意思?
      

  3.   

    这个是pwchLicenseKey[] 的定义
    WCHAR pwchLicenseKey[] =
    {
     0x0043,     0x006F,     0x0070,     0x0079,     0x0072,     0x0069,     
     0x0067,     0x0068,     0x0074,     0x0020,     0x0028,     0x0063,     
     0x0029,     0x0020,     0x0031,     0x0039,     0x0039,     0x0034,     
     0x0020
    };
      

  4.   

    纠结了一个多星期?那你真杯具了··当时就应该果断来CSDN的
      

  5.   

    问题交代的不清楚。也不知道你这Create是干啥的,谁知道应该传递哪样的参数才是正确的啊。
      

  6.   

    ··Create··晕··那么多的Create函数··问题说明白点吧··