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. Popup MsgBox without a parent to pass?

Popup MsgBox without a parent to pass?

Scheduled Pinned Locked Moved C / C++ / MFC
c++questionlearning
3 Posts 2 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.
  • D Offline
    D Offline
    dazinith
    wrote on last edited by
    #1

    i have a function which vb is calling from my c++ dll.. the function takes a little while so i wanted to popup a dialog telling them to wait a bit.. im assuming that i cant popup a dialog from a dll as i am crashing when i tell the dialog to go modal:

    INT_PTR CDialog::DoModal()
    {
    // can be constructed with a resource template or InitModalIndirect
    ASSERT(m_lpszTemplateName != NULL || m_hDialogTemplate != NULL ||
    m_lpDialogTemplate != NULL);

    // load resource as necessary
    LPCDLGTEMPLATE lpDialogTemplate = m\_lpDialogTemplate;
    HGLOBAL hDialogTemplate = m\_hDialogTemplate;
    HINSTANCE hInst = AfxGetResourceHandle(); <--- crashing here
    

    is there a built in messagebox that doesnt have an ok or cancel that i can show and hide without needing a resource? i have a progresswnd that i got here from CP, but it crashes because i pass NULL for the parent.. is there a way to tell the parent that is calling the dll's function? or a way to pass a CWND pointer from VB into my function? thanks for ne tips! still a newb.. cut me some slack :P -dz

    D 1 Reply Last reply
    0
    • D dazinith

      i have a function which vb is calling from my c++ dll.. the function takes a little while so i wanted to popup a dialog telling them to wait a bit.. im assuming that i cant popup a dialog from a dll as i am crashing when i tell the dialog to go modal:

      INT_PTR CDialog::DoModal()
      {
      // can be constructed with a resource template or InitModalIndirect
      ASSERT(m_lpszTemplateName != NULL || m_hDialogTemplate != NULL ||
      m_lpDialogTemplate != NULL);

      // load resource as necessary
      LPCDLGTEMPLATE lpDialogTemplate = m\_lpDialogTemplate;
      HGLOBAL hDialogTemplate = m\_hDialogTemplate;
      HINSTANCE hInst = AfxGetResourceHandle(); <--- crashing here
      

      is there a built in messagebox that doesnt have an ok or cancel that i can show and hide without needing a resource? i have a progresswnd that i got here from CP, but it crashes because i pass NULL for the parent.. is there a way to tell the parent that is calling the dll's function? or a way to pass a CWND pointer from VB into my function? thanks for ne tips! still a newb.. cut me some slack :P -dz

      D Offline
      D Offline
      dazinith
      wrote on last edited by
      #2

      woops looks like i was crashin with the progress window because i left out the following in the begining of my dll's function:

      AFX_MANAGE_STATE(AfxGetStaticModuleState());

      woops! but for reference, is there a window built into mfc i can show and hide with no ok or cancel on it? thanks! still a newb.. cut me some slack :P -dz

      A 1 Reply Last reply
      0
      • D dazinith

        woops looks like i was crashin with the progress window because i left out the following in the begining of my dll's function:

        AFX_MANAGE_STATE(AfxGetStaticModuleState());

        woops! but for reference, is there a window built into mfc i can show and hide with no ok or cancel on it? thanks! still a newb.. cut me some slack :P -dz

        A Offline
        A Offline
        Alvaro Mendez
        wrote on last edited by
        #3

        dazinith wrote: is there a window built into mfc i can show and hide with no ok or cancel on it? Nope. That would have made MFC more than just a wrapper class library, and (apparently) the MFC developers didn't want to work too hard. :-) Regards, Alvaro


        Quitters never win. Winners never quit. But those who never win and never quit are idiots. -- despair.com

        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