// This is really the simplest and most understandable CorelDRAW C++ plugin code
#import "VGCoreAuto.tlb" // Import the VGCoreAuto type library: this file can be found in the CorelDRAW software directoryint main() { // Initialize the COM library, using the multi-threaded apartment model HRESULT hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
if (SUCCEEDED(hr)) { // Create a pointer to the CorelDRAW application; tested with CorelDRAW 16, // but the Russian version of CorelDRAW 2020 could not bind properly VGCore::IVGApplicationPtr app(L"CorelDRAW.Application.16");
// Set the application to be visible app->Visible = VARIANT_TRUE; // Get the currently active document; if there isn't one, create a new document auto doc = app->ActiveDocument; if (!doc) doc = app->CreateDocument();
// Clean up the COM library initialization CoUninitialize(); }
return 0;}
Use VSCode to create a cpp file, then compile and run.The result is to open CorelDRAW X6 software and create a new document.
The computer in the printing factory where I work is really too old.