No, because #import is a compile-time directive, and just causes the compiler to generate .thi and .tli files for you. It is not something that exists at run-time.
Is there some reason why you need to know the physical location of the type library at run-time, rather than just compiling it in with #import at compile-time?
The reason I want to change the path at runtime is that
windows drive is not c: on all user's computers , so I can't
simply use c:\progra~1\common~1\system\ado\msado15.dll and
as far as I know msado15.dll must be at the same location
at runtime as it was at compile - time ,otherwise an invalid pointer error is generated.
No, msado15.dll doesn't need to be in the same location at runtime as compile time. Otherwise, wouldn't everyone have to use the same drive letter for ADO to work, since most people don't compile programs that use ADO, they use programs compiled for them by others?
I've copied msado15.dll in c:\program and compiled the project with #import "c:\program\msado15.dll" .It worked.If I run the program outside VC++ an invalid pointer error appeared , unless I run regsvr32 c:\program\msado15.dll .
This behaviour is normal, since msado15.dll is a COM server and requires registration (Microsoft ActiveX Data Objects) so you need to register this component onto the targeted system before running your application. Be carefull though, since the component could already be registered onto that specific (targeted) system (regsvr32-ing it again will unregister the previous MS ADO component).
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.