How to load DLL in vb ?? URGENT !!!!
-
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 ???
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