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. VB doesn't provide an HWND to OLE Controls? How to get it for an MFC OCX?

VB doesn't provide an HWND to OLE Controls? How to get it for an MFC OCX?

Scheduled Pinned Locked Moved C / C++ / MFC
c++comhelptutorialquestion
4 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.
  • N Offline
    N Offline
    Nirav Doshi
    wrote on last edited by
    #1

    The hWnd of the instance of my OCX Control is always 0x00000000! So I am unable to PostMessage() withing my control. Nothing works... Even GetActualParent() as posted in the MSDN... If anyone has encountered anything similar, or have an idea to get around this, please reply back as I'm stuck over this for more than 24 hours now! :(:confused: Thanks, Nirav Doshi

    M 1 Reply Last reply
    0
    • N Nirav Doshi

      The hWnd of the instance of my OCX Control is always 0x00000000! So I am unable to PostMessage() withing my control. Nothing works... Even GetActualParent() as posted in the MSDN... If anyone has encountered anything similar, or have an idea to get around this, please reply back as I'm stuck over this for more than 24 hours now! :(:confused: Thanks, Nirav Doshi

      M Offline
      M Offline
      Member 421025
      wrote on last edited by
      #2

      I assume that you call GetsafeHWnd()in OnCreate(LPCREATESTRUCT lpCreateStruct) function or after it is called and not in Constructor as many times I do :-(

      N 1 Reply Last reply
      0
      • M Member 421025

        I assume that you call GetsafeHWnd()in OnCreate(LPCREATESTRUCT lpCreateStruct) function or after it is called and not in Constructor as many times I do :-(

        N Offline
        N Offline
        Nirav Doshi
        wrote on last edited by
        #3

        Hi Pradeep, Pradeep Maskeri wrote: I assume that you call GetsafeHWnd()in OnCreate(LPCREATESTRUCT lpCreateStruct) function or after it is called and not in Constructor Thanks for your reply! My OCX is a wrapper for a hardware device - And doesn't need to create any window. So, I'm not handling WM_CREATE! Now, if you make a similar OCX using MFC, and put it in a VB Form... Then try to debug the OCX code by making the VBClient.EXE with your OCX embedded in the VB Form, you can see that the OCX control's HWND is ALWAYS 0x00000000! But if you insert the control in the ActiveX Test Container or another VC++ (MFC) client app, and then you debug your OCX code, you will see the OCX control's HWND has a legitimate value. This is the problem, I have! :-(( - Nirav

        M 1 Reply Last reply
        0
        • N Nirav Doshi

          Hi Pradeep, Pradeep Maskeri wrote: I assume that you call GetsafeHWnd()in OnCreate(LPCREATESTRUCT lpCreateStruct) function or after it is called and not in Constructor Thanks for your reply! My OCX is a wrapper for a hardware device - And doesn't need to create any window. So, I'm not handling WM_CREATE! Now, if you make a similar OCX using MFC, and put it in a VB Form... Then try to debug the OCX code by making the VBClient.EXE with your OCX embedded in the VB Form, you can see that the OCX control's HWND is ALWAYS 0x00000000! But if you insert the control in the ActiveX Test Container or another VC++ (MFC) client app, and then you debug your OCX code, you will see the OCX control's HWND has a legitimate value. This is the problem, I have! :-(( - Nirav

          M Offline
          M Offline
          Member 421025
          wrote on last edited by
          #4

          Oh! It is windowless. So this may help http://www.kbalertz.com/Feedback\_153582.aspx I hope sincerely

          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