|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DllImport attributeHow I can write somthing like this:
[DllImport("%ProgramFiles%\\aaa.dll")] where %ProgramFiles% - some DOS variable? >How I can write somthing like this: You can't. What you can do instead is is to just use>[DllImport("%ProgramFiles%\\aaa.dll")] > >where %ProgramFiles% - some DOS variable? [DllImport("aaa.dll")], and then explicitly load the DLL with LoadLibrary before using it. Mattias -- Mattias Sjögren [C# MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup. > Oh! Sorry for stupid question... Can you show me how I can do this? > >How I can write somthing like this: > >[DllImport("%ProgramFiles%\\aaa.dll")] > > > >where %ProgramFiles% - some DOS variable? > > You can't. What you can do instead is is to just use > [DllImport("aaa.dll")], and then explicitly load the DLL with > LoadLibrary before using it. Something like this doesn't work correct... [DllImport("kernel32.dll")] static extern IntPtr LoadLibrary(string lpFileName); [DllImport("aaa.dll")] static extern void bbb(); void main() { IntPtr lib = LoadLibrary("C:\\Program Files\\...Some path...\\aaa.dll"); bbb(); } |
|||||||||||||||||||||||