Demonstration project uses EncoderForExtension incorrectly

Summary

Id:4580.1
Type:Bug Bug
Current Status:Fix Identified

Detail

3 Jun 2003OpenSienko Ikhabi

I have been playing around with your GDI+ Wrapper dll. Have you intentionally left out some classes' code? These methods seem to fail

-g_cEncoders.EncoderForExtension(sExt) g_cEncoders as GDIPImageEncoderList)

with GDI+ error 2. In your GDI+ Codecs sample project, trying saving and selecting All files and type in an extension in the file name e.g. test.png.

8 Jun 2003Fix IdentifiedSteve McMahon

Here’s the fixed code:

' we've picked all files On Error Resume Next Dim sExt As String i = InStrRev(sFIle, ".") If (i > 0) Then sExt = Mid$(sFIle, i + 1) sExt = UCase$(sExt) Set cCodec = g_cEncoders.EncoderForExtension(sExt) End If On Error GoTo 0 If (cCodec Is Nothing) Then Set cCodec = g_cEncoders.Item(1) End If