Link to home
Start Free TrialLog in
Avatar of cophi
cophi

asked on

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,
ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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



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.
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

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);