http://blog.csdn.net/jingzhongrong/archive/2008/05/08/2416623.aspx
调用代码来自他这里.我在winform里测试成功了.但是在asp.net下不成功.    int hModule = InvokeHelper.LoadLibrary(@"Express.dll");
            if (0 != hModule)
            {
             }
            else
            {
                return -1;            
}代码就是上边这样.咋总返回-1?我把Express.dll放在bin下边了.想是这样才出错.所以改成
int hModule = InvokeHelper.LoadLibrary(@"D:\project\cha66\Site\Bin\Express.dll");但还是不能成功.我又放到system32了.还是不行.哪位有做过类似的?你们咋解决的啊?public static class InvokeHelper
    {
        [DllImport("Kernel32")]
        public static extern int GetProcAddress(int handle, String funcName);        [DllImport("Kernel32")]
        public static extern int LoadLibrary(String fileName);        [DllImport("Kernel32")]
        public static extern int FreeLibrary(int handle);        ///<summary>
    ///通过非托管函数名转换为对应的委托, by jingzhongrong
    ///</summary>
    ///<param name="dllModule">通过LoadLibrary获得的DLL句柄</param>
    ///<param name="functionName">非托管函数名</param>
    ///<param name="t">对应的委托类型</param>
    ///<returns>委托实例,可强制转换为适当的委托类型</returns>
    public static Delegate GetFunctionAddress(int dllModule, string functionName, Type t)
    {
       int address = GetProcAddress(dllModule, functionName);
       if (address == 0)
           return null;
       else
           return Marshal.GetDelegateForFunctionPointer(new IntPtr(address), t);
    }
 
    ///<summary>
    ///将表示函数地址的IntPtr实例转换成对应的委托, by jingzhongrong
    ///</summary>
    public static Delegate GetDelegateFromIntPtr(IntPtr address, Type t)
    {
       if (address == IntPtr.Zero)
           return null;
       else
           return Marshal.GetDelegateForFunctionPointer(address, t);
    }
 
    ///<summary>
    ///将表示函数地址的int转换成对应的委托,by jingzhongrong
    ///</summary>
    public static Delegate GetDelegateFromIntPtr(int address, Type t)
    {
       if (address == 0)
           return null;
       else
           return Marshal.GetDelegateForFunctionPointer(new IntPtr(address), t);
    }
        //本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/jingzhongrong/archive/2008/05/08/2416623.aspx
    }