Search Tools Links Login

another way of using dll


another way of using dll
generally i used adding a dll from project>references and so on. but that gave a lot of errors wen i take my project to another pc, so using api, i found this new way of using my dll. hope people here like it, plz give comments !!!
base64 dll came from http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=64297&lngWId=1
and resource function from http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=64634&lngWId=1

Original Author: nagesh borate

Code


Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Sub Form_Load()
On Error GoTo erh
FileLen App.Path & "ase64.dll"
continue:
lb = LoadLibrary(App.Path & "ase64.dll")
Dim o As Object
Set o = CreateObject("base64.b64")
MsgBox o.encode("nagesh")
Set o = Nothing
FreeLibrary lb
End
erh:
If Err.Number = 53 Then
GetFromRes 101, App.Path & "ase64.dll"
GoTo continue
End If
End
End Sub

Private Sub GetFromRes(id As Integer, fp As String)
  Dim fn As Integer
  Dim fb() As Byte
  fb = LoadResData(id, "CUSTOM")
  fn = FreeFile
  Open fp For Binary Access Write As #fn
  Put #fn, , fb
  Close #fn
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 141 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.