南雄北北

导航

用反射调用dll带参数的方法

   try

{

    System.Reflection.Assembly asm = System.Reflection.Assembly.LoadFrom(Application.StartupPath + "\\" + "EMR_iCareComponent.dll");
      object obj = asm.CreateInstance("iCare.clsEMRLogin");
      Type type = obj.GetType();
       System.Reflection.MethodInfo mi = type.GetMethod("m_mthInit");
     mi.Invoke(obj, new object[] { frmHRPExplorer.s_objMDIParent, frmHRPExplorer.CurrentLoginInfo });

}

catch (Exception ex)
            {
                string str = "iCare.clsEMRLogin初始化错误:" + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine;
                Exception e = ex.InnerException;
                while (e != null)
                {
                    str = e.Message + Environment.NewLine + e.StackTrace + Environment.NewLine;
                    e = e.InnerException;
                }
                new com.digitalwave.Utility.clsLogText().LogError(str);
            }

posted on 2010-05-21 11:12  南雄北北  阅读(291)  评论(0编辑  收藏  举报