• <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 夢在天涯 閱讀(1361) 評論(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

            搜索

            •  

            積分與排名

            • 積分 - 1807518
            • 排名 - 5

            最新評論

            閱讀排行榜

            久久婷婷是五月综合色狠狠| 久久精品国产免费一区| 国产91久久综合| 久久夜色撩人精品国产| 欧美精品九九99久久在观看| 久久这里都是精品| 久久久久亚洲av无码专区| 91精品国产高清久久久久久国产嫩草 | 99精品国产在热久久| 狠狠色丁香久久综合婷婷| 欧美激情精品久久久久久| 国产∨亚洲V天堂无码久久久| 久久久久亚洲?V成人无码| 伊人久久无码精品中文字幕| 久久免费视频网站| 亚洲精品无码久久一线| 久久精品国产第一区二区| 漂亮人妻被黑人久久精品| 久久午夜综合久久| 久久亚洲国产中v天仙www| 久久久国产一区二区三区| 久久久久久精品久久久久| 国产欧美久久一区二区| 日本WV一本一道久久香蕉| 99久久精品国产一区二区| 99久久国产宗和精品1上映| 97精品伊人久久久大香线蕉| 久久精品夜夜夜夜夜久久| 一级a性色生活片久久无少妇一级婬片免费放 | 久久久久亚洲?V成人无码| 久久亚洲AV成人无码电影| 久久无码AV中文出轨人妻| 日韩精品无码久久一区二区三| 国产成人精品久久综合 | 91久久婷婷国产综合精品青草 | …久久精品99久久香蕉国产| 亚洲AV日韩AV永久无码久久| 亚洲va中文字幕无码久久| 久久99热这里只频精品6| 午夜人妻久久久久久久久| 亚洲一级Av无码毛片久久精品|