views:

301

answers:

1

Hi there,

I'm adding an OCX to a resource dialog that I've created in my C++ project.

The ocx adds properly; but my question is how do I access the ocx programatically?
I don't see a member variable (or even a class) attached to it.

This is my .rc contents

///////////////////////////////////////////////////////////////////////////// // // Dialog Info //

IDD_LENELDECODER DLGINIT BEGIN IDC_MATRIXCONTROL1, 0x376, 26, 0 0x0000, 0x0000, 0x0900, 0x0000, 0x4c7b, 0x0000, 0x3643, 0x0000, 0x0013, 0x0065, 0x0000, 0x000b, 0xffff, 0 END

Where IDC_MATRIXCONTROL1 is the ID associated with the ocx. My question is, how do I access this ocx's member variables from a class; and how do I make it resize when the dialog resizes?

I've tried both MFC ActiveX and ATL Project -> ATL Control (composite). I though that since the ATL composite control has a Go To Dialog attached to it that I would be able to access it, but I don't know how to do it.

Any help is greatly appreciated! Thank you,

Joey

+1  A: 

When using MFC:

  1. In resource editor Right click in the OCX control,
  2. Select "Add Variable...",
  3. Put a name like m_object, then press finish to terminate.

Now you can access your OCX control with m_object.

If you want to resize your object you have to trap WM_WINDOWSPOSCHANGING message.

Ismael