Exemplo n.º 1
0
 static void Main(string[] args)
 {
     try
     {
         if (!IsExist("Pos系统"))
         {
             RegPathForProductName("Pos系统"); // 注册产品路径 指定Carpabase.ocx所在路径
         }
         crReportDispatcherClass report = new crReportDispatcherClass();
         object rs = report.GetReportServiceDsp("Pos系统"); // 产品名称
         rs.GetType().InvokeMember("HidePosConfigPage", BindingFlags.InvokeMethod, null, rs, new object[] { 1 });
         rs.GetType().InvokeMember("ShowPosCfg", BindingFlags.InvokeMethod, null, rs, null);
         rs = null;
     }
     catch (Exception exception)
     {
         throw exception;
     }
     Console.WriteLine("********************Full Screen Mode********************");
     Console.ReadLine();
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            crReportDispatcherClass cl = new crReportDispatcherClass();
            //object obj = cl.GetPosDriverDsp("产品名称");
            //obj.GetType().InvokeMember("HidePosCfgPage", BindingFlags.InvokeMethod, null, obj, new object[] { 1 });
            //obj.GetType().InvokeMember("ShowPosCfg", BindingFlags.InvokeMethod, null, obj, null);

            object obj1 = cl.GetReportServiceDsp("产品名称");
            object a    = obj1.GetType().InvokeMember("ShowPosCfg", BindingFlags.InvokeMethod, null, obj1, null);

            //   MemberInfo[] m = obj.GetMethods(BindingFlags.Default);
            //  Marshal.get



            //v.GetMethod(
            // int i = Sub(1,4);
            //   Console.WriteLine(i);
            //  PosPrintTest();
            //  IReportService rs = null;
            //  GetCarpaBaseDsp1(out rs);
            //  rs.Hello();
            //string s1=   GetCarpaBaseDsp().Hello();
            //  DllInvoke dll = new DllInvoke("CarpaBase.ocx");
            //DllInvoke dll = new DllInvoke(@"E:\trd\component\PoPrintDll\Debug\PoPrintDll.dll");
            //Sub s = (Sub)dll.Invoke("Sub", typeof(Sub));
            //Console.WriteLine(s(1, 2));
            //DllGetClassObject s = (DllGetClassObject)dll.Invoke("DllGetClassObject",typeof(DllGetClassObject));
            // IntPtr dllGetClassObjectPtr = dll.Invoke1("DllGetClassObject", typeof(DllGetClassObject));
            //  DllGetClassObject dllGetClassObject =
            //    (DllGetClassObject)Marshal.GetDelegateForFunctionPointer(
            //      dllGetClassObjectPtr, typeof(DllGetClassObject));


            //  Guid clsid = new Guid("41859F87-89ED-49DD-9D18-824313D22F08");
            //  Guid rid = new Guid("0165E0CB-B4E2-4957-8AB7-8EE87D7D6174");
            //   Guid IClassFactoryGUID = new Guid("00000001-0000-0000-C000-000000000046");
            //  IntPtr ptr = new IntPtr();
            //  object o1 = Marshal.GetObjectForIUnknown(ptr);

            //  if (dllGetClassObject(ref clsid,
            //        ref IClassFactoryGUID, out ptr) == 0)
            //  {

            //   object oo = Marshal.GetUniqueObjectForIUnknown(ptr); //Marshal.GetObjectForIUnknown(ptr);
            //()
            //  object value = oo.GetType().InvokeMember("Hello", BindingFlags.InvokeMethod, null, oo, null);


            // ReportService rs = new ReportService();
            // IReportService irs = rs as IReportService;

            //   object irs = (ptr as IClassFactory).CreateInstance(irs, rid,out ptr);//Marshal.GetObjectForIUnknown(ptr);// as IReportService;
            //    irs.GetType().GetProperty("version");

            //object a =  Marshal.GetUniqueObjectForIUnknown(ptr);
            //  Type t = Type.GetTypeFromCLSID(clsid);
            // Type.GetTypeFromHandle(

            // object o = Marshal.GetUniqueObjectForIUnknown(ptr);
            //object s = o.GetType().InvokeMember("Hello", BindingFlags.Instance | BindingFlags.InvokeMethod,
            //  null,
            // o,
            //  new object[]{} );
            //(ptr as IClassFactory).CreateInstance(unk, IClassFactoryGUID,out ptr);

            // IntPtr p;
            // factory.CreateInstance(unk, IClassFactoryGUID, out p);
            //object obj = Pointer.Box(unk.ToPointer(), typeof(ReportService*));
            //Delegate dl = Marshal.GetDelegateForFunctionPointer(unk, typeof(Hello));

            //  Hello hello = (Hello)Marshal.GetDelegateForFunctionPointer(unk, typeof(Hello));
            //  hello();
            //string s = hello.Invoke();

            //  }


            Console.WriteLine("********************Full Screen Mode********************");
            Console.ReadLine();
        }