View Single Post
Old 20-04-2011, 06:09
lebaron lebaron is offline
Junior Member
Join Date: Nov 2007
Posts: 20
Default PHOTOPAINT CorelScript cast error with C#


I want to execute CorelScript function from C#.
but at the debug time this error is returned:
The Exception:
Unable to cast COM object of type 'PHOTOPAINT.CorelScript' to interface type 'PHOTOPAINT.ICorelScript'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{3B5A0001-F896-49B4-B985-37191F200B7A}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

and is my code (tested with X5):
public void MainSub()
if (AppcorelInst == null) { AppcorelInst = new PHOTOPAINT.Application(); }
PHOTOPAINT.CorelScript cs = (PHOTOPAINT.CorelScript)AppcorelInst.CorelScript();


and is the same problem with this code(Tested with X4):

public static void voidtest( PHOTOPAINT.Application app )
PHOTOPAINT.CorelScriptClass cs = new PHOTOPAINT.CorelScriptClass();
string testy= cs.GetDocumentName();
catch (Exception e) { MessageBox.Show(e.Message); }

( all this code use the Framework 3.5 ! )

What is the interface class for CorelScript and CorelScriptTool ?
It is possible to run it from C# !?

best regard
Reply With Quote