Power++
Tips

Here tips from André Schild on creating COM servers with Power++

Special infos about parameters.

You can pass COM servers as parameters to other com objects. To allow this, the called method must have a parameter of type WPIUnknown.

In P++ you can invoke such a method with the following sequence:

WOleProgrammableObject *_myServer;
WOleProgrammableObject *_myObject;
_myServer= new COMServer;
_myServer->Create(); // This is important, otherwise all methode calls will fail for no aparent reason.
_myObject= new COMParameter;
_myObject->Create(); // This is important, otherwise all methode calls will fail for no aparent reason.

WPIDispatch wpiParam= (WPIDispatch )*_myObject;
WVariant wvParam(wpiParam);
retVal= _myServer->CallMethod(&wvParam);
errorInfo = _myServer->GetErrorInfo();
if (errorInfo.error != WInvokeError_None)
{
// Handle errorcondition
}


Remember, this web site is here for you and people like you. So if you have anything that others might find useful, let me know, and I'll post it here. E-mail me, André Schild at a.schild(at)aarboard.ch, or fill out the form at the bottom of the main page.
Hope to hear from you soon!


Back to Absolute Power++.