![]() |
#1
|
|||
|
|||
![]()
Hi,
The following code works fine in X4, but fails in X5. any Idea why it fails? try { VGCore::IVGShapePtr shape; SAFEARRAYBOUND valueBounds; valueBounds.cElements = 1; valueBounds.lLbound = 0; SAFEARRAY* pParameters = SafeArrayCreate( VT_VARIANT, 1, &valueBounds ); SafeArrayLock( pParameters ); VARIANT* valueArray = (VARIANT*) pParameters->pvData; VariantClear( &valueArray[0] ); valueArray[0].vt = VT_ERROR; valueArray[0].scode = DISP_E_PARAMNOTFOUND; shape = OrigSelection->CustomCommand( "Boundary", "CreateBoundary", &pParameters ); shape->GetOutline()->SetProperties( 0.001, 0, 0, 0, 0, VGCore::cdrUndefined, shape->GetOutline()->SetProperties( 0.001, 0, m_Application->CreateFixedColor(VGCore::cdrFOCOLTONE, 72, 100), SafeArrayDestroy( pParameters ); // Delete the duplicate OrigSelection->Delete(); } catch(...) { //... } Thanks for your help Abdo |
#2
|
||||
|
||||
![]()
HI.
What line does it fail on? -John |
#3
|
|||
|
|||
![]()
Hi,
Thanks for your prompt respod. In CS4 it creats the Boundary but not in CS5. Abdo |
#4
|
|||
|
|||
![]()
Sorry for the typo;
I meant X4 and X5. I think the 'CustomCommand' method default parameters might have caused the problem. I am not sure. Thanks Abdo |
#5
|
||||
|
||||
![]()
Hi.
Most likely. I have used createboundary in x5 without params and it works well. -John |
#6
|
|||
|
|||
![]()
I can't figure out how to fix this. Can anybody point me out to a similar discusion group but more in C++
Thanks for your help Abdo |
#7
|
|||
|
|||
![]()
I haven't really figured out the reasons why...but I have found that when doing automation outside of VBA, and in some, but not all circumstances, that I have more consistent results assigning properties individually and progressively when possible after object creation. What works fine in one version doesn't always seem to work in another. Do a VBA counterpart and it works perfectly. In many cases that leaves some of us that lean towards other languages pretty much on our own working through various quirks here and there. When it works in VBA, its kind of hard to call it a bug when things don't work quite right somewhere else. Can't really expect Corel to support all the different approaches either. When VSTA takes hold and VBA goes away, I think you will see much more input on various techniques.
Didn't take a close look at your code, but you do need to be sure and make the proper reference to the X5 tlb. Same GUID, but the version for X5 is currently f.0. Couple of ways to handle the imports, but that's how I do it. |
#8
|
|||
|
|||
![]()
This is how I use to import the lib. Is there a better way??
#ifdef CDR_V14 #import "VGCoreAuto14.tlb" rename("GetCommandLine", "VG_GetCommandLine"), \ rename("CopyFile", "VG_CopyFile"), \ rename("FindWindow", "VG_FindWindow") #endif #ifdef CDR_V15 #import "VGCoreAuto15.tlb" rename("GetCommandLine", "VG_GetCommandLine"), \ rename("CopyFile", "VG_CopyFile"), \ rename("FindWindow", "VG_FindWindow") #endif Abdo |
#9
|
|||
|
|||
![]()
Not sure if it is better, but I use this...
Code:
#import "libid:95E23C91-BC5A-49F3-8CD1-1FC515597048" version("f.0") \ rename("GetCommandLine", "VGGetCommandLine") \ rename("CopyFile", "VGCore") \ rename("FindWindow", "VGFindWindow") |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
C# ApplicationObject.CreateDocument() Fails | sjs | CorelDRAW/Corel DESIGNER VBA | 1 | 31-03-2008 14:08 |
C# and CustomCommand("Boundary", "CreateBoundary") | Sasha | CorelDRAW/Corel DESIGNER VBA | 7 | 15-01-2007 11:32 |
How to use CustomCommand ? | wOxxOm | CorelDRAW/Corel DESIGNER VBA | 2 | 21-07-2006 04:02 |
CreateBoundary in CorelDraw | met | CorelDRAW/Corel DESIGNER VBA | 3 | 29-09-2005 02:30 |
forum fails in sending notification | s_federici | Web site suggestions | 2 | 08-11-2004 03:47 |