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. How to get HWND of VC++ OCX from VB Client

How to get HWND of VC++ OCX from VB Client

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

    Hello, I've an OCX written in MFC, and am trying to use it from a VB Client. To be able to PostMessage() within my control I need the HWND. Any VB client (as per info on the net), does not support HWND for OLE Controls (my OCX is one!). My control's "this" has the "hWnd" as 0x00000000 when I use the OCX from a VB Client! But it properly works from the ActiveX Test Container, or from a VC++ client. Is this correctable, or am I doing anything wrong? Thanks, Rgds, Nirav Doshi

    M 1 Reply Last reply
    0
    • N Nirav Doshi

      Hello, I've an OCX written in MFC, and am trying to use it from a VB Client. To be able to PostMessage() within my control I need the HWND. Any VB client (as per info on the net), does not support HWND for OLE Controls (my OCX is one!). My control's "this" has the "hWnd" as 0x00000000 when I use the OCX from a VB Client! But it properly works from the ActiveX Test Container, or from a VC++ client. Is this correctable, or am I doing anything wrong? Thanks, Rgds, Nirav Doshi

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

      if you want HWND to control then use HWND hWnd = GetSafeHwnd(); if you want handle to container use HWND m_hwndContainer = GetParent()->GetSafeHwnd();

      N 1 Reply Last reply
      0
      • M Member 421025

        if you want HWND to control then use HWND hWnd = GetSafeHwnd(); if you want handle to container use HWND m_hwndContainer = GetParent()->GetSafeHwnd();

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

        Pradeep Maskeri wrote: HWND m_hwndContainer = GetParent()->GetSafeHwnd(); Thanks Pradeep for your reply... But I had already tried this, without help! :((:| * Don't wish it was easier, wish you were better! *

        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