Retrieve Size of ActiveX

So I am creating an ActiveX which basically creates a CListCtrl inside of it.  So when the person selects my ActiveX and draw's the 'square' that places the activeX into it, I am interested in knowing those dimensions so I can find size my CListCtrl appropriately inside of this.

Thanks,
cophiAsked:
Who is Participating?
 
AndyAinscowFreelance programmer / ConsultantCommented:
CRect rc;
GetWindowRect(&rc);

rc.Width() - width
rc.Height() - height

and rc.left, rc.top give the co-ordinates in SCREEN co-ordinates
0
 
mahesh1402Commented:
WINDOWPLACEMENT wndPlacement;

// Get the current position
m_ActiveXControl.GetWindowPlacement(&wndPlacement);

now you may use like wndPlacement.ptMinPosition.x, wndPlacement.ptMinPosition.y,wndPlacement.ptMaxPosition.x, wndPlacement.ptMaxPosition.y to get dimensions.


MAHESH



0
 
AndyAinscowFreelance programmer / ConsultantCommented:
m_lstCtrl.SetWindowPos(NULL, 0, 0, width, height, SWP_NOZORDER);
That should position the list control at 0, 0 in the parent and with the width and height you specify.
0
 
mahesh1402Commented:
WINDOWPLACEMENT wndPlacement;

// Get the current position
m_ActiveXControl.GetWindowPlacement(&wndPlacement);


 int nWidth = 400;    // substitute your new width
 int nHeigth = 200;    // substitute your new height


 m_ActiveXControl.MoveWindow ( wndPlacement.ptMinPosition.x, wndPlacement.ptMinPosition.y,
      nWidth,  nHeigth);


MAHESH
0
 
mahesh1402Commented:

WINDOWPLACEMENT wndPlacement;


// Get the current position
m_ActiveXControl.GetWindowPlacement(&wndPlacement);


 int nWidth = 400;    // substitute your new width
 int nHeigth = 200;    // substitute your new height


 m_ActiveXControl.MoveWindow (
      wndPlacement.rcNormalPosition.left,
      wndPlacement.rcNormalPosition.top,
      nWidth,
      nHeigth);


0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.