OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 21-06-2010, 13:57
abdoj
Guest
 
Posts: n/a
Default CustomCommand CreateBoundary call fails

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
Reply With Quote
  #2  
Old 21-06-2010, 15:52
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

HI.
What line does it fail on?

-John
Reply With Quote
  #3  
Old 21-06-2010, 16:32
abdoj
Guest
 
Posts: n/a
Default CustomCommand CreateBoundary call fails

Hi,

Thanks for your prompt respod.

In CS4 it creats the Boundary but not in CS5.

Abdo
Reply With Quote
  #4  
Old 21-06-2010, 16:39
abdoj
Guest
 
Posts: n/a
Default CustomCommand CreateBoundary call fails

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
Reply With Quote
  #5  
Old 21-06-2010, 18:05
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
Most likely.
I have used createboundary in x5 without params and it works well.
-John
Reply With Quote
  #6  
Old 23-06-2010, 12:30
abdoj
Guest
 
Posts: n/a
Default

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
Reply With Quote
  #7  
Old 25-06-2010, 04:37
SteveDude SteveDude is offline
Senior Member
 
Join Date: Dec 2005
Location: Salina, Kansas USA
Posts: 149
Default ...

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.
Reply With Quote
  #8  
Old 05-07-2010, 09:54
abdoj
Guest
 
Posts: n/a
Default

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
Reply With Quote
  #9  
Old 17-07-2010, 01:20
SteveDude SteveDude is offline
Senior Member
 
Join Date: Dec 2005
Location: Salina, Kansas USA
Posts: 149
Default ...

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")
...only have to change the f to an e to use it for X4.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
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


All times are GMT -5. The time now is 00:12.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com