Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to load DLL in vb ?? URGENT !!!!

How to load DLL in vb ?? URGENT !!!!

Scheduled Pinned Locked Moved Visual Basic
questiontutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    How can I to load dll "abc.dll" to my project if I want to use in my project the export functions of that dll ???

    S 1 Reply Last reply
    0
    • L Lost User

      How can I to load dll "abc.dll" to my project if I want to use in my project the export functions of that dll ???

      S Offline
      S Offline
      S S Ahmed
      wrote on last edited by
      #2

      Have a look at the code below, this is one way of loading a DLL in VB. Use the loadlibrary function to load the dll. Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" _ (ByVal lpLibFileName As String) As Long Private Declare Function LoadString Lib "user32" Alias "LoadStringA" _ (ByVal hInstance As Long, ByVal wID As Long, ByVal lpBuffer As String, _ ByVal nBufferMax As Long) As Long Private Sub Form_Load() Dim hInst As Long, lResult As Long, x As Long Dim LCID As Long, sLcid As String Dim resString As String * 255 Dim sCodePage As String sCodePage = String$(16, " ") Label1.AutoSize = True Label1.Caption = "" LCID = GetThreadLocale() 'Get Current locale sLcid = Hex$(Trim$(CStr(LCID))) 'Convert to Hex ' Display decimal value of the LCID (Hex in Parentheses) Form1.Caption = "LCID " & LCID & " (" & sLcid & ")" x = GetLocaleInfo(LCID, LOCALE_IDEFAULTANSICODEPAGE, _ sCodePage, Len(sCodePage)) 'Get code page sCodePage = StripNullTerminator(sCodePage) ' Load dll with string table resource. ' Might need to change path for the resdll. hInst = LoadLibrary("resdll" & sLcid & ".dll") ' Get string with ID 101. lResult = LoadString(hInst, 101, resString, 255) With Label1.Font .Name = "Lucida Sans Unicode" .Size = 14 .Charset = GetCharSet(sCodePage) 'Convert code page to charset End With ' Display the localized string. Label1.Caption = resString End Sub S.S. Ahmed ss_ahmed1@hotmail.com http://glowbutton.faithweb.com

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups