VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



another way of using dll

by nagesh borate (4 Submissions)
Category: Custom Controls/Forms/Menus
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (5 Votes)

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 https://www.vbcoders.com/vb/scripts/ShowCode.asp?txtCodeId=64297&lngWId=1
and
resource function from https://www.vbcoders.com/vb/scripts/ShowCode.asp?txtCodeId=64634&lngWId=1

Rate another way of using dll


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

Download this snippet    Add to My Saved Code

another way of using dll Comments

No comments have been posted about another way of using dll. Why not be the first to post a comment about another way of using dll.

Post your comment

Subject:
Message:
0/1000 characters