• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            C++ Programmer's Cookbook

            {C++ 基礎} {C++ 高級} {C#界面,C++核心算法} {設計模式} {C#基礎}

            程序域(一個程序中調用另一個程序)

            一個exe中可以調用另一個exe,或另一個exe的方法:
            -------------用程序域實現:
            AppDomain 類用于創建和中斷應用程序域。

            1建立控制臺AssemblyA

            using System;

            namespace Wrox.ProCSharp.Assemblies.AppDomains
            {
             
            class Class1
             
            {
              
            public Class1(int val1, int val2)
              
            {
               Console.WriteLine(
            "Constructor with the values {0}, {1}" +
                
            " in domain {2} called", val1, val2,
                AppDomain.CurrentDomain.FriendlyName);
              }

              [STAThread]
              
            static void Main(string[] args)
              
            {
               Console.WriteLine(
            "Main in domain {0} called",
                AppDomain.CurrentDomain.FriendlyName);
              }

             }

            }

            產生。exe。
            2建立控制臺DomainTest
            using System;
            namespace Wrox.ProCSharp.Assemblies.AppDomains
            {
                
            class Test
                
            {
                    [STAThread]
                    
            static void Main(string[] args)
                    
            {
                        AppDomain currentDomain 
            = AppDomain.CurrentDomain;
                        Console.WriteLine(currentDomain.FriendlyName);
                        AppDomain secondDomain 
            = 
                            AppDomain.CreateDomain(
            "New AppDomain");
                    
            //    secondDomain.ExecuteAssembly("AssemblyA.exe");
                        secondDomain.CreateInstance("AssemblyA"
                            
            "Wrox.ProCSharp.Assemblies.AppDomains.Class1"true,
                            System.Reflection.BindingFlags.CreateInstance,
                            
            nullnew object[] {73}nullnullnull);

                    }

                }

            }

            結果:
            DomainTest.exe
            Constructor with the values 7, 3 in domain New AppDomain called
            Press any key to continue

            DomainTest.exe
            Constructor with the values 7, 3 in domain New AppDomain called
            Press any key to continue


            ---------------------用程序集的反射也可以實現一個exe調用另一個exe的方法!
            :system.Type 可以訪問任何給定的數據類型的信息
            :system.Assembly訪問給定程序集的元數據,也可以加載和執行程序集的方法

            posted on 2006-01-05 16:38 夢在天涯 閱讀(1354) 評論(1)  編輯 收藏 引用 所屬分類: C#/.NET

            評論

            # re: 程序域(一個程序中調用另一個程序) 2006-04-19 10:55 夢在天涯

            上面第一個的exe必須放在第二個的bin\下


            secondDomain.ExecuteAssembly("AssemblyA.exe");調用其main()方法.
              回復  更多評論   

            公告

            EMail:itech001#126.com

            導航

            統計

            • 隨筆 - 461
            • 文章 - 4
            • 評論 - 746
            • 引用 - 0

            常用鏈接

            隨筆分類

            隨筆檔案

            收藏夾

            Blogs

            c#(csharp)

            C++(cpp)

            Enlish

            Forums(bbs)

            My self

            Often go

            Useful Webs

            Xml/Uml/html

            搜索

            •  

            積分與排名

            • 積分 - 1804159
            • 排名 - 5

            最新評論

            閱讀排行榜

            97久久国产亚洲精品超碰热| 亚洲国产精品一区二区久久hs| 亚洲va久久久噜噜噜久久狠狠| 久久亚洲春色中文字幕久久久| 久久人人爽人人爽人人AV东京热| 国产午夜精品理论片久久影视| 久久国产影院| 久久A级毛片免费观看| 久久AAAA片一区二区| 亚洲午夜久久久久久久久电影网 | 欧美午夜A∨大片久久| 亚洲国产精品无码久久一线| 久久免费高清视频| 亚洲欧美精品一区久久中文字幕| 99久久99这里只有免费费精品| 精品久久国产一区二区三区香蕉 | 久久国产成人午夜AV影院| 国产成人久久精品一区二区三区 | 亚洲午夜久久久| 99久久99久久| 亚洲AV乱码久久精品蜜桃| 国产一区二区精品久久岳| 国产精品久久久久jk制服| 色婷婷综合久久久久中文字幕 | 天堂久久天堂AV色综合| 久久午夜无码鲁丝片午夜精品| 久久香蕉国产线看观看乱码| 久久亚洲中文字幕精品有坂深雪 | 久久精品这里只有精99品| 色综合久久久久综合体桃花网| 欧美性大战久久久久久| 久久青青国产| 久久性精品| 中文字幕精品久久久久人妻| 亚洲精品乱码久久久久久蜜桃| 观看 国产综合久久久久鬼色 欧美 亚洲 一区二区 | 亚洲国产成人久久综合碰碰动漫3d| 日产精品99久久久久久| 亚洲午夜久久久影院伊人| 亚洲国产另类久久久精品| 久久99国产精品尤物|