PC Review


Reply
Thread Tools Rate Thread

declare API without direct file name

 
 
=?Utf-8?B?aXdkdTE1?=
Guest
Posts: n/a
 
      10th Aug 2006
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 AccCreateSession Lib "acccore.dll" Alias "#111" _
(<MarshalAs(UnmanagedType.LPStruct)> ByVal Name As Guid,
<MarshalAs(UnmanagedType.IDispatch)> ByRef session As Object)

but it cant find it, ive also tried

Private Declare Sub AccCreateSession Lib "..\acccore.dll" Alias "#111" _
(<MarshalAs(UnmanagedType.LPStruct)> ByVal Name As Guid,
<MarshalAs(UnmanagedType.IDispatch)> ByRef session As Object)

but that doesnt work either.....how can i do this?
--
-iwdu15
 
Reply With Quote
 
 
 
 
Tom Shelton
Guest
Posts: n/a
 
      10th Aug 2006

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 AccCreateSession Lib "acccore.dll" Alias "#111" _
> (<MarshalAs(UnmanagedType.LPStruct)> ByVal Name As Guid,
> <MarshalAs(UnmanagedType.IDispatch)> ByRef session As Object)
>
> but it cant find it, ive also tried
>
> Private Declare Sub AccCreateSession Lib "..\acccore.dll" Alias "#111" _
> (<MarshalAs(UnmanagedType.LPStruct)> ByVal Name As Guid,
> <MarshalAs(UnmanagedType.IDispatch)> 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]

 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      10th Aug 2006
"iwdu15" <jmmgoalsteratyahoodotcom> schrieb:
> 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 AccCreateSession Lib "acccore.dll" Alias "#111" _
> (<MarshalAs(UnmanagedType.LPStruct)> ByVal Name As Guid,
> <MarshalAs(UnmanagedType.IDispatch)> ByRef session As Object)
>
> but it cant find it, ive also tried
>
> Private Declare Sub AccCreateSession Lib "..\acccore.dll" Alias "#111" _
> (<MarshalAs(UnmanagedType.LPStruct)> ByVal Name As Guid,
> <MarshalAs(UnmanagedType.IDispatch)> 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/>

 
Reply With Quote
 
=?Utf-8?B?aXdkdTE1?=
Guest
Posts: n/a
 
      10th Aug 2006
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
 
Reply With Quote
 
=?Utf-8?B?aXdkdTE1?=
Guest
Posts: n/a
 
      11th Aug 2006
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
 
Reply With Quote
 
=?Utf-8?B?aXdkdTE1?=
Guest
Posts: n/a
 
      11th Aug 2006
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....if this helps at all
--
-iwdu15
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can we declare delegates in class and can we declare delegates in Interface Bhuwan Bhaskar Microsoft Dot NET Framework 4 4th Oct 2007 05:25 AM
VBScript vs VBA. Limitations? Declare and File I/O =?Utf-8?B?RnJlZHJpa0I=?= Microsoft Outlook Form Programming 1 7th Jun 2005 10:20 PM
Code behind project and I need to declare a global veriable where do I do this since there is no .h file Bryan G Microsoft C# .NET 4 26th Mar 2004 11:53 PM
Code behind project and I need to declare a global veriable where do I do this since there is no .h file Bryan G Microsoft Dot NET 1 26th Mar 2004 08:31 PM
how to declare session variable in global.asax file khawar Microsoft ASP .NET 1 10th Jul 2003 09:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:32 PM.