Re: loading, Flipping and saving jpgs

Tech-Archive recommends: Fix windows errors by optimizing your registry



On Thu, 27 Mar 2008 00:11:48 +1100, "Bill McCarthy" <Bill@xxxxxxxxxx>
wrote:
in <12B4E196-617A-4DE6-B704-5B18578D162E@xxxxxxxxxxxxx>


"Michael C" <mike@xxxxxxxxxx> wrote in message
news:uASVrIjjIHA.4376@xxxxxxxxxxxxxxxxxxxxxxx
"Bill McCarthy" <Bill@xxxxxxxxxx> wrote in message
news:OilCH8VjIHA.4080@xxxxxxxxxxxxxxxxxxxxxxx
I had no problem with the example I posted. It took me no time to find
the GDI+ typelib and get the calls right: plenty of sample code out
there.

Ok, I just had a look at this typelibrary of yours as it is different to
the one I used. It's just a definition of the API calls that you would
make yourself. It doesn't appear to be much of a wrapper for GDI+. It's
basically just like making the calls yourself.


As has been told to you infinitum, that's what the .NET wrapper also does in
this case. The difference is the VB6 code gives you mroe control as to
when GDI+ is loaded and unloaded.


You need to handle the destruction of resources just like you would if you
were making the calls yourself.

Right, as my code clearly stated. I even put a comment there to inform you
and others of that. The advantage is you do get to say exactly when
resoruces are cleaned up.


From what I can tell this just saves you the trouble of creating the
declare statements, that's it.

It's an interface to GDI+, that means you don't need to declare API calls.
You claimed you did. You were wrong. Yet here you are still arguing it.


You still need to check for return values and handle errors and clean up
resources.




This is quite simply NOT simpler than using GDI+ in dot net.


Give it up man ! I'm not going to chase circular arguments with you. As
has already been pointed out it is vastly simpler than having to port the
entire app over to dotnet and then worry about distributing the dotnet
libraries and which versions etc, etc.



The code you posted basically ignores errors (eg, if the file did not
exist it goes right on and tries to flip it) and ignores issues such as
cleaning up resources after a runtime error.



There was no error handling in my code. You would need to add that to both
dotnet and VB6 code. That Image.FromFile throws a file not found exception
rather than letting the API throw that is immaterial as it is still possible
for the file to be renamed or moved before the API call actually loads it.
So the wrapper in dotnet checks for a file not found, and if it isn't it
throws one kind of exception. Yet if the APi call is made and the file not
found, it throws another type of exception, meaning you need to have twice
the handling for file not found. And if you decided to check for file not
found rather than handle exceptions, then you're duplicating calls.




So, as I said right from the start, using GDI+ in VB6 requires calling
APIs.


Man, are you think or what ?



The fact that these APIs are in a typelib makes little difference.



Oh, but having them inside dotnet libraries does huh ? What clueless
nonsense.

The really clueless nonsense here is the phony argument between you two
..netters - you and Michael C.

Great theater - have you given any thought to a career on stage or
perhaps writing comedy? Or did micro$oft script this one for you?

---
Stefan Berglund
.



Relevant Pages

  • Re: loading, Flipping and saving jpgs
    ... It doesn't appear to be much of a wrapper for GDI+. ... As has already been pointed out it is vastly simpler than having to port the entire app over to dotnet and then worry about distributing the dotnet libraries and which versions etc, ... That Image.FromFile throws a file not found exception rather than letting the API throw that is immaterial as it is still possible for the file to be renamed or moved before the API call actually loads it. ...
    (microsoft.public.vb.general.discussion)
  • Wont distribute
    ... I hope someone can give me a clue because they have run into an error using API calls: ... "Application has generated an exception that could not be handled" ... I don't know if the API calls don't work properly or if they require an additional addin for dotnet to function - something other than dotnetfx.exe? ...
    (microsoft.public.dotnet.distributed_apps)
  • Rephrase Question - What is needed besides dotnetfx.exe?
    ... "Application has generated an exception that could not be handled" ... I'm guessing COM, but as I have described above, there should be no problem there. ... I don't know if the API calls don't work properly or if they require an additional addin for dotnet to function - something other than dotnetfx.exe? ...
    (microsoft.public.dotnet.academic)
  • Re: InvalidPrinterException for Print() or PrintPreviewDialog()
    ... Answer those GDI+ questions with the GDI+ FAQ ... The exception happens ... > PrintDocument pd = new PrintDocument; ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: InvalidPrinterException for Print() or PrintPreviewDialog()
    ... Answer those GDI+ questions with the GDI+ FAQ ... The exception happens ... > PrintDocument pd = new PrintDocument; ...
    (microsoft.public.dotnet.framework.windowsforms)