Results 1 to 8 of 8

Thread: API declare not allow

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2005
    Posts
    230

    API declare not allow

    I have created a dll using C++, now i want to use it in VB6 However
    the declaration is fine using the fullpath as follow:

    VB Code:
    1. Private Declare Sub Principal Lib "F:\myfunction.dll" (ByVal value As String)

    However, i want to declare as:
    VB Code:
    1. Private Declare Sub Principal Lib app.path & "\myfunction.dll" (ByVal value As String)

    VB wouln'd allow me to do that. any solution ?

  2. #2
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: API declare not allow

    Is dll located in app.path? Did you save your project? If you didn't, App.Path equals VB's path.

  3. #3
    Hyperactive Member
    Join Date
    Apr 2004
    Posts
    342

    Re: API declare not allow

    Do it like this and as long as the DLL is with the EXE or in the Search Path you should be set!

    Private Declare Sub Principal Lib "myfunction.dll" (ByVal value As String)

  4. #4
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: API declare not allow

    Correct me if im worng... but if you register the dll in windows, the path should not be needed
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  5. #5
    Hyperactive Member
    Join Date
    Apr 2004
    Posts
    342

    Re: API declare not allow

    Not all DLL's can be registered, right?

    But as long as it is in the Search Path, where the .EXE is, or as Gavio states in the IDE it would need to be with VB6.EXE.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Dec 2005
    Posts
    230

    Re: API declare not allow

    thanks guys

  7. #7
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: API declare not allow

    Quote Originally Posted by tward_biteme1
    Not all DLL's can be registered, right?

    But as long as it is in the Search Path, where the .EXE is, or as Gavio states in the IDE it would need to be with VB6.EXE.
    that is correct
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  8. #8
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: API declare not allow

    Place the dll in App.Path and try just,
    VB Code:
    1. Private Declare Sub Principal Lib "myfunction.dll" (ByVal value As String)

    @Static, AFAIK, if the dll is a standard windows dll (not ActiveX dll), it doesn't (and can't be) need to be registered.
    By default, Windows first searches App.Path for the dll. If it is not found in App.Path, then it searches the System dir. If it is missing in system dir too, then Windows displayes the Dll not found error message.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


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