Advertisement
5_2007-2008 Custom Controls/ Forms/ Menus #192839

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

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
<pre>
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 & "\base64.dll"
continue:
lb = LoadLibrary(App.Path & "\base64.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 & "\base64.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
</pre>
Original Comments (3)
Recovered from Wayback Machine