Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Modeless dialog error

Modeless dialog error

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TEOlivier
    wrote on last edited by
    #1

    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

    D W 2 Replies Last reply
    0
    • T TEOlivier

      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

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • T TEOlivier

        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

        W Offline
        W Offline
        wicked_guy
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups