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 23-01-2008, 10:23
jemmyell jemmyell is offline
Senior Member
 
Join Date: Jan 2005
Location: Orange County, California, USA, Earth, Solar System, Milky Way Galaxy
Posts: 157
Default Bad Typelib in new X4 trial download

Hi Alex,

I downloaded the X4 trial to see if my C++ projects would compile and run correctly. The typelib "CorelDRAW.tlb" will NOT #import and OleView 2.0 cannot open the typelib. The error is:

Could not decompile selected item
Element not found
TYPE_E_ELEMENTNOTFOUND ($800280B)

Will it be possible to get a replacement without waiting for SP1?

-James
__________________
-James Leonard
CNC Inlay Guy - www.CorelDRAWCadCam.com
Reply With Quote
  #2  
Old 24-01-2008, 20:00
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

What syntax do you use in your C++ program? Do you import just CorelDRAW.tlb or VGCoreAuto.tlb as well?
Reply With Quote
  #3  
Old 25-01-2008, 00:30
jemmyell jemmyell is offline
Senior Member
 
Join Date: Jan 2005
Location: Orange County, California, USA, Earth, Solar System, Milky Way Galaxy
Posts: 157
Default my #import for VC++ 6

Hi Alex,

This has been working well for both V12 and X3

// These #import statements must be repeated in every .CPP module

#import "VGCoreAuto.tlb" rename("GetCommandLine", "VG_GetCommandLine"), \
rename("CopyFile", "VG_CopyFile"), \
rename("FindWindow", "VG_FindWindow") \
no_namespace

#import "CorelDraw.tlb"

using namespace CorelDRAW;

I am using Visual C++ 6. As I mentioned before, a typelib viewer (OLEView from the VC++ 6 tools) also cannot open this typelib, giving the error that I noted.

-James
__________________
-James Leonard
CNC Inlay Guy - www.CorelDRAWCadCam.com
Reply With Quote
  #4  
Old 27-01-2008, 13:40
jemmyell jemmyell is offline
Senior Member
 
Join Date: Jan 2005
Location: Orange County, California, USA, Earth, Solar System, Milky Way Galaxy
Posts: 157
Default Any news on this?

Alex,

I have my CorelDRAW hosted CAD / CAM application in beta currently. I would like to know if I can run on X4 with the same code base like I can on V12 and X3. Since I am developing on V12 and testing on X3 so far I have been 100% compatible, but with this issue with this typelib I cannot even start testing on X4.

-James
__________________
-James Leonard
CNC Inlay Guy - www.CorelDRAWCadCam.com
Reply With Quote
  #5  
Old 29-01-2008, 16:01
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

James,

I haven't tried this on a trial version of X4 but I did the following:

1. Got a clean Win XP SP2 machine
2. Installed the full version of CorelDRAW X4
3. Installed Visual Studio 6
4. Created a new Win32 console application and added the following code to it:

Code:
#include "stdafx.h"

#import "C:\\Program Files\\Corel\\CorelDRAW Graphics Suite X4\\Programs\\VGCoreAuto.tlb" rename("GetCommandLine", "VG_GetCommandLine"), \
rename("CopyFile", "VG_CopyFile"), \
rename("FindWindow", "VG_FindWindow") \
no_namespace

#import "C:\\Program Files\\Corel\\CorelDRAW Graphics Suite X4\\Programs\\CorelDraw.tlb"

int main(int argc, char* argv[])
{
	CoInitialize(NULL);
	try
	{
		CorelDRAW::IDrawApplicationPtr app(__uuidof(CorelDRAW::Application));
		app->Visible = VARIANT_TRUE;
		CorelDRAW::IDrawDocumentPtr doc = app->CreateDocument();
		doc->ActiveLayer->CreateRectangleRect(doc->ActivePage->BoundingBox, 0, 0, 0, 0);
	}
	catch(_com_error& e)
	{
		MessageBox(NULL, e.Description(), "Error", MB_ICONSTOP);
	}
	CoUninitialize();
	return 0;
}
You might even see some of the X4-specific methods used (like Layer::CreateRectangleRect) to show that it's really CorelDRAW X4...

Everything compiles and code works correctly (the application starts, new document is created and a rectangle is created of the size of the page)...

So, either it's a problem with your particular setup or maybe there is something with the trial installer...
Reply With Quote
  #6  
Old 29-01-2008, 16:28
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

Just wanted to let you know that I just re-did the whole test on another brand new clean machine with VC++ 6.0 and the trial version of CorelDRAW I downloaded from corel.com and it all worked with no problem.

It must be some registration problem on your end (are you sure you are actually using CorelDRAW.tlb and VGCoreAuto.tlb from CorelDRAW X4 and not the older versions you have installed?)
Reply With Quote
  #7  
Old 29-01-2008, 16:49
jemmyell jemmyell is offline
Senior Member
 
Join Date: Jan 2005
Location: Orange County, California, USA, Earth, Solar System, Milky Way Galaxy
Posts: 157
Default I will try the test again

Alex,

I have a header file that #imports either The V12, or X3 typelibs which I have renamed to reflect their origin. I did the same with the X4 typelibs from the trial installer. I will triple check for mistakes. Shouldn't I be able to compile even without CorelDRAW installed on the system? I must admit that both machines I have been building on have V12 and X3 installed. But I do believe I should be able to use just the typelibs by themselves. I will test the OLEView problem on the Vista system I have X4 installed on. (IF OLEView will run on Vista...).

I will retry this test tonight and report back.

-James
__________________
-James Leonard
CNC Inlay Guy - www.CorelDRAWCadCam.com
Reply With Quote
  #8  
Old 29-01-2008, 22:40
jemmyell jemmyell is offline
Senior Member
 
Join Date: Jan 2005
Location: Orange County, California, USA, Earth, Solar System, Milky Way Galaxy
Posts: 157
Default Ok, my bad...

Well, since I have never had to register a typelib individually (REGSVR32.EXE does this for DLLs) it just did not occur to me...

I have used REGTLIB.EXE to register the X4 typelibs on my development laptop and all is well. Here is the header file I am using to compile for V12, X3 and X4 along with the PROGID I use to instantiate the CorelDRAW objects.

Code:
// CorelDraw.h

// NOTE: if there are any issues with reading any of these typelibs
// be sure that they have been registered with REGTLIB.EXE

// Uncomment EITHER CDR_V12 or CDR_V13 or CDR_V14 to compile for V12 or X3 or X4

#define CDR_V12
//#define CDR_V13
//#define CDR_V14

#ifdef CDR_V12

#define CDR_PROGID TEXT("CorelDRAW.Application.12")

// These #import statements must be repeated in every module that uses the Smart Pointers
// generated by these #import statements

#import "VGCoreAuto12.tlb" rename("GetCommandLine", "VG_GetCommandLine"), \
  rename("CopyFile", "VG_CopyFile"), \
  rename("FindWindow", "VG_FindWindow") \
  no_namespace

#import "CorelDraw12.tlb"

#endif

#ifdef CDR_V13

#define CDR_PROGID TEXT("CorelDRAW.Application.13")

// These #import statements must be repeated in every .CPP module

#import "VGCoreAuto13.tlb" rename("GetCommandLine", "VG_GetCommandLine"), \
  rename("CopyFile", "VG_CopyFile"), \
  rename("FindWindow", "VG_FindWindow") \
  no_namespace

#import "CorelDraw13.tlb"

#endif

#ifdef CDR_V14

#define CDR_PROGID TEXT("CorelDRAW.Application.14")

// These #import statements must be repeated in every .CPP module

#import "VGCoreAuto14.tlb" rename("GetCommandLine", "VG_GetCommandLine"), \
  rename("CopyFile", "VG_CopyFile"), \
  rename("FindWindow", "VG_FindWindow") \
  no_namespace

#import "CorelDraw14.tlb"

#endif

using namespace CorelDRAW;
Note that by developing for V12 I have maintained compatibility with just a recompile for both V12 and X3. I will soon know if X4 and Vista are similarly compatible.

Alex, thanks again.
__________________
-James Leonard
CNC Inlay Guy - www.CorelDRAWCadCam.com
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
Download only Corel Script Editor aus_gift CorelDRAW CS 6 16-11-2010 18:12
New Embroidery Free Download sallybode General 5 28-04-2006 11:05
Corel Draw v12 Trial Anonymous General 3 22-12-2004 11:30
administrator only? trial expires after 1 week! Anonymous CurveWorks 1 11-03-2003 00:32


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


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