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. Passing HWND from a MDI app to a activeX control

Passing HWND from a MDI app to a activeX control

Scheduled Pinned Locked Moved COM
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.
  • S Offline
    S Offline
    Sunil1221
    wrote on last edited by
    #1

    Hi, I want to pass a window handle from my MDI application to one of my active X control's function. I tried doing it , but I recieve a error in my mdi application which is as follows. "cannot convert parameter 3 from 'struct HWND__ *' to 'struct _RemotableHandle *'". The idl in the active X control has the following declaration. "[id(1), helpstring("method Init")] HRESULT Init(LPTSTR lpstrCmdLine, int nCmdShow,HWND hwnd);" Upon compiling the idl I get the following warning "warning MIDL2039 : interface does not conform to [oleautomation] attribute : [ Parameter 'hwnd' of Procedure 'Init' ( Interface 'IIWzIDE' ) ]" Please tell me how I can pass the window handle to my active X control. Thanks a ton in advance belankaar

    A 1 Reply Last reply
    0
    • S Sunil1221

      Hi, I want to pass a window handle from my MDI application to one of my active X control's function. I tried doing it , but I recieve a error in my mdi application which is as follows. "cannot convert parameter 3 from 'struct HWND__ *' to 'struct _RemotableHandle *'". The idl in the active X control has the following declaration. "[id(1), helpstring("method Init")] HRESULT Init(LPTSTR lpstrCmdLine, int nCmdShow,HWND hwnd);" Upon compiling the idl I get the following warning "warning MIDL2039 : interface does not conform to [oleautomation] attribute : [ Parameter 'hwnd' of Procedure 'Init' ( Interface 'IIWzIDE' ) ]" Please tell me how I can pass the window handle to my active X control. Thanks a ton in advance belankaar

      A Offline
      A Offline
      Abhishek Srivastava
      wrote on last edited by
      #2

      Hi , Actually HWND data type cannot be used for automation, as it is not supported. so what you can do is simply use long data type, make "HWND hwnd" as "long hwnd" and when u recieve handle in ur activeX object typecast again into HWND Init(LPTSTR lpstrCmdLine, int nCmdShow,long hwnd) { HWND wHandle =(HWND)hwnd; // now you can use this wHandle for your purpose :) ----- ----- } Regards Abhishek Srivastava Software Engg (VC++) India ,Noida Mobile no 9891492921 :)

      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