hi
i need to use a code written written dotNet in vb6
i have created a classLibrary Project in dotNet and i have built it , i got a dll file , a tlb file and an xml file
in vb6 , when i try to add the dll file as a reference i get this error message : "unable to add reference to the specified file ..."
i added a reference to the tlb file and wrote a piece of code to call my function "ConvertBMP" , i got a message at run time : "activex cannot create object..."
can anyone help me on that , is this the right way to do it or there is an other way ??
thanks in advance
==========================
==========
====
dotNet
==========================
==========
====
Imports System.IO.Path
Imports System.Drawing
Imports System.Drawing.Imaging
Public Class ClsConvertBMP
Public Function ConvertBMP(ByVal BMPFullPath As String, _
ByVal NewNameImage As String, _
ByVal NewFormat As String) As Boolean
Dim bAns As Boolean
Dim sNewFile As String
Dim imgFormat As ImageFormat = ImageFormat.Bmp
Try
'bitmap class in system.drawing.imaging
Dim objBmp As New Bitmap(BMPFullPath)
'below 2 functions in system.io.path
sNewFile = GetDirectoryName(BMPFullPa
th)
sNewFile += NewNameImage
Select Case NewFormat
Case "BMP"
imgFormat = ImageFormat.Bmp
Case "GIF"
imgFormat = ImageFormat.Gif
Case "JPG"
imgFormat = ImageFormat.Jpeg
Case "TIF"
imgFormat = ImageFormat.Tiff
Case "WMF"
imgFormat = ImageFormat.Wmf
End Select
sNewFile += "." & imgFormat.ToString
objBmp.Save(sNewFile, imgFormat)
bAns = True 'return TRUE on success
Catch ex As Exception
bAns = False 'return FALSE on echec
'MsgBox("ConvertBMP : " & ex.Message)
End Try
Return bAns
End Function
End Class
==========================
==========
=====
VB
==========================
==========
=====
Dim aa As New ClassLibrary1.ClsConvertBM
P
Dim Ret As Boolean
Ret = aa.convertBMP("D:\test1.bm
p", "Convert", "BMP") <--- error here
End Sub
Start Free Trial