I have a class named DynamicLinkLibrary which does this:
[DllImport("kernel32.dll")]
private static extern IntPtr LoadLibrary(string fileName);
protected virtual void Load(string fileName)
{
EnsureNotDisposed();
if (LibraryHandle != IntPtr.Zero)
throw new InvalidOperationException("Library already loaded");
if (string.IsNullOrEmpty(fileName))
throw new ArgumentNullException(fileName);
LibraryHandle = LoadLibrary(fileName);
if (LibraryHandle == IntPtr.Zero)
throw new InvalidOperationException("Invalid DLL file name: " +
fileName);
FileName = fileName;
}
In WinXP this works fine, however, when I run it on Vista the result of
LoadLibrary is always IntPtr.Zero. Using a relative path (same folder) or
absolute path makes no difference. Can anyone help? This is stopping me
from migrating an app to Vista!
Thanks
Pete