Building my own COM+ dll

ImageMagickObject is a Windows COM+ interface to ImageMagick. COM+, Visual Basic, and Delphi users should post to this discussion group.
Post Reply
darbid

Building my own COM+ dll

Post by darbid »

I am a VBA coder, although I have access to VS 2008 I do not know what I am doing.

I want to be able to use the convert command manipulate jpg and png images.

I would like to be able to cut down the default downloaded able installation into one or two .dll (you can see I am already struggling with what I need to do)

following the instuctions I managed to get the configure to produce a VisualDynamicMT.sln. I then did a release and got the "build 140 suceed" from VS.

Now what?

I also tried to use the command line to build the COM+ dll as I thought I might be up to this step, but my Vista complains that it cannot find vsvars32 and thus cannot build.

Thank you in advance.
darbid

Re: Building my own COM+ dll

Post by darbid »

I thought I was pushing my luck. But I am not giving up on your code as I am sure that you would like as many people as possible to use it and for it to be popular. I have read pretty much every post in the COM section and it looks like you need someone to make a dumb-me instructions for people like me. Currently the only answer I get is to go to rentacoder.com :-)

I got an old Visual Studio 6 going.
In the configure.exe if I choose staticbuilds VS6.0 will not build it. The output window shows "create library under Core_filters" and sits there - it still thinks it is building but it is not.

I did however get VS6.0 to build (more or less) VisualDynamicMT.dsw workspace. Still has 3 errors - call me an idiot but I have no idea how it can error when I have not changed anything. "3 error(s), 134 warning(s)"

I think this is the error output
"--------------------Configuration: UTIL_animate - Win32 Release--------------------
Compiling resources...
Compiling...
animate.c
MagickWand lib DLL import interface
MagickWand module DLL export interface
MagickWand lib DLL import interface
MagickWand module DLL export interface
Magick lib DLL import interface
Magick module DLL export interface
Linking...
animate.obj : error LNK2001: unresolved external symbol __imp__MagickCommandGenesis
animate.obj : error LNK2001: unresolved external symbol __imp__AnimateImageCommand
D:\David\Image\ImageMagick\VisualMagick\bin\animate.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe."
If I understand stuff so far I am not going to use animate so this will not worry me.

Assuming the above is ok

The CMD for the BuildImageMagickObject.cmd causes the following error.
'vsvars32' is not recognized as an internal or external command,
operable program or batch file.
'rc' is not recognized as an internal or external command,
operable program or batch file.
Problem - the compile of RC files for ImageMagickObject failed
seem this is not good

Code: Select all

if not defined DevEnvDir (call vsvars32)
set PATH_TO_ROOT=..\..\..\..
if not {%2} == {} (
  set PATH_TO_ROOT=%2
)
but this is the one that i cannot find anything in google for - "rc" what is that.

Code: Select all

rc /fo ImageMagickObject.res ImageMagickObject.rc
if not exist ImageMagickObject.res (
  (@echo Problem - the compile of RC files for ImageMagickObject failed)
  goto :EOF
)
I am looking forward to some input so that my blind stabs at learning while doing are not 100% in vein.

regards

David
darbid

Re: Building my own COM+ dll

Post by darbid »

What is a froum thread where only one person is writing - A blog - as such I will give my Subjective Blog (ie my opinion which you may very well disagree with)

The Facts (for a beginner):
Complining/building this from source is not suitable for begginers- or the hobby VBA person.
You will get very little to no help here
The configure.exe program does not work every time
If you get as far as to have this in Visual Studio and build it - it will also not always work
The code and method of building the mageMagickObject does not work at all.

So what are your options.

1. You want to keep trying with a build.
a - As of 23/02/2010 the instructions here seem out of date.http://www.imagemagick.org/script/insta ... hp#windows You do not have to build the configure program.
b - Notwithstanding what is in the instuctions I could only get a multi-threaded dll to work later - so I did not choose static here. I also unchecked the X11.
c - once you run this there is a new file that is produced which is a "workspace file" this is a file that is recognised by Visual Studio - (dsw) is for 6 and (sln) for 2005. I had Visual Studio 2009 and the produced (sln) never opened without needing to do an "ungrade" of the sln - which appears to be compatible with VS 2005. Also this does not work error free.
d. Follow the instructions then word for word on building. This BIN folder will have almost everything you need.
e. As you see in my post above the instuctions here http://www.imagemagick.org/script/ImageMagickObject.php simply do not work - I have tried it on 2 computers with 3 operating systems.
f. But stress less cause I am not sure you need it. Just use one of the downloads here http://www.imagemagick.org/script/binar ... hp#windows which has the ImageMagickObject in it.
g. Then here is my dumb way of cutting this down to the minimum which at this stage is working for me with "Convert" and doing things like resize,thumbnail, compose
h. Go to the bin folder and take these files (the reason for taking these is the ImageMagickObject.dll will not register without these);
CORE_RL_tiff.dll
CORE_RL_ttf.dll
CORE_RL_wand.dll
CORE_RL_xlib.dll
CORE_RL_zlib.dll
CORE_RL_Magick_.dll
CORE_RL_lcms.dll
CORE_RL_bzlib.dll
CORE_RL_jpeg.dll
CORE_RL_.png

Of course you need the ImageMagickObject.dll which you ripped off from one of the downloads

Then you need to look at these files in the BIN folder "IM_MOD_RL_jpeg_.dll" see that each on has a image fomat in the name. What this means is that this dll is for jpeg. So for me I am possible only dealing with jpeg, gif and png so I have taken only those.

Put all these into a folder and then register the ImageMagickObject.dll. (google register .dll to learn how to do that)

Now you can reference your ImageMagickObject.dll in your VBA project.

(I think also the portable version may also produce similar .dll's as the build does so you might be able to sue them)

2. Use the command line from VBA. People you will loose a lot of hair doing 1 above if you do not know what you are doing. You can write your command line code in notepad and save it as a .bat file and then with VBA execute the .bat file for you. VBA can also write to a file and then save it as a .bat file as well. All the code you see here in the forum is designed for unix scripts as the coders are from a unix background so you need to look here to understand what you are doing http://www.imagemagick.org/Usage/windows/#scripts. Then once you have saved your bat file in VBA you use Shell to execute it.

As far as I can see lets say you only want to use "Convert" then go here http://www.imagemagick.org/script/binar ... hp#windows and download the portable version. Then you can just take the convert.exe file as this is all you need. At least till now my limited testing has all gone good.

3. A small variation of 2 is that http://www.imagemagick.org/Usage/windows/#scripts at the bottom it talks about VBScript. VBA can do this as well. In fact the code they have there can be cut and copied into your VBA project. They do choose a rather hard example to understand so here is a simple example

Code: Select all

Dim myWS
Dim command
Dim objExec

Set myWS = CreateObject("WScript.Shell")

command = "full_path_to_your_\convert.exe full_path_to_the_image_input\new.jpg -thumbnail 160x120 full_path_to_the_image_output\thumbnail.png"
'this is one method to execut it and objExec will give you any output you might want or need
Set objExec = myWS.Exec(command)
'this is a second alternative - this might be better as that "True" makes the command wait till it has executed which you really should watch as VBA sometimes moves on to the next lines of code without waiting for this to finish
myWS.Run command, 7, True
Set myWS = Nothing
So finally if you look in this forum there was a guy that could not get a straight answer about what files he needed. The conclusion to that thead viewtopic.php?f=8&t=12121 was a dissapointing "pay someone to build it for you". That does not help the forum but also it does not help him. If you are going to pay something then go find an image manipuation program that is not free and pay for it. Then at least you have a chance of getting help in the future.
Post Reply