Modeless dialog error
-
When I try to create a modeless dialog (according to the example given by Dr. GUI on MSDN) with the CDialog::Create() function it gives a casting error message when I use the following where 'CParams' is a dialog's class: CParams *m_pParams; m_pParams = new CParams; ---> m_pParams->Create(IDD_DIALOG1, this); m_pParams->ShowWindow(SW_SHOW); This is the error in visual c++ 6: error C2664: 'int __thiscall CDialog::Create(const char *,class CWnd *)' : cannot convert parameter 1 from 'const int' to 'const char *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast Please help. I'm trying to create a modeless dialog here. Thanx
-
When I try to create a modeless dialog (according to the example given by Dr. GUI on MSDN) with the CDialog::Create() function it gives a casting error message when I use the following where 'CParams' is a dialog's class: CParams *m_pParams; m_pParams = new CParams; ---> m_pParams->Create(IDD_DIALOG1, this); m_pParams->ShowWindow(SW_SHOW); This is the error in visual c++ 6: error C2664: 'int __thiscall CDialog::Create(const char *,class CWnd *)' : cannot convert parameter 1 from 'const int' to 'const char *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast Please help. I'm trying to create a modeless dialog here. Thanx
Put the call to
Create()
in the dialog's constructor like:CParams::CParams()
{
Create(IDD);
}
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
-
When I try to create a modeless dialog (according to the example given by Dr. GUI on MSDN) with the CDialog::Create() function it gives a casting error message when I use the following where 'CParams' is a dialog's class: CParams *m_pParams; m_pParams = new CParams; ---> m_pParams->Create(IDD_DIALOG1, this); m_pParams->ShowWindow(SW_SHOW); This is the error in visual c++ 6: error C2664: 'int __thiscall CDialog::Create(const char *,class CWnd *)' : cannot convert parameter 1 from 'const int' to 'const char *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast Please help. I'm trying to create a modeless dialog here. Thanx
Hello TEOlivier, Try this code, CParams *m_pParams; m_pParams = new CParams(this); m_pParams->Create(CParams::IDD); m_pParams->ShowWindow(SW_SHOW); I assumed that CParams is the name of your dialog's class. Regards