Qt-interest Archive, April 2007
Why Qt4.3.0beta fails to manipulate embedded OLE objects in general containers?
Message 1 in thread
Hi,
Does anyone know why Qt fails to manipulate embedded OLE objects in
general containers?
1) I use Qt4.3.0beta, and I like the new features.
2) “embedded OLE objects”, here, means a simple ActiveX control created
by inheriting QAxBindable (desktop)
class SimpleAx: public QMainWindow, public QAxBindable
{
Q_OBJECT
Q_PROPERTY( int myInt READ myInt WRITE setMyInt )
public:
QwtSimplePlotAx(QWidget *parent = 0);
int myInt()const;
void setMyInt(int i);
private:
int m_myInt;
};
3) “general containers” means Microsoft Word, PowerPoint, EXCEL, ACESS …
(Windows platform).
I choose PowerPoint (ppt).
4) “manipulate” means after adding the OLE object to the container how
to access to the object so that you can change it properties
(initialization).
className = "wrapperax.SimpleAx";
shape = shapes->AddOLEObject(100, 100, 512, 320, className, false);
if(shape)
{
PowerPoint::OLEFormat* fmt = shape->OLEFormat();
QString ProgID = fmt->ProgID(); // a numbered className "~.~.1"
IDispatch *idispatch = fmt->Object(); // IDispatch interface
if(idispatch)
{
wrapperaxLib::ISimpleAx iObject(idispatch);
int defaultValue = iObject.myInt();
// Problem 1: does not return the default value in the constructor ???
iObject.setMyInt(678);
// Problem 2: does not invoke SimpleAx::setMyInt() ???
int newValue = iObject.myInt(); // = 678
// Problem 3: Even though SimpleAx::setMyInt() does not be invoked,
// it does return the value, and SimpleAx::myInt() does NOT invoked
neither. ???
}
}
Problem 4: The newValue does not go with the control in ppt . ???
Thanks,
Lingfa
--
[ signature omitted ]