Getting started with VB in Visual Studio 2010/2012 express

ImageMagickObject is a Windows COM+ interface to ImageMagick. COM+, Visual Basic, and Delphi users should post to this discussion group.
Post Reply
jensskov
Posts: 1
Joined: 2012-11-30T05:57:53-07:00
Authentication code: 6789

Getting started with VB in Visual Studio 2010/2012 express

Post by jensskov »

Hi

I am on Windows 7 64bit and using VB in VS2010/2012.
I want to use IM to convert som images to jpg from a lookup in a database or a csv-file.

But when I do:

Code: Select all

Dim imgMkObj As Object
        imgMkObj = CreateObject("ImageMagickObject.MagickImage.1")
I get an error "Cannot create ActiveX component"

I have added the reference to the DLL.

Is there a better way to do this? My mind has crossed phyton ot ruby as there seems to be better support for IM.
StillLearning
Posts: 1
Joined: 2013-01-02T21:20:58-07:00
Authentication code: 6789

Re: Getting started with VB in Visual Studio 2010/2012 expre

Post by StillLearning »

Me, too. No joy. Any guidance would be appreciated -or just some help in understanding. I don't "need" the Object in my Visual Studio project. I'm just a dumb guy horsing around, and I can accomplish what I want via the shell or with the 32bit version, but I'd really like to learn, and I'm at a point where I need some help understanding what is going on......

**********************************************************************************************************************
I can get the 32bit version of ImageMagick installed and register/add reference to the ImageMagicObject.DLL (ImageMagick-6.8.1-5-Q8-x86-dll.exe).
**********************************************************************************************************************

I can't get the 64 bit version to work. The below information is in regards to the 64bit version of ImageMagick:

I have also added registered c:\program files\imagemagick\imagemagickobject.dll and added a reference to it in my visual studio 2012 project.

Due to reading:
http://www.vbforums.com/showthread.php? ... COM-object
http://code.ladasoukup.cz/2009/02/visua ... -with.html
http://stackoverflow.com/questions/1036 ... d-due-to-t

I have also tried what is listed below with the .vbproj file edited as follows:
<platformtarget>AnyCPU</platformtarget>
changed to (in 2 places):
<platformtarget>x86</platformtarget>
(although I have installed 64bit ImageMagick on a 64bit machine)


I have a module, modTest within my project which contains the following at the very beginning:

Option Explicit On
Imports ImageMagickObject
---------------------------------------

When I do a:
Dim img As New ImageMagickObject.MagickImage

Upon debug I get a:

"An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll

Additional information: Retrieving the COM class factory for component with CLSID {5630BE5A-3F5F-4BCA-A511-AD6A6386CAC1} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))."

When I remove "new" and do a:
Dim img As ImageMagickObject.MagickImage
img = CreateObject("ImageMagickObject.MagickImage.1")

Upon debug I get a:

"An unhandled exception of type 'System.Exception' occurred in Microsoft.VisualBasic.dll

Additional information: Cannot create ActiveX component."

When I do a:

Dim msgs As String
Dim im As ImageMagickObject.MagickImage
msgs = im.Convert("logo:", "-format", "%m,%h,%w", "info:")

Upon debug I get a:

An unhandled exception of type 'System.NullReferenceException' occurred in AAAAA.exe

Additional information: Object reference not set to an instance of an object.

When I do a:

Dim msgs As String
Dim im As New ImageMagickObject.MagickImage
msgs = im.Convert("logo:", "-format", "%m,%h,%w", "info:")

Upon debug I get a:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll

Additional information: Retrieving the COM class factory for component with CLSID {5630BE5A-3F5F-4BCA-A511-AD6A6386CAC1} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
Post Reply