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. COM
  4. COM and ATL Dialogs

COM and ATL Dialogs

Scheduled Pinned Locked Moved COM
c++comhelp
2 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.
  • M Offline
    M Offline
    Mark Lenz
    wrote on last edited by
    #1

    I have created an ATL project, inserted a Simple Object and an ATL Dialog via the ATL Object Wizard. Everything works great except for one thing. I don't have an interface to the Dialog. So, my client app can't interface with my dialog. The only thing I can do is get the interface, run the function ShowWindow() which displays my dialog as a modal dialog. I wanted my dialog to invoke a function in the client app when the user clicked a button, but since I don't have an interface or any COM object whatsoever for my dialog I can't. I tried to do it by creating an interface to my Simple Object in my code for clicking the button on the dialog. But, that doesn't work because I don't have the same interface that the client Advise()d. So, the event never gets to the client. I'm trying desperatly to find a way to be able to interface with my ATL dialog using COM. Any help would be greatly appreciated.

    A 1 Reply Last reply
    0
    • M Mark Lenz

      I have created an ATL project, inserted a Simple Object and an ATL Dialog via the ATL Object Wizard. Everything works great except for one thing. I don't have an interface to the Dialog. So, my client app can't interface with my dialog. The only thing I can do is get the interface, run the function ShowWindow() which displays my dialog as a modal dialog. I wanted my dialog to invoke a function in the client app when the user clicked a button, but since I don't have an interface or any COM object whatsoever for my dialog I can't. I tried to do it by creating an interface to my Simple Object in my code for clicking the button on the dialog. But, that doesn't work because I don't have the same interface that the client Advise()d. So, the event never gets to the client. I'm trying desperatly to find a way to be able to interface with my ATL dialog using COM. Any help would be greatly appreciated.

      A Offline
      A Offline
      Aaron Schaefer
      wrote on last edited by
      #2

      Yes, this can be done. The dialogs you get from the ATL Wizard are just normal dialogs, but are not COM objects. Create a simple object called CMyDialogObject or whatever. Create the dialog, called CMyDialog. Embed an instance of the dialog into the simple object as a member variable, and create wrapper functions on the simple object's interface to expose whichever CDialogImpl methods you need, maybe just a DoModal for a modal dialog, or Create and Destroy for a modeless dialog. In the body of the wrapper methods, just delegate to the contained dialog instance. You will need to use the BEGIN_MSG_MAP macro to handle windows messages, commands, etc. in your dialog class. If your dialog class contained a pointer to your simple object, it could delegate to the Fire_XXX method in the message handlers, which would cause the ATL event to fire. Hope that helps

      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