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. ATL / WTL / STL
  4. How to use forms / dialog boxes with an ATL Project / BHO?

How to use forms / dialog boxes with an ATL Project / BHO?

Scheduled Pinned Locked Moved ATL / WTL / STL
c++tutorialquestion
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.
  • A Offline
    A Offline
    abetterword
    wrote on last edited by
    #1

    I am a noob just starting out trying to code extensions for IE, and I have an ATL project with a BHO working with very basic functionality right now. I have a button that displays in the IE Menu toolbar, but need to show a form when the user clicks the button and be able to submit and process data. I have been researching this a lot but am at a loss as to what the best approach would be. There seem to be no tutorials online for this. Has anyone done this before?

    M 1 Reply Last reply
    0
    • A abetterword

      I am a noob just starting out trying to code extensions for IE, and I have an ATL project with a BHO working with very basic functionality right now. I have a button that displays in the IE Menu toolbar, but need to show a form when the user clicks the button and be able to submit and process data. I have been researching this a lot but am at a loss as to what the best approach would be. There seem to be no tutorials online for this. Has anyone done this before?

      M Offline
      M Offline
      MicroVirus
      wrote on last edited by
      #2

      I was reading http://msdn.microsoft.com/en-us/library/bb250489.aspx[^] after I saw your post. Scrolling down to around 2/3 of the page under the heading Responding to Events, there is the following:

      From MSDN:

      Finally, add a simple OnDocumentComplete event handler.

      void STDMETHODCALLTYPE CHelloWorldBHO::OnDocumentComplete(IDispatch *pDisp, VARIANT *pvarURL)
      {
      // Retrieve the top-level window from the site.
      HWND hwnd;
      HRESULT hr = m_spWebBrowser->get_HWND((LONG_PTR*)&hwnd);
      if (SUCCEEDED(hr))
      {
      // Output a message box when page is loaded.
      MessageBox(hwnd, L"Hello World!", L"BHO", MB_OK);
      }
      }

      Notice that the message box uses the top-level window of the site as its parent window, rather than simply passing NULL in that parameter. In Internet Explorer 6, a NULL parent window does not block the application, meaning that the user can continue to interact with the browser while the message box is waiting for user input. In some situations, this can cause the browser to hang or crash. In the rare case that a BHO needs to display a UI, it should always ensure that the dialog box is application modal by specifying a handle to the parent window.

      Basically, where the MessageBox is, is *any* dialog box you want or create. The actual creation and display of the dialog inside a BHO is exactly the same as for a normal windows application. Just be sure to set the parent to the browser hWnd, as is suggested by this article. So, to learn how to do this, all you need to do is learn how to display a dialog in a normal 32 bits application. And then hook it up to your BHO and display it at the right time.

      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