declare API without direct file name

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • iwdu15

    declare API without direct file name

    hi, i need to have a declare statement for an API to call a method in it, the
    only problem is that i dont neccessarily know where on the comp it will be. I
    kno it will be in my application folder, but how do i say that in the
    declares statement? for instance, i have this

    Private Declare Sub AccCreateSessio n Lib "acccore.dl l" Alias "#111" _
    (<MarshalAs(Unm anagedType.LPSt ruct)ByVal Name As Guid,
    <MarshalAs(Unma nagedType.IDisp atch)ByRef session As Object)

    but it cant find it, ive also tried

    Private Declare Sub AccCreateSessio n Lib "..\acccore.dll " Alias "#111" _
    (<MarshalAs(Unm anagedType.LPSt ruct)ByVal Name As Guid,
    <MarshalAs(Unma nagedType.IDisp atch)ByRef session As Object)

    but that doesnt work either.....how can i do this?
    --
    -iwdu15
  • Tom Shelton

    #2
    Re: declare API without direct file name


    iwdu15 wrote:
    hi, i need to have a declare statement for an API to call a method in it, the
    only problem is that i dont neccessarily know where on the comp it will be. I
    kno it will be in my application folder, but how do i say that in the
    declares statement? for instance, i have this
    >
    Private Declare Sub AccCreateSessio n Lib "acccore.dl l" Alias "#111" _
    (<MarshalAs(Unm anagedType.LPSt ruct)ByVal Name As Guid,
    <MarshalAs(Unma nagedType.IDisp atch)ByRef session As Object)
    >
    but it cant find it, ive also tried
    >
    Private Declare Sub AccCreateSessio n Lib "..\acccore.dll " Alias "#111" _
    (<MarshalAs(Unm anagedType.LPSt ruct)ByVal Name As Guid,
    <MarshalAs(Unma nagedType.IDisp atch)ByRef session As Object)
    >
    but that doesnt work either.....how can i do this?
    What error do you get exactly? The declare will find the dll as long
    as it is in the search path, and by default the current directory is in
    that path....

    --
    Tom Shelton [MVP]

    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: declare API without direct file name

      "iwdu15" <jmmgoalsteraty ahoodotcomschri eb:
      hi, i need to have a declare statement for an API to call a method in it,
      the
      only problem is that i dont neccessarily know where on the comp it will
      be. I
      kno it will be in my application folder, but how do i say that in the
      declares statement? for instance, i have this
      >
      Private Declare Sub AccCreateSessio n Lib "acccore.dl l" Alias "#111" _
      (<MarshalAs(Unm anagedType.LPSt ruct)ByVal Name As Guid,
      <MarshalAs(Unma nagedType.IDisp atch)ByRef session As Object)
      >
      but it cant find it, ive also tried
      >
      Private Declare Sub AccCreateSessio n Lib "..\acccore.dll " Alias "#111" _
      (<MarshalAs(Unm anagedType.LPSt ruct)ByVal Name As Guid,
      <MarshalAs(Unma nagedType.IDisp atch)ByRef session As Object)
      >
      but that doesnt work either.....how can i do this?
      Are you really sure the DLL is in the directory where your executable file
      resides? You may have to copy the DLL to your project's "bin" folder in
      order to be able to start the application from within the IDE.

      --
      M S Herfried K. Wagner
      M V P <URL:http://dotnet.mvps.org/>
      V B <URL:http://classicvb.org/petition/>

      Comment

      • iwdu15

        #4
        Re: declare API without direct file name

        im positive its there...i copied it myself. it was originally in a directory
        off of C:\ but then to release my app, i copied to the Bin directory, and
        changed the code to what i showed above. making sure i was running in Debug
        mode, it wouldnt find the dll.....
        --
        -iwdu15

        Comment

        • iwdu15

          #5
          Re: declare API without direct file name

          the dll is in the "bin" directory, as is the application. i get an error
          saying it could not load the said module....but when i hardcode the path it
          works
          --
          -iwdu15

          Comment

          • iwdu15

            #6
            RE: declare API without direct file name

            il also add, if it helps, that this is a COM object. I have to declare it
            like so to have the dll create an object for me. I also have it imported in
            my references....i f this helps at all
            --
            -iwdu15

            Comment

            Working...