Results 1 to 3 of 3

Thread: vb6 call dll api in other folder

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,541

    vb6 call dll api in other folder

    Code:
     Private Declare Function Add Lib "AComDll_Thread" (ByVal A As Long, ByVal B As Long) As Long
    
    Private Sub Form_Load()
        Dim DllPath As String, NowPath As String
        DllPath = App.Path & "\dll"
        DllPath = "Z:\test"
        NowPath = App.Path
        ChDrive Left$(DllPath, 2)
        ChDir DllPath
        '-----------------------
         MsgBox Add(3, 4)
        '-----------------------
        ChDrive Left$(NowPath, 2)
        ChDir NowPath
        
        MsgBox App.Path
    End Sub

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,541

    Re: vb6 call dll api in other folder

    Code:
    Private Declare Function Add Lib "AComDll_Thread" (ByVal A As Long, ByVal B As Long) As Long
    Private Declare Function SetCurrentDirectoryW Lib "kernel32" (ByVal lpPathName As Long) As Long
    
    Private Sub Form_Load()
        Dim DllPath As String, NowPath As String
        DllPath = App.Path & "\dll"
        SetCurrentDirectoryW StrPtr(DllPath)
        
        MsgBox Add(3, 4)
        MsgBox App.Path
    End Sub

  3. #3
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,667

    Re: vb6 call dll api in other folder


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width