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. Activex Messages don´t work at runtime

Activex Messages don´t work at runtime

Scheduled Pinned Locked Moved COM
c++questioncomhelplearning
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.
  • F Offline
    F Offline
    fpmatta77
    wrote on last edited by
    #1

    Hello I´m new in developes Controls with VC++ (VS2005) When I use a activex, creating in desinger mode, the message OnLButtonUp (WM_LBUTTONUP) define in Warpper class return very well, but when I Create the activex in runtime mode, it don´t work. What is my error ? I mistake some code ? Parts of my code to better explain ..

    // Test2001Dlg.h : header file
    //
    class CTest2001Dlg : public CDialog
    {
    //.....

    public:

    CListView2 LV1;   // static designer mode
    CListView2 \*pLV3; // Pointer to run time creation.
    
    
    afx\_msg void OnBnClickedButton1();
    

    };

    // Test2001Dlg.cpp
    //

    void CTest2001Dlg::DoDataExchange(CDataExchange* pDX)
    {
    CDialog::DoDataExchange(pDX);
    DDX_Control(pDX, IDC_LISTVIEWCTRL1, LV1);

    }

    void CTest2001Dlg::OnBnClickedButton1()
    {
    CRect cPosition(300, 100, 400, 200);
    pLV3 = new CListView2();
    pLV3->Create(_T("{BDD1F04B-858B-11D1-B16A-00C0F0283628}"),NULL, WS_TABSTOP | WS_VISIBLE,cPosition,this,IDC_LISTVIEWCTRL_3,NULL);

    /// I Need to do something else here ???
    // IDC_LISTVIEWCTRL_3 is define in resource.h
    // {BDD1F04B-858B-11D1-B16A-00C0F0283628} I Take in Test2001.rc from the IDC_LISTVIEWCTRL1

    }

    // CListView2.h : Declaration of ActiveX Control wrapper class(es) created by Microsoft Visual C++

    #pragma once

    /////////////////////////////////////////////////////////////////////////////
    // CListView2

    class CListView2 : public CWnd
    {

    //...

    DECLARE\_MESSAGE\_MAP()
    afx\_msg void OnLButtonUp(UINT nFlags, CPoint point);
    

    };

    // CListView2.cpp : Definition of ActiveX Control wrapper class(es) created by Microsoft Visual C++

    #include "stdafx.h"
    #include "CListView2.h"

    /////////////////////////////////////////////////////////////////////////////
    // CListView2

    IMPLEMENT_DYNCREATE(CListView2, CWnd)

    // CListView2 properties

    // CListView2 operations
    BEGIN_MESSAGE_MAP(CListView2, CWnd)
    ON_WM_LBUTTONUP()
    END_MESSAGE_MAP()

    void CListView2::OnLButtonUp(UINT nFlags, CPoint point)
    {

    AfxMessageBox (\_T("Clicked in CListView2::OnLButtonUp " ) , MB\_OK|MB\_ICONSTOP);
    
    CWnd::OnLButtonUp(nFlags, point);
    

    }

    thank´s

    G 1 Reply Last reply
    0
    • F fpmatta77

      Hello I´m new in developes Controls with VC++ (VS2005) When I use a activex, creating in desinger mode, the message OnLButtonUp (WM_LBUTTONUP) define in Warpper class return very well, but when I Create the activex in runtime mode, it don´t work. What is my error ? I mistake some code ? Parts of my code to better explain ..

      // Test2001Dlg.h : header file
      //
      class CTest2001Dlg : public CDialog
      {
      //.....

      public:

      CListView2 LV1;   // static designer mode
      CListView2 \*pLV3; // Pointer to run time creation.
      
      
      afx\_msg void OnBnClickedButton1();
      

      };

      // Test2001Dlg.cpp
      //

      void CTest2001Dlg::DoDataExchange(CDataExchange* pDX)
      {
      CDialog::DoDataExchange(pDX);
      DDX_Control(pDX, IDC_LISTVIEWCTRL1, LV1);

      }

      void CTest2001Dlg::OnBnClickedButton1()
      {
      CRect cPosition(300, 100, 400, 200);
      pLV3 = new CListView2();
      pLV3->Create(_T("{BDD1F04B-858B-11D1-B16A-00C0F0283628}"),NULL, WS_TABSTOP | WS_VISIBLE,cPosition,this,IDC_LISTVIEWCTRL_3,NULL);

      /// I Need to do something else here ???
      // IDC_LISTVIEWCTRL_3 is define in resource.h
      // {BDD1F04B-858B-11D1-B16A-00C0F0283628} I Take in Test2001.rc from the IDC_LISTVIEWCTRL1

      }

      // CListView2.h : Declaration of ActiveX Control wrapper class(es) created by Microsoft Visual C++

      #pragma once

      /////////////////////////////////////////////////////////////////////////////
      // CListView2

      class CListView2 : public CWnd
      {

      //...

      DECLARE\_MESSAGE\_MAP()
      afx\_msg void OnLButtonUp(UINT nFlags, CPoint point);
      

      };

      // CListView2.cpp : Definition of ActiveX Control wrapper class(es) created by Microsoft Visual C++

      #include "stdafx.h"
      #include "CListView2.h"

      /////////////////////////////////////////////////////////////////////////////
      // CListView2

      IMPLEMENT_DYNCREATE(CListView2, CWnd)

      // CListView2 properties

      // CListView2 operations
      BEGIN_MESSAGE_MAP(CListView2, CWnd)
      ON_WM_LBUTTONUP()
      END_MESSAGE_MAP()

      void CListView2::OnLButtonUp(UINT nFlags, CPoint point)
      {

      AfxMessageBox (\_T("Clicked in CListView2::OnLButtonUp " ) , MB\_OK|MB\_ICONSTOP);
      
      CWnd::OnLButtonUp(nFlags, point);
      

      }

      thank´s

      G Offline
      G Offline
      guestcat
      wrote on last edited by
      #2

      hi, if you are trying to create an ActiveX control at runtime , be sure that you are calling the AfxEnableControlContainer() of method. and CoInitialize() also. call these functions in OnInitIntstance()/CWinApp hope this works!

      ^-^ @|@ - redCat

      F 1 Reply Last reply
      0
      • G guestcat

        hi, if you are trying to create an ActiveX control at runtime , be sure that you are calling the AfxEnableControlContainer() of method. and CoInitialize() also. call these functions in OnInitIntstance()/CWinApp hope this works!

        ^-^ @|@ - redCat

        F Offline
        F Offline
        fpmatta77
        wrote on last edited by
        #3

        Hi, thank's so much, but i'm using : InitCommonControls(); AfxEnableControlContainer(); CoInitialize(NULL); on MyApp.InitInstance(); A think my problem is beacause a Runtime Acitivex don´t have a : DDX_Control(pDX, IDC_LISTVIEWCTRL1, LV1); On :DoDataExchange(CDataExchange* pDX); Somebody have anything idea ? One more Thank You.

        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