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 15-04-2020, 18:31
blotfib blotfib is offline
Junior Member
 
Join Date: Jul 2010
Posts: 12
Default update C++ code X5 to CDR 2019

Hi

The new CorelDraw 2019 is completely different from the old X5
where I could write in C++

Any clue how to adapt my old code, which doesn't compile anymore :
Code:
#define CDR_PROGID L"CorelDRAW.Application.15"
	CoInitialize(NULL);
try {
	CorelDRAW::IDrawApplicationPtr pApp(CDR_PROGID);
	CorelDRAW::IDrawDocumentPtr doc = pApp->CreateDocument();
	CorelDRAW::IDrawPagePtr pg;
	CorelDRAW::IDrawCurvePtr crv;
	CorelDRAW::IDrawSubPathPtr spath;
	CorelDRAW::IDrawShapePtr sh;

	doc->Unit=CorelDRAW::cdrMillimeter;
	doc->ActivePage->SetSize( 297, 210);
	doc->ActiveWindow->ActiveView->SetViewPoint(297./2, 210./2, 50);	// Zoom 50%, view centrée
	doc->DrawingOriginX = 0.;
	doc->DrawingOriginY = -210/2.+100/2.;

	doc->ActiveLayer->CreateRectangle(-15, 10, 15, -10, 0, 0, 0, 0);
	// Crée un D !
	crv = doc->CreateCurve();				// Create Curve object
	spath = crv->CreateSubPath(6, 6);
	spath->AppendLineSegment( 6, 3, false);								// Add the short vertical segment
	spath->AppendCurveSegment( 3, 0, 2, 270, 2, 0, false);	// Lower curve
	spath->AppendLineSegment( 0, 0, false);									// Bottom straight edge
	spath->AppendLineSegment( 0, 9, false);								// Left straight edge
	spath->AppendLineSegment(3, 9, false);									// Top straight edge
	spath->AppendCurveSegment(6, 6, 2, 0, 2, 90, false);		// Upper curve
	spath->Closed = true;														// Close the curve
	sh = doc->ActiveLayer->CreateCurve(crv);					// Create curve shape
	} // du try de CorelDraw
  catch(_com_error& e)
  {
    MessageBoxW(NULL, e.ErrorMessage(), L"Error", MB_OK);
  }
	CoUninitialize();
Reply With Quote
  #2  
Old 15-04-2020, 19:16
blotfib blotfib is offline
Junior Member
 
Join Date: Jul 2010
Posts: 12
Default

ok, things have changed
here is how you open it


Code:
	

// pour Corel 2019 !
        #define CDR_PROGID L"CorelDRAW.Application.21"
	VGCore::IVGApplicationPtr app(CDR_PROGID);
	app->Visible = VARIANT_TRUE;
	VGCore::IVGDocumentPtr doc = app->ActiveDocument;
	if (!doc)
		doc = app->CreateDocument();
	VGCore::IVGCurvePtr crv;
	VGCore::IVGSubPathPtr spath;
	VGCore::IVGShapePtr sh;
	doc->Unit = VGCore::cdrCentimeter;	// special Grande fresque

	doc->ActivePage->SetSize( Width, Height);
	doc->ActiveWindow->ActiveView->SetViewPoint(Width/2, Height/2, 50);
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
Convert to 2019 dungbtl CorelDRAW/Corel DESIGNER VBA 4 12-01-2020 03:29
X6/7 update! GordonG Calendar Wizard 1 05-06-2014 00:01
VBE Tools update? gorgo CorelDRAW/Corel DESIGNER VBA 0 15-01-2014 16:42
VBE Tools update? gorgo CorelDRAW/Corel DESIGNER VBA 0 15-01-2014 15:56
Thumbnailer Update ddonnahoe Macros/Add-ons 0 24-02-2005 08:30


All times are GMT -5. The time now is 19:03.


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