troubleshooting Question

Passing String Arguments VBA / Visual Basic

Avatar of CyberUnDead
CyberUnDead asked on
Microsoft AccessVisual Basic Classic.NET Programming
5 Comments1 Solution679 ViewsLast Modified:
What is the proper way to pass string parameters between my host application, which is Access 2003, and my library, which is Visual Basic 6?

I am using the technique outlined in this article http://oreilly.com/pub/a/windows/2005/04/26/create_dll.html or here http://www.vb-helper.com/howto_make_standard_dll.html to create a standard DLL (not ActiveX/COM) using Visual Basic 6.  

My console output from the code below is:
false
false

If I hard code the string parameter as "\\server" inside the DLL it returns true.
'DLL Library
Public Function IsUNCPath(strPath As String) As Boolean
    On Error GoTo Error_Handle
 
    If Left(strPath, 2) = "\\" Then
        IsUNCPath = True
    Else
        IsUNCPath = False
    End If
 
Exit_Procedure:
    Exit Function
 
Error_Handle:
    Resume Exit_Procedure
End Function
 
 
'Calling Application
Private Declare Function IsUNC Lib "core" Alias _
    "IsUNCPath" (strPath As String) As Boolean
        
Sub TestCoreLibrary()
    Call LoadDLL("core.dll")   'load custom dll
    
    Debug.Print IsUNC("c:\") 'should return false
    Debug.Print IsUNC("\\server1") 'should return true
 
    Call UnloadDLL("core.dll") 'unload custom dll
End Sub
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros