|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Calling DLL atruntimeHi,
I need to call a DLL. During development, I have had no problems using "Declare" statements, but in production, I don't want to hard-code the path. I would like to read the path fron an ini file and then load the DLL. Is there a VB.NET equivalent of LoadLibrary? Thanks, Michael Hesse wrote:
> Hi, You don't need a path in the declare statement... You just need the> > I need to call a DLL. During development, I have had no problems using > "Declare" statements, but in production, I don't want to hard-code the path. > > I would like to read the path fron an ini file and then load the DLL. Is > there a VB.NET equivalent of LoadLibrary? > > Thanks, dll in the search path - and that will include the application directory or the system directory. -- Tom Shelton [MVP] Hello, Michael,
Tom's method is definitely the simplest, if you can be confident that your DLL is always on the path (or if you can manipulate the path to suit its location). On rare occasions this might not be possible. Then you might find the method proposed (apparently independently) by Mike Woodring: http://staff.develop.com/woodring and Richard Birkby http://www.codeproject.com/csharp/dyninvok.asp to be helpful. Cheers, Randy Tom Shelton wrote: Show quoteHide quote > Michael Hesse wrote: > >>Hi, >> >>I need to call a DLL. During development, I have had no problems using >>"Declare" statements, but in production, I don't want to hard-code the path. >> >>I would like to read the path fron an ini file and then load the DLL. Is >>there a VB.NET equivalent of LoadLibrary? >> >>Thanks, > > > You don't need a path in the declare statement... You just need the > dll in the search path - and that will include the application > directory or the system directory. > > -- > Tom Shelton [MVP] > Hi Randy,
It's a bit more complicated than I would hope, but certainly doable. You would think there would be a simpler way. But I will give it a shot. Thanks for the help. Michael Show quoteHide quote "R. MacDonald" <sci***@NO-SP-AMcips.ca> wrote in message news:442ccf4a$0$89514$dbd4d001@news.wanadoo.nl... > Hello, Michael, > > Tom's method is definitely the simplest, if you can be confident that your > DLL is always on the path (or if you can manipulate the path to suit its > location). > > On rare occasions this might not be possible. Then you might find the > method proposed (apparently independently) by Mike Woodring: > > http://staff.develop.com/woodring > > and Richard Birkby > > http://www.codeproject.com/csharp/dyninvok.asp > > to be helpful. > > Cheers, > Randy > > > Tom Shelton wrote: >> Michael Hesse wrote: >> >>>Hi, >>> >>>I need to call a DLL. During development, I have had no problems using >>>"Declare" statements, but in production, I don't want to hard-code the >>>path. >>> >>>I would like to read the path fron an ini file and then load the DLL. Is >>>there a VB.NET equivalent of LoadLibrary? >>> >>>Thanks, >> >> >> You don't need a path in the declare statement... You just need the >> dll in the search path - and that will include the application >> directory or the system directory. >> >> -- >> Tom Shelton [MVP] >>
Re: Store multi-choice groupbox selection in a field
DataGridView DataBinding PERFORMANCE QUESTION Serilization of custom object Select TWAIN Source (VB.NET 2005) Viewing Word Docs in Tabs Function returns two values VB 2005 variable declaration syntax Please help!?! OutOfMemoryException "AutoScroll event" in Panel |
|||||||||||||||||||||||