Article ID: 114014
Article Last Modified on 12/3/2003
// Pass this function a pointer to the object's IOleObject interface,
// the Aspect that has changed size, and the new size of the object.
// returns TRUE if the object had the Recompose on Resize bit set.
BOOL fChkResize(LPOLEOBJECT lpObject, DWASPECT dwAspect, LPSIZEL lpsizel)
{
DWORD dwStatus = 0; // For the status bits
BOOL fShutdown = FALSE; // don't shut the object down
BOOL retval = FALSE;
// Get the status bits.
lpObject->GetMiscStatus(DVASPECT_CONTENT, &dwStatus);
// is recompose on resize set?
if ( dwStatus & OLEMISC_RECOMPOSEONRESIZE )
{
retval = TRUE; // the bit was set
// if the object isn't running, start the object and remember.
if (!OleIsRunning(lpObject)
{
OleRun(lpObject);
fShutdown = TRUE;
}
// set the extent
lpObject->SetExtent(dwAspect, lpsizel);
// update the cache
lpObject->Update();
// go back to the loaded state only if the object was in the
// loaded state upon entry to this function.
if (fShutdown)
lpObject->Close(OLECLOSE_SAVEIFDIRTY);
}
return retval;
}
Additional query words: 2.00 2.01 3.50 4.00
Keywords: kbprogramming KB114014