public int Load(string dllfile) { this.m_hinst = CDD.LoadLibrary(dllfile); if (this.m_hinst.Equals(IntPtr.Zero)) { MessageBox.Show("Error while loading library, code=" + CDD.GetLastError().ToString()); return(-2); } return(this.GetDDfunAddress(this.m_hinst)); }
private int GetDDfunAddress(IntPtr hinst) { IntPtr procAddress = CDD.GetProcAddress(hinst, "DD_key"); this.key = (Marshal.GetDelegateForFunctionPointer(procAddress, typeof(CDD.pDD_key)) as CDD.pDD_key); if (procAddress.Equals(IntPtr.Zero)) { return(-1); } return(1); }