SharpDevelop 界面


SharpDevelop 安裝注意事項
*安裝前： 先安裝
.NET Framework SDK Version 1.1 (用於開發人員)
http://www.microsoft.com/downloads/details.aspx?FamilyId=9B3A2CA6-3647-4070-9F41-A333C6B9181D&displaylang=en
或 Microsoft .NET Framework 1.1 可轉散佈品(執行時期的SDK，用於客戶端)
http://www.microsoft.com/downloads/details.aspx?FamilyId=262D25E3-F589-4842-8157-034D1E7CF3A3&displaylang=en

*開始執行: SharpDevelop安裝程式

*如果你有前一版的SharpDevelop，請先刪除“.ICSharpCode”資料夾，
此資料夾在使用者application data資料夾中。
*第一次使用：依據畫面，先建立資料庫
注意事項：若不建立資料庫，則無法實現以下功能：
1.程式碼自動提示視窗。
2.表單視窗設計編輯，將不會顯示。


SharpDevelop 技巧提示
Topic | Issue
New Class Wizard | Maintain or write a new New Class wizard (see new src\AddIns\Wizards\NewClassWizard and new file dialog)
Pretty Printer | Finish the pretty printer (see SharpRefactory in src\Libraries\SharpRefactory)
Optimize addin-tree loading speed | Currently XML DOM is used to load the addin tree but using the XmlTextReader directly would speed up the loading if you want to take this job see the Core in src\Main\Core)
Optimize project loading speed | Currently XML DOM is used to load the projects and combines but using the XmlTextReader directly would speed up the loading if you want to take this job see the Base project in src\Main\Base (especially Internal\Project)
Debugger | Help us with the debugger. We have started a debbug but we need help. C++ skills are required. For a debugger example look in the Microsoft.NET/SDK/v1.1/Tool Developers Guide/Samples/debugger directory. But don't take ANY code from there (licensing problems).
Subversion plugin | Subversion is a version control system that is used for the #develop development. But we need a plugin for that. Don't wrap the command line client instead use the subversion libraries. There is already a project for Visual Studio.NET called Ankh you should take their NSvn sources. The Ankh plugin and the underlying Subversion interop sources should be a good starting point.
Project Converter | Write a C# Builder project converter. You can plug in into the project converter infrastructure. (see src\AddIns\Misc\ProjectImporterExporter)
Backend Bindings | Maintain the Java backend binding
Translation | Help to translate #D contact Christoph Wille, christophw@alphasierrapapa.com regarding this issue (even report spelling errors)
ReportBugs | If you find bugs report them to Mike Krueger, mike@icsharpcode.net try to report the same bug again and again this increases the chance that it gets done sooner


SharpDevelop RC2的BUG注意：
1.「AxImp.exe轉換COM元件」為NET視覺元件，使用時，
視窗設計與程式碼編輯器切換，會造成「NET視覺元件」，
被移除現象。
解決方式：不儲存，關閉專案，在開啟。
若切換至程式碼編輯器，則會被修改，無該視覺元件。
2.「AxImp.exe轉換COM元件」為NET視覺元件安裝後，
因SharpDevelop RC2開啟新專案或SharpDevelop RC2關閉，
找不到NET視覺元件的錯誤訊息出現。
解決方式：
(a)輕微：SharpDevelop RC2關閉，再開啟即可。
(b)持續錯誤：SharpDevelop RC2開啟元件管理，移除元件後，
關閉 SharpDevelop RC2，再開啟。
(表示該元件，建議不以視覺化元件方式使用！)
3.SharpDevelop RC2專案命名，英文字之間建議不使用空白字元，
會造成無法編譯現象。
4.SharpDevelop RC2程式碼編輯器，復原功能，不能太多次，
亦造成程式碼混亂。

其他問題，可以到此先問問看：
 http://www.icsharpcode.net/OpenSource/SD/Forum/forum.asp?FORUM_ID=25

或
Windows Forms ActiveX Control Importer (Aximp.exe)
 http://msdn.microsoft.com/library/en-us/cptools/html/cpgrfWindowsFormsActiveXControlImporterAximpexe.asp

或
Cannot Add ActiveX Control to Toolbox
 http://support.microsoft.com/default.aspx?scid=kb;en-us;320780

該網站的#D原始碼，可用#D開啟...亦可參考
 http://www.icsharpcode.net/OpenSource/SD/


用 NDoc 來產生文件

NDOC- http://ndoc.sourceforge.net/ 是一個幫助你把 xx.dll 以及 xx.dll.xml 這兩個檔案 或者是從vs.net.sln中導入 來產生線上文件和 xx.chm 的工具。

基本的用法是在 #D 的專案屬性裡，編譯那裡選擇文件輸出為 xx.dll.xml ，然後編譯。那麼程式中的註解編譯後就成 xx.dll.xml 了。

用 NDOC Add 這個 xx.dll 和 xx.dll.xml 然後修改下面的一些選項，就可以compile了。通常這個會編譯到一個單獨的 doc\ 中。裡面有一打堆的 .html 和 .hhp 等一些檔案 。 當然還有 xx.chm 檔案（要先安裝 HTMLHELP ）。

效果如下：

http://www.contextboundmodel.net/doc/index.html

編譯出來的chm如下

http://www.contextboundmodel.net/doc/cbm.chm


什麼是Unit Tests(單元測試)？

簡單點說，單元測試就是測試代碼撰寫者依據其所設想的方式執行是否產生了預期的結果。

在程式設計過程中會有許多種測試，單元只是其中的一種，單元測試並不能保證程式是完美無缺的，但是在所有的測試中，單元測試是第一個環節，也是最重要的一個環節。單元測試是一種由程式師自行測試的工作。

NUnit是一個為Net準備的自動化單元測試框架，它的作用就是幫助你方便的完成單元測試工作，同鼎鼎有名的JUnit一樣，都是xUnit家族的成員。它的下載位址是：http://www.nunit.org。它的兄弟姐妹還有：nunitasp: http://nunitasp.sourceforge.net( for Asp.Net) 和csUnit

NUnit Framework(NUnit 單元測試框架)簡介

NUnit 2.1是非常不一樣的版本。其他的xUnit家族版本通常都有一個base class（基礎類），你要寫的test classes(測試用例)都得inherit(繼承)自這個base class。不幸的是，這對很多的程式語言來說就造成很大的限制。比如說，Java及C#就只能允許single inheritance(單一繼承)。也就是說，如果你想要refactor(重構)你的Unit Tests程式碼的話，你會遇到一些的限制；除非你引進一些複雜的inheritance hierarchies(類別繼承層級)。

有了.NET之後一切又不同了，.NET引進了一個新的程式開發的概念 ─ Attributes(屬性)，解決了這個煩人的問題。Attributes讓你可以在你的程式碼之上再加入metadata(元資料，描述程式碼的資料)。一般來說Attributes不會影響到主要程式碼的執行，其功能是在你所寫程式碼之上添加了額外的資訊。Attributes主要使用在documenting your code(注釋你的程式碼)，但是Attributes也可以用來提供有關Assembly的額外資訊，其他的程式就算沒有見過這個Assembly，也可以使用這些資訊。這基本上就是NUnit 2.1所作的事。

在NUnit 2.1有一個Test Runner Application(負責執行Unit Tests的程式)，這個Test Runner會掃描你已經compile(編譯)好的程式碼，並且從Attribute?堶悸器D哪些classes是test classes，哪些methods是需要執行的test methods. 然後，Test Runner使用.NET的Reflection技術（在.NET Framework中提供了System.Reflection命名空間，這樣就使得我們可以方便的獲得.NET元件的資訊。當你想獲得正在使用的元件的詳細資訊，或者在運行期間查詢一個元件資訊的時候，這個功能將變的十分有用）來執行這些test methods。因為這個原因，你就不再需要讓你的test classes繼承自所謂的common base class。你唯一需要作的事，就是使用正確的Attribute來描述你的test classes及test methods。

NUnit提供了許多不同的attributes，讓你可以自由的寫你想要的unit tests。這些attributes可以用來定義test fixtures(見下一段解釋)、test methods，以及setup及teardown的methods(預備及善後工作的methods)。除此之外，還有其他的attributes可以來設定預期發生的exceptions，或者要求Test Runner跳過某些test method不執行。

TestFixture Attribute簡介
TestFixture attribute主要是用在class上，其作用是標誌該class含有需要執行的test methods。當你在一個class的定義里加上這個attribute，Test Runner就會檢查該class，看看這個class是否含有test methods。底下這段程式碼示範了如何使用TestFixture Attribute。(本文中所有程式碼都是用C#寫成，但是你應該知道，NUnit也是用於其他的.NET程式語言，包括VB.NET。請參見NUnit的相關檔。

namespace UnitTestingExamples
{
using System;
    using NUnit.Framework;
[TestFixture]
    public class SomeTests
    {
    }
}

使用TextFixture Attribute的class需要符合另一項唯一附加的限制，就是需要有一個public的default constructor(或者是沒有定義任何的constructor，這其實是相同的意思)。

TestFixtureSetUp 和TestFixtureTearDown簡介

這兩個主要用在TestFixture?堶情A其作用是提供一組函數執行任何測試運行之前（TestFixtureSetUP）和最後一個測試執行後（TestFixtureTearDown）。每一個TestFixture只能有一個TestFixtureSetUp方法和TestFixtureTearDown方法。如果一個以上的TestFixtureSetUp和TestFixtureTearDown方法，可以通過編譯但是不會執行。注意一個TestFixture可以擁有一個TestFixtureSetUp和一個SetUp，也可以擁有一個TestFixtureTearDown和一個TearDown方法。
TestFixtureSetUp 和 TestFixtureTearDown 被用在不方便使用SetUp和TearDown方法。

一般情況使用 SetUp 和TearDown attributes。

底下這段程式碼示範了如何使用TestFixtureSetUp/TestFixtureTearDown

namespace UnitTestingExamples
{
using System;
    using NUnit.Framework;
[TestFixture]
public class SomeTests
{
[TestFixtureSetUp]
public void RunBeforeAllTests()
{
Console.WriteLine( “TestFixtureSetUp” );
}
[TestFixtureTearDown]
public void RunAfterAllTests()
{
Console.WriteLine( “TestFixtureTearDown” );
}
[SetUp]
public void RunBeforeEachTest()
{
Console.WriteLine( “SetUp” );
}
[TearDown]
public void RunAfterEachTest()
{
Console.WriteLine( “TearDown” );
}
[Test]
public void Test1()
{
Console.WriteLine( “Test1” );
}
}
}

程式的輸出將是下面的結果：

TestFixtureSetUp
SetUp
Test1
TearDown
SetUp
Test2
TearDown
TestFixtureTearDown

如果Test2單獨執行輸出的結果將是：

TestFixtureSetUp
SetUp
Test2
TearDown
TestFixtureTearDown

Test Attribute簡介

Test attribute主要用來標示在text fixture中的method，表示這個method需要被Test Runner application所執行。有Test attribute的method必須是public的，並且必須return void，也沒有任何傳入的參數。如果沒有符合這些規定，在Test Runner GUI之中是不會列出這個method的，而且在執行Unit Test的時候也不會執行這個method。上面的程式碼示範了使用這個attribute的方法。

SetUp 和 Teardown Attributes簡介

在寫Unit Tests的時候，有時你會需要在執行每一個test method之前(或之後)先作一些預備或善後工作。當然，你可以寫一個private的method，然後在每一個test method的一開頭或最末端呼叫這個特別的method。或者，你可以使用我們要介紹的SetUp及Teardown Attributes來達到相同的目的。如同這兩個Attributes的名字的意思，有Setup Attribute的method會在該TextFixture中的每一個test method被執行之前先被Test Runner所執行，而有Teardown Attribute的method則會在每一個test method被執行之後被Test Runner所執行。一般來說，Setup Attribute及Teardown Attribute被用來預備一些必須的objects(物件)，例如database connection、等等。上面的程式碼示範了使用這個attribute的方法。

ExpectedException Attributes簡介

有的時候，你希望你的程式在某些特殊的條件下會產生一些特定的exception。要用Unit Test來測試程式是否如預期的產生exception，你可以用一個try..catch的程式區段來catch(捕捉)這個exception，然後再設一個boolean的值來證明exception的確發生了。這個方法固然可行，但是太花費功夫。事實上，你應該使用這個ExpectedException attribute來標示某個method應該產生哪一個exception，如同下面的範例所示：

namespace UnitTestingExamples
{
    using System;
    using NUnit.Framework;
[TestFixture]
    public class SomeTests
    {
   [Test]
   [ExpectedException(typeof(InvalidOperationException))]
        public void Test1()
   {
            // Do something that throws an InvalidOperationException
        }
}
}

如果上面的程式被執行的時候，如果一旦exception發生，而且這個exception的type(類型資訊)是InvalidOperationException 的話，這個test就會順利通過驗證。如果你預期你的程式碼會產生多個exception的話，你也可以一次使用多個ExpectedException attribute。但是，一個test method應該只測試一件事情，一次測試多個功能是不好的做法，你應該儘量避免之。另外，這個attributes並不會檢查inheirtance的關係，也就是說，如果你的程式碼產生的exception是繼承自InvalidOperationException 的subclass(子類化)的話，這個test執行的時候將不會通過驗證。簡而言之，當你使用這個attribute的時候，你要明確的指明所預期的exception是哪個type(類型資訊)的。

Ignore Attributes簡介
這個attribute你大概不會經常用的，但是一旦需要的時候，這個attribute是很方便使用的。你可以使用這個attribute來標示某個test method，叫Test Runner在執行的時候，略過這個method不要執行。使用這個Ignore attribute的方法如下：

namespace UnitTestingExamples
{
    using System;
    using NUnit.Framework;

    [TestFixture]
    public class SomeTests
    {
        [Test]
        [Ignore("We're skipping this one for now.")]
        public void TestOne()
        {
            // Do something...
        }
    }
}

如果你想要暫時性的comment out一個test method的話，你應該考慮使用這個attribute。這個attribute讓你保留你的test method，在Test Runner的執行結果?堶情A也會提醒你這個被略過的test method的存在。

NUnit Assert Class簡介
除了以上所提到的這些用來標示測試程式所在的attributes之外，NUnit還有一個重要的class你應該要知道如何使用。這個class就是Assert class。Assert class提供了一系列的static methods，讓你可以用來驗證主要程式的結果與你所預期的是否一樣。Assert class代替了舊的Assertion class，下面是這個類的方法：

Assert.IsTrue( bool );
Assert.IsFalse( bool );
Assert.IsNull( bool );
Assert.IsNotNull( bool );
Assert.AreSame( object, object )
Assert.AreEqual( object, object );
Assert.AreEqual( int, int );
Assert.AreEqual( float, float, float );
Assert.AreEqual( double, double, double );
Assert.Fail();

使用這個類的示例如下：

namespace UnitTestingExamples
{
    using System;
    using NUnit.Framework;

    [TestFixture]
    public class SomeTests
    {
    [Test]
    public void TestEventLengthString()
    {
      // Should return true
      bool bResult1 = Class1.CheckPalindrome("ABCCBA");
      Assert.IsTrue(bResult1);
      // Should return false
      bool bResult2 = Class1.CheckPalindrome("ABCDBA");
      Assert.IsFalse(bResult2);
    }
    [Test]
    public void TestOddLengthString()
    {
      //should return true;
      Assert.IsTrue(Class1.CheckPalindrome("ABCDCBA"));
      // Should return false
      Assert.IsFalse(Class1.CheckPalindrome("ABCDEBA"));
    }
}
}

執行你的Tests

好，現在我們已經討論過寫Unit Tests的基本步驟及方法，現在讓我們來看看如何執行你所寫的Unit Tests。事實上非常簡單。NUnit?堶惘釣潃茪w經寫好的Test Runner applications：一個是視窗GUI程式，一個是console XML(命令列)程式。你可以自由選擇你所喜歡的方式，基本上是沒有什麼差別的。
如果你要使用視窗GUI的Test Runner app，你只需要執行該程式，然後告訴它你要執行的test method所在的assembly位置。這個包含有你所寫test methods的assembly是那一個class library(或是executable，*.dll或*.exe) assembly，其中含有前面談到的Test Fixtures。當你告訴Test Runner你的assembly所在的位置，Test Runner會自動load這個asembly，然後把所有的class及test methods都列在視窗的左欄。當你按下’Run’按鍵時，你就會自動執行所有列出來的test methods。你也可以double click其中的一個test class，或是一個test method之上，這樣會自動只執行該class或是該method。
底下是視窗GUI Test Runner執行時的樣子：

在一些的情況下，特別是你想要在你自己寫的build script中加入Unit Testing的情況下，你大概不會使用GUI Test Runner。在這個自動執行build script的情況下，你一般會把你build的結果貼在網頁，或寫入log file?堶惘s作紀錄，以供程式開發人員、經理或是客戶可以藉由檢查這個紀錄知道詳細情況。在這個情況，你可以用NUnit 2.1的console Test Runner application。這個Test Runner可以傳入assembly的位置當參數，其測試執行結果是一個XML字串。你可以用XSLT或是CSS把這個XML結果轉換成HTML，或是其他你想要的格式。如果你需要用到這個功能的話，請查看NUnit檔中有關console Test Runner application的資料。


Web Development with SharpDevelop, Web Matrix, and DBGCLR

(SharpDevelop與Web Matrix和DBGCLR一起寫ASP.NET)

Visual Studio.NET 2003 makes development a whole lot easier than it ever was before.  But what if you have to develop a web application and you do not have the power of VS.NET 2003 available to you?

I would hate to be without Intellisense (I’m spoiled), debug support, and many of the other features that VS.NET 2003 provides.  There is a way to accomplish this developmental challenge with the following three tools:

SharpDevelop , the free open source .NET IDE, has just been released as Fidalgo RC1 (6/16/2004).  This development environment does not support debugging, or ASP.NET development.  However, SharpDevelop is a great product and it is worth getting excited about.

SharpDevelop’s IDE is very similar to VS.NET 2003; it even has a version of Intellisense.  I felt right at home here.

Web Matrix , the free ASP.NET IDE was released by Microsoft to support ASP.NET development.  This IDE does not support debugging, Windows development, Intellisense, and many other niceties of Visual Studio.NET 2003.

DebugCLR (DbgCLR.exe) is available in the .NET Framework SDK or with Visual Studio.  This tool allows the developer to step into managed code without the need of Visual Studio.NET.

Code snippets in this example are in C#, but can be modified for VB.NET.

Configuring the Solution in SharpDevelop

SharpDevelop has a similar notion of a solution called Combines.  These combines can contain multiple projects.

I’ve created a project folder for SharpDevelop here: C:\Projects_SharpDevelop and set my default location to this directory from Tools > Options:

Adding a combine:

File > New Combine:

Select a C#, or VBNET Class Library project and call it WebDemo2:

SharpDevelop will create a new class file called MyClass.cs by default.  Delete this file, we will not use it.

This next step is very important.  Set the project output path to C:\Projects_SharpDevelop\WebDemo2\bin.  The bin folder may not exist, so you will need to create it.  To accomplish this, right click on the project, select Project Options > Configurations > Output and set the output path.

Next, add a new file to the project by right clicking on the WebDemo2 project, Add >New File:

Choose a new C# or VB.NET file (depending on what type of Combine you’ve created) and call it MyCodeBehindClass.aspx.cs.

Drop the .aspx from the class name.  This class should inherit from Page.  It should look like this:

Delete the constructor.  It is not needed.

Add the following using statements:

and the following code:

Press F8 to build the Combine.

Configuring the Solution in Web Matrix

Open Web Matrix.

To create a new project which is essentially a shortcut to the directory, click File > New Project and choose Folder ShortCut:

Enter the directory path that points to the SharpDevelop Combine: C:\Projects_SharpDevelop\WebDemo2.

You will notice a new shortcut is created in the Workspace sidebar on the right.  Expand the shortcut to see the files that exist from SharpDevelop.

Create a new aspx file.  Right click the shortcut and click Add New File, select ASP.NET Page, and name it MyWebForm.aspx:

Next, click the “All” tab at the bottom of the new file, and replace the existing page directive with this one:

This directive can be all in one line.  I wrapped it for this walk through.

Click the “Design” tab at the bottom and drag on a TextBox by expanding the web control's group and selecting the TextBox control from the toolbar to your left.

Click on the play icon on the toolbar or press F5.  Make sure the web path is the same as the Combine location:

I am using the built-in web server provided by Web Matrix (this will display an icon in the taskbar).  You can also use IIS.  This is the main reason we changed the output path of the project.  The web application expects the dlls to be in a bin directory, not bin\debug or bin\release.

The page will run and display the TextBox with the string set in the SharpDevelop class file:

LEAVE THE BROWSER OPEN FOR DEBUGGING

Debugging the Combine

To debug the application, launch DbgCLR.exe.  The quickest way to find this application is to do a search.  If you have VS.NET 2003 installed, the default location is: C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\GuiDebug\DbgCLR.exe.

Open the MyCodeBehindClass.aspx.cs from File > Open > File or CTLR+O.

Set a break point on the following line:

Next, choose the process to step into.  If you are running this example in IIS, choose the aspnet_wp.exe process.  If you are using the Web Matrix web server, choose WebServer.exe.

Click Tools > Debug Processes or CTLR+ALT+P and choose the appropriate process to step into and click Select.  Then close.

Now, refresh the web browser.  You will be taken to the break point:

Why do this?  I always have had this fascination with doing things the hard way.  If you’re anything like me, you might do this just because you can.

Take some time to get familiar with SharpDevelop and Web Matrix.  They both have their own feel.

Additional resources:

SharpDevelop:
 http://www.sharpdevelop.com/OpenSource/SD/WhatsNew.aspx
http://www.sharpdevelop.com/OpenSource/SD/Forum/

Web Matrix:
 http://www.asp.net/webmatrix/faq.aspx
http://www.asp.net/Forums/ShowForumGroup.aspx?tabindex=1&ForumGroupID=4


SharpDevelop .NET 官方下載網站與中文化
#develop (short for SharpDevelop) .NET免費開發工具-多國語言版
官方網站：
 http://www.icsharpcode.net/OpenSource/SD/

#develop (short for SharpDevelop) is a free IDE for C# and VB.NET
projects on Microsoft's .NET platform.

SharpDevelop RC2/3 開發工具-繁體中文修正檔
http://delphi.ktop.com.tw/topic.asp?TOPIC_ID=54279
SharpDevelop RC3 開發工具-繁體中文修正檔(第1次修正)
http://delphi.ktop.com.tw/topic.asp?TOPIC_ID=55374
除覆蓋BIG5修正檔以外，在IDE環境選項，修改
程式碼編輯器設定：檔案編碼-->選擇編碼：繁體中文(Big5)


網路學習資源
  • Windows Forms .NET官方網站
  • Longhorn SDK
  • C# Tutorial
  • C# Station Tutorial
  • .NET 247
  • DOBON.NET [日本網站]
  • WoodenSoldier Software [日本網站]
  • TWP .NET User Group
  • Move to .NET User Group
  • Microsoft C#程式語言和通用語言架構CLI通過ISO/IEC標準認證
  • ECMA-334 C# Language Specification
  • ECMA and ISO/IEC C# and Common Language Infrastructure Standards
  • MSDN C# Language Specification
  • .NET Framework 首頁
  • Microsoft Visual C# .NET 首頁
  • Microsoft ASP.NET 快速入門教學課程
  • Web Services介紹
  • 別再掉進DLL地獄的陷阱裡(DLL Hell)~.NET解決之道
  • 利用ASP.NET Web Matrix Project開發Web應用程式
  • C#(C Sharp)的語法到底比較像C++還是Java
  • 藍色小舖討論區 C#(ASP.NET) 討論區
  • 微軟技術社群
  • 是否能讓JAVA 和 .NET框架共存
  • 新一代分散式應用軟體架構－.NET
  • LabMice.net


何謂 Combine
Combine程式中以「合併」稱呼，但亦可稱謂「方案總管」，
就是各個小專案的統合管理，它是SharpDevelop的「MetaFile」。


SharpDevelop-自制MDI範本(MDIFormsProject.xpt)
儲存位置 C:\Program Files\SharpDevelop\data\templates\project\CSharp
範本內容如下：

<?xml version="1.0"?>
<Template originator   = "Mike Krueger"
          created      = "06/10/2001"
          lastModified = "02/01/2003">

    <!-- Template Header -->
    <TemplateConfiguration>
        <Name>${res:Templates.Project.WindowsApplication.Name}(MDI)</Name>
        <Category>C#</Category>
        <Icon>C#.Project.Form</Icon>
        <LanguageName>C#</LanguageName>
        <Description>${res:Templates.Project.WindowsApplication.Description}(MDI)</Description>
    </TemplateConfiguration>

    <!-- Actions -->
    <Actions>
        <Open filename = "MDIForm.cs"/>
    </Actions>

    <Combine name = "${ProjectName}" directory = ".">
        <Options>
            <StartupProject>${ProjectName}</StartupProject>
        </Options>

        <Project name = "${ProjectName}" directory = ".">

            <Options Target = "WinExe" PauseConsoleOutput = "False" />

            <Files>
                <File name="MDIForm.cs"><![CDATA[${StandardHeader.C#}
using System;
using System.Windows.Forms;

namespace DefaultNamespace
{
    /// <summary>
    /// Description of MDIForm.
    /// </summary>
    public class MDIForm : System.Windows.Forms.Form
    {
        public MDIForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
            //===new ChildForm===
            //Form1 ChildForm=new Form1();
            //ChildForm.MdiParent=this;
            //ChildForm.Show();
        }

        [STAThread]
        public static void Main(string[] args)
        {
            Application.Run(new MDIForm());
        }

        #region Windows Forms Designer generated code
        /// <summary>
        /// This method is required for Windows Forms designer support.
        /// Do not change the method contents inside the source code editor. The Forms designer might
        /// not be able to load this method if it was changed manually.
        /// </summary>
        private void InitializeComponent()
        {
            //
            // MDIForm
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(292, 266);
            this.Text = "MDIForm";
            this.Name = "MDIForm";
            this.IsMdiContainer=true;
        }
        #endregion
    }
}]]></File>
        <File name="AssemblyInfo.cs">
            <![CDATA[using System.Reflection;
using System.Runtime.CompilerServices;

// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.

[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):

[assembly: AssemblyVersion("1.0.*")]

// The following attributes specify the key for the sign of your assembly. See the
// .NET Framework documentation for more information about signing.
// This is not required, if you don't want signing let these attributes like they're.
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
]]></File>
            </Files>
        </Project>
    </Combine>
</Template>

使用說明：
MDIForm建立後，在建立Form1，
MDIForm設定如下，來開啟Form1子視窗：
//===new ChildForm===
Form1 ChildForm=new Form1();
ChildForm.MdiParent=this;
ChildForm.Show();

================================
■Form1子視窗，使用時看成物件，
用完記得釋放！
SharpDevelop-範本(***.xpt)
範本編修時不能用中文..使用時，會出現錯誤！


[SharpDevelop] VC7(VS2003)的sln專案與SharpDevelop 的cmbx專案之互相轉換

一、將VC7(VS2003)的sln專案轉成SharpDevelop 的cmbx專案：
1.開啟SharpDevelop
2.選擇 檔案選單-->匯入專案(Import Project)
3.專案匯入(project to import)：選擇sln檔
4.輸出路經(Output location) ：選擇cmbx專案儲存的資料夾
5.按「Start按鈕」開始轉換
6.完成

二、將SharpDevelop 的cmbx專案轉成VC7(VS2003)的sln專案：
1.開啟SharpDevelop
2.選擇 檔案選單-->匯出專案(Export Project)
3.輸出路徑(Output location)：選擇sln專案儲存的資料夾
4.輸出格式(Output format) ：預設轉換的類型
5.輸出選項設定(Export)：選擇所需的轉換方式(單一專案或全部專案)
6..按「Start按鈕」開始轉換
4.完成
程式碼以外，參考到的DLL，在編譯前，記得加入到專案的「參考」中。


在部署專案中加入.NET framework
如果你想要在你的Visual Studio .NET 安裝和部署專案中包含 .NET Framework，請參照下面的範例：

Microsoft .NET Framework Setup.exe Bootstrapper Sample

 http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/MSDN-FILES/027/001/830/msdncompositedoc.xml

你可以在 Microsoft 網站上下載 .NET Framework，你也可以在Visual Studio .NET 安裝媒體中找到，關於 .NET Framework redistributable package 的進一步資訊，請參考下面的文件：
 308488 INFO: Download and Install the .NET Framework


把.NET程式部署到沒有安裝.NET Framwork的機器上
摘要
本文討論了如何使用Windows Installer技術發佈.NET程式，以及如何使用native程式碼判斷目標機器上是否安裝有.NET Framework; 如果沒有，將自動安裝.NET Framework然後安裝作者自己的.NET程式。
目錄
  • 本文內容
  • 製作自己的安裝程式
  • 發佈.NET Framework
  • 製作自己的native安裝程式
  • 使用方法
  • 總結
  • 作者
本文內容
1． 使用VS.NET來製作安裝程式。
2． 如何把.NET Framework 部署到目標機器。
3． 如何使用Native程式碼把.NET Framework和自己的安裝程式製作為一個統一的安裝程式。
該程式做到如果目標機器上沒有.NET Framework，將自動安裝.NET Framework然後再自動安裝作者自己的程式。
製作自己的安裝程式
在VS.NET中，我們可以通過建立"Setup and Deployment Projects"專案，非常靈活方便的把自己的.NET程式製作為Windows Installer檔案。
比如，我們可以很方便的定制下面這些選項：
1． 是否在桌面上放置快捷方式。
2． 註冊自己的檔案類型，可以通過雙擊該檔案來使用自己的程式打開。
3． 註冊表的處理
在下面的MSDN站點，我們可以獲得在VS.NET中通過Setup and Deployment Projects來製作自己的安裝程式的示例：
http://msdn.microsoft.com/library/en-us/vsintro7/html/vbconDeploymentScenarios.asp
發佈.NET Framework
.NET Framework 1.0提供一個用來重新部署.NET的exe檔案：
Dotnetfx.exe. 它包含了Common Language Runtime和其它.NET程式執行時必不可少的內容。
我們可以從下面的站點下載該exe檔案：
http://msdn.microsoft.com/downloads/sample.asp?url=/MSDN-FILES/027/001/829/msdncompositedoc.xml
同時，我們也可以在VS.NET安裝CD或者DVD中找到該檔案。
我們可以通過多種方式來通過執行Dotnetfx.exe把.NET Framework部署到目標機器上：
1． 通過Microsoft Systems Management Server部署。
2． 通過Active Directory部署。
3． 使用第三方工具。
具體的信息，我們可以參閱下面的文章：
http://msdn.microsoft.com/library/en-us/dnnetdep/html/redistdeploy.asp
製作自己的native安裝程式
如果我們要把自己的.NET程式發佈到目標機器上，同時我們不確定該目標機器是否已經安裝了.NET Framework, 那我們就需要自己設計一段unmanaged程式碼，來判斷目標機器是否安裝了.NET Framework, 如果沒有，則執行Dotnetfx.exe安裝.NET Framework, 然後利用Windows Installer安裝自己的程式。
在MSDN的下面網頁上，我們可以獲得一個使用unmanaged C++實現的安裝程式和它的源程式碼：
http://msdn.microsoft.com/downloads/default.asp?URL=/code/sample.asp?url=/msdn-files/027/001/830/msdncompositedoc.xml
1． 在CSettings class中，通過讀取"settings.ini",獲得您自己的MSI安裝檔案和dotnetfx.exe的路徑，以及其他您自己的設置。
（比如.NET Framework的語言版本）
GetCaptionText(void)
GetDialogText(void)
GetErrorCaptionText(void)
GetIniName(void)
GetProductName(void)
Parse()函數用來解析settings.ini檔案。
2． 在Main.cpp檔案中，全局函數FxInstallRequired()判斷是否要在目標機器上安裝.NET Framework.
FxInstallRequired()會檢測下面的註冊表鍵值和dotnetfx.exe的版本和語言設置。
HKLM\SOFTWARE\Microsoft\.NETFramework\policy\v1.0
3．如果需要安裝.NET Framework, 在全局函數ExecCmd()中調用下面的命令silent安裝dotnetfx.exe：
dotnetfx.exe /q:a /c:"install /l /q"
4。 在ExecCmd()全局函數中調用下面的命令安裝您自己的MSI檔案：
msiexec /i <your MSI file> REBOOT=ReallySuppress
使用方法
如果我們使用上面的native程式碼作為自己的安裝程式，那麼我們可以通過下面的步驟把自己的.NET程式和它結合在一起：
1．把您自己的.NET程式製作成為Windows Installer (.MSI)檔案。
2．打開"settings.ini"檔案，在"Msi" key中設置您自己的.NET程式的MSI檔案路徑和檔案名；
在"FxInstallerPath" Key中，設置dotnetfx.exe的路徑。具體的參數信息，您可以從下面文章中得到：
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetdep/html/redistdeploy.asp
3. 把"setup.exe", "settings.ini", "dotnetfx.exe"和您自己的MSI安裝檔案，發送到目標機器上，
然後執行"setup.exe", 安裝程式會自動檢測是否有.NET Framwork, 如果沒有，將首先執行dotnetfx.exe。
通過上述步驟，您可以將自己的.NET程式成功的部署到沒有安裝.NET Framwork環境的機器上。
總結
通過上述步驟，您可以將自己的.NET程式成功的部署到沒有安裝.NET Framwork環境的機器上.


#D 工具選單-->自動產生程式碼(用於新增事件)
-->選擇後按[Enter]輸入鍵-->產生完成


VC# 程式進入點寫法
[STAThread]
static void Main()
 {
    Application.Run(new Form1());
 }

#D 程式進入點寫法
 [STAThread]
 public static void Main(string[] args)
 {
    Application.Run(new Form1());
  }
1.但一般編譯時，都可以正常執行！
2.不能正常執行，請修改為＃D的程式進入點宣告方式：
   public static void Main(string[] args)


.NET Framework 簡介

. NET 是微軟繼其 DNA(Distributed interNet Applications) 架構之後，所提出下一代的分散式軟體應用架構，它的發展方向是要建構一個使用網際網路開放標準 ( 如： HTTP 、 XML 、 SOAP… 等 ) 的應用程式開發與執行的環境，使任何人從任何地方，在任何時間使用任何裝置都能存取網際網路上得資源與服務。

在微軟的規劃下，.NET 包含了五大發展的主軸

  • 個人電腦與智慧型裝置： Longhorn、Windows XP、Pocket PC、Windows CE 、 Stinger 手機 OS
  • 使用者體驗： Passport
  • Web Service： 藉由 XML 及 SOAP 讓應用軟體能以 Internet 為平台，運用 XML 的格式來傳遞。
  • 伺服器： Windows.NET Server 、Longhorn Server
  • 開發工具： Visual Studio.NET、C#.NET、VisualBasic.NET

整個.NET 的Framework包含了下列元素

  • 遵守CLS規範的語言與開發工具，例如 VB, C#, J#, C++
  • 共通語言規範(Common Language Specification ; CLS)
  • 共通語言執行環境(Common Language Runtime ; CLR)
  • 基礎類別程式庫(Base Class Library ; BCL)

.NET應用程式有2大類

  • Win Form：指的是一般在使用者電腦中執行的應用程式
  • Web Form：指的便是ASP.NET

.NET Framework 1.1內建在Windows Server 2003的核心，所以在效能方面比.NET Framework 1.0高出一半以上。.

安裝

開發 | 執行 | 安裝套件
V |  | Microsoft Data Access Components 2.7版
V | V | Microsoft .NET Framework 可轉散發套件 (Redistributable)1.1 版
V |  | Microsoft .NET Framework 軟體開發套件 (Software Development Kit，SDK) 1.1 版
V |  | Microsoft .NET Framework 繁體中文語言套件 ( langpack ) 1.1 版

若需要執行J#, 則要另外安裝下列套件

Microsoft Visual J# .NET可轉散發套件 1.1 版
Microsoft Visual J# .NET可轉散發繁體中文語言套件 1.1 版


NET Framework首頁 http://msdn.microsoft.com/netframework/default.asp

How to Get the Microsoft .NET Framework http://msdn.microsoft.com/netframework/downloads/howtoget.asp

NET Framework最新版網頁http://msdn.microsoft.com/netframework/downloads/sp/download.asp


開發工具

Microsoft Visual Studio.NET

Microsoft ASP.NET Web Matrix

Web Matrix 完全以c#實作出來的Windows Form(Client-Side UI)，是一種容易使用、所見即所得(WYSIWYG)的開發工具，而使用介面類似Visual Studio.NET。Web Matrix是一個”Community Project”，使用者可以透過線上社群的討論方式，針對感興趣的項目提出問題與回應。

Web Matrix與Visual Studio.NET尚有若干差異:
1. Web Matrix應用程式不是以專案型式開啟，檔案間各自獨立。
2. Web Matrix的程式撰寫區不提供Intellisense的屬性提示窗格。
3. Web Matrix檔案無法自動編譯成Assemblies，而須透過Command Line編譯。
4. Web Matrix IDE提供.NET Framework Class Library屬性查詢視窗與線上討論區連結。
5. Web Matrix程式免費下載與使用。

#develop

#develop (唸成「 Sharp Develop」) 是一套遵循GPL授權的自由軟體，可在微軟的.NET平台上編寫C#與VB.NET的程式

Borland C#Builder

Borland C#Builder

Mono

  • Mono 是一套.NET架構的開放原始碼發展平台，可讓軟體開發者以具生產力的方式輕易發展出跨平台的解決方案。
  • Mono's .NET 實作了C#與CLR在 ECMA的標準(ECMA-334和ECMA-335)


Java Framework 與NET Framework比較
  • Java Framework和.NET Framework之間的比較十分常見。雖然可以瞭解 Java 平台提供了.NET 將面對的主要競爭基礎，.NET 的範圍卻比較大。.NET不僅提供可讓應用程式開發與執行的骨架，它還涵蓋了開發工具與供應用程式使用、範圍廣泛的伺服端產品。
  • .NET Framework 大致上等同於 Java 平台，由一組類別庫與一個和 Java 虛擬機器相似的執行環境組成。Java 將這兩個項目以 Java 程式語言規格結合在一起，而 .NET Framework 則是設計成支援多種語言，包括 C# 以及修改過的 Visual Basic 和 Visual C++，因此並不包含單一的語言規格。
  • 就程式語言的角度來比較 ( C# VS Java )
    • C#：A simple, modern, object-oriented, type-safe, versionable, compatible, and flexible language(Microsoft C# product manager : Tony Goodhew)
    • Java：A simple, object-oriented, distributed, interpreted, robust, secure, architecture, neutral, portable, high performance, multithreaded, and dynamic language (Sun Microsystems的Jame Gosling and Henry McGilton)
J2EE Feature | .NET Framework | 備註
Java | Multi-language | Cobol, Build into SQL Server
JVM | CLR |
JDK | .NET Framework SDK |
JavaBeans | .NET class |
EJB | .NET class with COM+ |
JSP/Servlet | ASP.NET | Web control vs. Taglib and Faces
JMS | System.Messaging / MSMQ |
EJB Message Beans | COM+ QC |
JNLP (WebStart) | No-touch Deployment |
RMI-over-IIOP | .NET Remoting |
JNDI | ADSI |
JAXP … | System.XML and web services | ADO.NET XMLReader
JSR-175 – coming in JDK 1.5 | Code Attributes |
JavaMail | System.Web.Mail |


Migrating Native Code to the .NET CLR
Don Box
D
espite the hopes of management, shareholders, or overly-ambitious developers, it is simply not possible to get every piece of software ever written to run as managed code in the Microsoft𦲷 .NET common language runtime (CLR). Given the shortage of programming talent, it is unlikely that many organizations will rewrite 100 percent of their existing Win32𦲷-based, C, C++, Visual Basic𦲷 6.0-based, or COM codebase no matter how compelling the new runtime may be. That means that the world of native code written before the .NET era needs to peacefully coexist with new managed components written in .NET-friendly languages. Thankfully, the CLR supports bridging the two worlds without undue pain or suffering.
To allow native and managed code to coexist, some mechanism is needed to allow managed code executing inside of the CLR (MSCOREE.DLL) to integrate with code running outside of MSCOREE.DLL. This means that managed programs need to run in "unmanaged mode" long enough to execute classic COM or Win32-based code. Also, unmanaged threads may need to visit MSCOREE.DLL long enough to be able to invoke a method on a managed type.

Figure 1 Integrating Managed and Unmanaged Code
Figure 1 Integrating Managed and Unmanaged Code

Fortunately, the CLR supports both types of transitions, allowing both managed and native DLLs to coexist in a single process and call from one DLL to another independent of whether or not they are hosted inside the CLR. An example of a typical circa-2001 process is shown in Figure 1. Note that some code runs inside of MSCOREE.DLL and some does not. Unless the entire operating system is rewritten in managed code, this is likely to be the state of affairs for some time, as today, the underlying Windows𦲷 operating system is exposed via native DLLs, not managed DLLs.

P/Invoke
Calling a native Win32-based DLL from the CLR is fairly straightforward using P/Invoke (the P stands for platform). P/Invoke is a technology that allows you to map a static method declaration to a PE/COFF entry point that is resolvable via LoadLibrary/GetProcAddress. Like the Java Native Interface (JNI) and J/Direct𦲷 before it, P/Invoke uses a managed method declaration to describe the stack frame, but assumes the method body will be provided by an external, native DLL. Unlike JNI, however, P/Invoke is useful for importing "heritage" DLLs that were not written with the CLR in mind.
To indicate that a method is defined in an external, native DLL, you simply mark the static method as extern and use the System.Runtime.InteropServices.DllImport method attribute. The DllImport attribute tells the CLR which arguments to pass to LoadLibrary and GetProcAddress when it is time to call the method. The built-in C# DllImport attribute is simply an alias for System.Runtime.InteropServices.DllImport.
The DllImport attribute takes a variety of parameters. As shown in Figure 2, the DllImport attribute requires at least a file name to be provided. This file name is used by the runtime to call LoadLibrary prior to dispatching the method call. The string to use for GetProcAddress will be the symbolic name of the method unless the EntryPoint parameter is passed to DllImport. Figure 3 shows two ways to call the Sleep method in kernel32.dll. The first example relies on the name of the C# function matching the name of the symbol in the DLL. The second example relies on the EntryPoint parameter instead.
When calling methods that take strings, you need to set the Unicode/ANSI policy either on the method or on the surrounding type. This is needed to control how string types are translated for consumption by unmanaged code. The CharSet parameter to DllImport allows you to specify whether Unicode (CharSet.Unicode) or ANSI (CharSet.Ansi) should always be used, or if the underlying platform should automatically decide based on Windows NT𦲷 or Windows 2000 versus Windows 9x or Windows Millennium Edition (Me) (CharSet.Auto). Using CharSet.Auto is similar to writing Win32-based code in C using the TCHAR datatype, except that the character type and API is determined when loading, not at compile time, allowing a single binary to work properly and efficiently on all versions of Windows.
The Windows platform has a variety of name mangling schemes to indicate calling convention and character sets. When the CharSet is set to CharSet.Auto, the symbolic name will automatically have a W or A suffix, depending on whether Unicode or ANSI is used by the runtime. Additionally, if the plain symbol is not found, the runtime will munge the symbol using the stdcall conventions (for instance, Sleep may be _Sleep@4). This symbolic mangling can be suppressed using the ExactSpelling parameter to the DllImport attribute.
Finally, when calling Win32 functions that use COM-style HRESULTs, you have two options. By default, P/Invoke treats the HRESULT as simply a 32-bit integer that is returned from the function, requiring the programmer to manually test for failure. A more convenient way to call such a function is to pass the TransformSig=true parameter to the DllImport attribute. This tells the P/Invoke layer to treat that 32-bit integer as a COM HRESULT and to throw a COMException in the face of a failed result. (Note that the TransformSig parameter from Beta 1 will be renamed PreserveSig in Beta 2, and its meaning is reversed from Beta 1.) Given the two declarations shown in Figure 4, calling OLE32Wrapper.CoImpersonateClient1 requires the programmer to manually check the result and deal with failed HRESULTs explicitly. Because the TransformSig parameter was used, calling OLE32Wrapper.CoImpersonateClient2 tells the CLR to map failed HRESULTs to COMExceptions implicitly without programmer intervention. In the case of OLE32Wrapper.CoImpersonateClient2, the method returns void because there is no returned value from the underlying function to deal with. Had the method been declared to return a typed value (such as double), the P/Invoke layer would have assumed that the underlying native function accepted an additional parameter by reference (a la COM's [retval] attribute). This mapping only takes place when the TransformSig parameter is true.

Typed Transitions
When calling out of (or into) the runtime, parameters are invariably passed on the call stack, as shown in Figure 5. These parameters are instances of types both to the runtime and to the outside world. The key to understanding how interop works is to understand that any given "value" has two types: a managed type and an unmanaged type. More importantly, some managed types are isomorphic to an unmanaged type, which means that when an instance of that type needs to be passed outside of the runtime, no conversion is necessary. However, many types are not isomorphic and require some conversion in order to come up with a representation that is suitable for the outside world.

Figure 5 Parameters on the Call Stack
Figure 5 Parameters on the Call Stack

Figure 6 shows a list of the basic isomorphic and nonisomorphic types. When calling an external routine that takes only isomorphic types as parameters, no conversion is needed and the caller and callee can actually share a stack frame despite the fact that one side is running in unmanaged mode. If at least one parameter is a nonisomorphic type, the stack frame must be marshaled into a format compatible with the world outside of MSCOREE. That conversion may need to take place in the other direction for parameter values passed from the function back to the caller. Fortunately, the C# compiler knows which direction parameter values flow based on the ref and out keywords. Figure 7 shows this effect.

Figure 7 Nonisomorphic Parameters
Figure 7 Nonisomorphic Parameters

You are free to control how a given parameter (or field in a struct) marshals using the MarshalAs attribute. This attribute indicates which unmanaged type should be presented to the world outside MSCOREE. At the very least, you can use the MarshalAs attribute to indicate what the corresponding native type is for a given parameter or field. For many types, the CLR will pick a reasonable default. However, you can override these defaults using the MarshalAs attribute. For example, the code in Figure 8 shows how the MarshalAs attribute can be used to map the CLR System.String type to one of the four common Win32 formats. As a point of interest, all but the UnmanagedType.LPWStr parameter will result in a copy of the string being created to comply with the underlying native format.
In addition to using the MarshalAs attribute to control type mappings on a field-by-field or parameter-by-parameter basis, you can also control the underlying representation of structs and classes. In particular, the StructLayout and FieldOffset attributes allow you to precisely control the in-memory layout of classes and structs, which is critical for structs that are passed outside of the runtime. The following is an example of an annotated C# struct.
using System.Runtime.InteropServices;
[ StructLayout(LayoutKind.Sequential) ]
public struct PERSON_REP {
  [ MarshalAs(UnmanagedType.BStr) ]
  public String name;
  public double age;
  [ MarshalAs(UnmanagedType.VariantBool) ]
  bool dead;
}
This code is the equivalent definition in COM IDL.
struct PERSON_REP {
  BSTR name;
    public double age;
    VARIANT_BOOL dead;
  };
RCW and CCW
When passing object references other than System.String or System.Object, the default marshaling behavior is to convert between CLR object references and COM object references. As shown in Figure 9, when a reference to a CLR object is marshaled across the MSCOREE boundary, a COM-callable wrapper (CCW) is created to act as a proxy to the CLR object. Likewise, when a reference to a COM object is marshaled in through the MSCOREE boundary, a runtime-callable wrapper (RCW) is created to act as a proxy to the COM object. In both cases, the "proxy" will implement all of the interfaces of the underlying object. Additionally, the "proxy" will try to map COM and CLR idioms like IDispatch, object persistence, and events to the corresponding construct in the other technology.

Figure 9 RCW and CCW Architecture
Figure 9 RCW and CCW Architecture

For interfaces that straddle the MSCOREE boundary via RCWs or CCWs, the CLR relies on a set of annotations to the managed interface definition to give the underlying marshaling layer hints as to how to translate the types. These hints are a superset of those just described for P/Invoke. Additional aspects that need to be defined include UUIDs, vtable versus dispatch versus dual mappings, how IDispatch should be handled, and how arrays are translated. These aspects are added to the managed interface definition using attributes from the System.Runtime.InteropServices namespace. In the absence of these attributes, the CLR makes conservative guesses about what the default settings for a given interface and method should be. For new managed interfaces that are defined from scratch, it is useful to use the attributes explicitly if you intend your interfaces to be used outside of the common language runtime.

TLBIMP and TLBEXP
Translating native COM type definitions (such as structs, interfaces, and so on) to the CLR can be done by hand, and in some cases this is necessary, especially when no accurate TLB is available. Translating type definitions in the other direction is simpler given the ubiquity of reflection in the CLR, but again, you are better off using a tool than resorting to hand translations. The CLR ships with code that does a reasonable job of doing this translation for you, provided that COM TLBs are accurate enough. System.Runtime.InteropServices.TypeLibConverter can translate between TLBs and CLR assemblies. The ConvertAssemblyToTypeLib method reads a CLR assembly and emits a TLB containing the corresponding COM type definitions. Any hints to this translation process (such as MarshalAs) must appear as custom attributes on the interfaces, methods, fields, and parameters in the source types. The ConvertTypeLibToAssembly method reads a COM TLB and emits a CLR assembly containing the corresponding CLR type definitions. The SDK ships with two tools (TLBIMP.EXE and TLBEXP.EXE) that wrap these two calls behind a command-line interface suitable for use with NMAKE. The relationship between these tools is shown in Figure 10.

Figure 10 TLBIMP and TLBEXP
Figure 10 TLBIMP and TLBEXP

In general, it is easier to first define types in a CLR-based language and then emit the TLB. For example, consider the C# code shown in Figure 11. If you were to treat this code as a pseudo-IDL file, you could run it through csc.exe and tlbexp.exe to produce a TLB that is functionally identical to the one produced by the real IDL file shown in Figure 12. The advantage to using the C# approach is that the type definitions are extensible and easily readable, neither of which could be said for the TLB or IDL file.

REGASM
Some developers want their CLR classes to be accessible via COM's CoCreateInstance. For this to happen, some registry entries need to be inserted that bind a COM CLSID to your assembly and type. The REGASM.EXE tool does just this. REGASM.EXE takes an assembly as an argument and writes the appropriate registry entries for each public class. The InprocServer32 entry points to MSCOREE.DLL, which acts as the COM facade to your CLR-based objects. Be aware that REGASM.EXE is not strictly necessary, as you can fairly easily host the CLR from native code and use the default AppDomain to load types and instantiate new instances of any class. Figure 13 shows an example of this using the System.Collections.Stack class from Visual Basic 6.0. This can be further automated using a moniker. Surfing to http://discuss.develop.com/archives/wa.exe?A2=ind0008&L=DOTNET&P=R63059 describes the ".NET moniker" that allows you to instantiate any CLR type using classic COM's CoGetObject or the GetObject method in Visual Basic 6.0.

Strategies
There are three basic strategies for moving native code into the runtime. Figure 14 illustrates the partial port approach, in which source code is mechanically translated from a pre-CLR language (such as Visual Basic 6.0) to a CLR-aware language (such as Visual Basic .NET or C#). This approach relies on the fact that any subordinate native libraries can be imported into the CLR using interop services.

Figure 14 .NET Via Partial Source Code Porting
Figure 14 .NET Via Partial Source Code Porting

Figure 15 illustrates the full port approach, in which source code is completely rewritten in a CLR-aware language without relying on any native subcomponents. This approach relies on the existence of managed versions of any subordinate native libraries. It also relies on your willingness to adapt source code to any stylistic differences the managed libraries may mandate. This approach requires the most labor, but has the advantage of fewer interop transitions as well as (typically) richer and better-designed libraries.

Figure 15 .NET Via Full Source Code Porting
Figure 15 .NET Via Full Source Code Porting

Figure 16 illustrates the "punt" approach, in which source code is left alone and the code is imported into the CLR using interop services. This approach does not rely on the existence of managed versions of any subordinate native libraries, nor does the developer need to adapt source code in any significant manner. This approach requires the least labor, and may have the advantage of fewer interop transitions due to the ratio of subordinate library calls per method.

Figure 16 .NET Via Binary Import (Punt Approach)
Figure 16 .NET Via Binary Import (Punt Approach)

While you could always use technologies like XML or SOAP, the CLR provides developers a variety of choices for transitioning from the old world of COM and Win32 to the new world of C# and Web Services.


共通語言執行環境(Common Language Runtime:CLR) 簡介

傳統的程式編譯方式是將原始程式碼直接編譯成電腦能直接執行的原生碼 (Native Code) ，以執行檔的形式儲存，但是這樣會產生某台機器上編譯過的可執行檔在另一台機器不一定能正常執行。

而在 .NET Framework 環境下，一個 .NET 應用程式的原始碼會先透過 CLR 編譯器編譯，如果沒有語法上的錯誤，就會被加上 Metadata 引擎所產生的 Metadata ，與原始碼產生的中介語言 (Intermediate Language ， IL) ，一起放在目的格式檔案中，通常是指可執行檔 (EXE) 或是動態連接檔 (DLL) ，如果在編譯過程需要用到其他程式庫，中間會再經過一個連結程式 (Linker) 來完成組合程式碼的動作。而在實際執行時，如果應用程式沒有預先被編譯成可被電腦直接執行的原生碼 (Native Code) ，則系統會啟動一個即時編譯器 (Just In Time Compiler ， JIT Compiler) ，將執行檔中的中介語言轉換成原生碼並交由作業系統執行。如此，不論是使用那一種支援 .NET 程式語言撰寫的程式，所產生的中介語言皆相同。將此中介程式碼放置於已安裝 Microsoft .NET Framework 的電腦上均可正常執行，不論其所採用的 CPU 是 Intel-based 、 alpha… 或甚至是不同的作業系統。

  • 相對於Java的Virtual Machine, .NET稱為CLR
  • 相對於 Java 的 Bytecode , .NET 稱之為以 IL (Intermediate Language) )語言的Managed Code
  • CLR將Managed Code以JIT(Just In Time) 及時編譯後執行
Metadata

Metadata在此指的是描述程式執行時所需要的資訊，是所有相關資料的資訊區。

例如：程式內所包含或引用的類別、記憶體資源的配置、 IL 編譯成原生碼所需的資訊及安全管理等。


CLR Profiler (v2.0) 下載

The CLR Profiler allows developers to see the allocation profile of their manage applications.

http://www.microsoft.com/downloads/details.aspx?FamilyId=86CE6052-D7F4-4AEB-9B7A-94635BEEBDDA&displaylang=en

Overview

The CLR Profiler includes a number of very useful views of the allocation profile, including a histogram of allocated types, allocation and call graphs, a time line showing GCs of various generations and the resulting state of the managed heap after those collections, and a call tree showing per-method allocations and assembly loads.

System Requirements

  • Supported Operating Systems: Windows 2000, Windows 98, Windows 98 Second Edition, Windows ME, Windows NT, Windows Server 2003, Windows XP

The CLR Profiler requires the .NET Framework


.NET Framework Class Library

Class Library

The .NET Framework class library is a library of classes, interfaces, and value types that are included in the Microsoft .NET Framework SDK. This library provides access to system functionality and is designed to be the foundation on which .NET Framework applications, components, and controls are built.

Usage

Exceptions

Thread Safety

Namespaces

The .NET Framework class library provides the following namespaces:

Microsoft.CSharp
Contains classes that support compilation and code generation using the C# language.
Microsoft.JScript
Contains classes that support compilation and code generation using the JScript language.
Microsoft.VisualBasic
Contains classes that support compilation and code generation using the Visual Basic .NET language.
Microsoft.Vsa
Contains interfaces that allow you to integrate script for the .NET Framework script engines into applications, and to compile and execute code at run time.
Microsoft.Win32
Provides two types of classes: those that handle events raised by the operating system and those that manipulate the system registry.
System
Contains fundamental classes and base classes that define commonly used value and reference data types, events and event handlers, interfaces, attributes, and processing exceptions.

Other classes provide services supporting data type conversion, method parameter manipulation, mathematics, remote and local program invocation, application environment management, and supervision of managed and unmanaged applications.

System.CodeDom
Contains classes that can be used to represent the elements and structure of a source code document. These elements can be used to model the structure of a source code document that can be output as source code in a supported language using the functionality provided by the System.CodeDom.Compiler namespace.
System.CodeDom.Compiler
Contains types for managing the generation and compilation of source code in supported programming languages. Code generators can each produce source code in a particular programming language based on the structure of Code Document Object Model (CodeDOM) source code models consisting of elements provided by the System.CodeDom namespace.
System.Collections
Contains interfaces and classes that define various collections of objects, such as lists, queues, bit arrays, hashtables and dictionaries.
System.Collections.Specialized
Contains specialized and strongly typed collections; for example, a linked list dictionary, a bit vector, and collections that contain only strings.
System.ComponentModel
Provides classes that are used to implement the run-time and design-time behavior of components and controls. This namespace includes the base classes and interfaces for implementing attributes and type converters, binding to data sources, and licensing components.
System.ComponentModel.Design
Contains classes that developers can use to build custom design-time behavior for components and user interfaces for configuring components at design time. The design time environment provides systems that enable developers to arrange components and configure their properties.
System.ComponentModel.Design.Serialization
Provides types that support customization and control of serialization at design time.
System.Configuration
Provides classes and interfaces that allow you to programmatically access .NET Framework configuration settings and handle errors in configuration files (.config files).
System.Configuration.Assemblies
Contains classes that are used to configure an assembly.
System.Configuration.Install
Provides classes that allow you to write custom installers for your own components. The Installer class is the base class for all custom installers in the .NET Framework.
System.Data
Consists mostly of the classes that constitute the ADO.NET architecture. The ADO.NET architecture enables you to build components that efficiently manage data from multiple data sources. In a disconnected scenario (such as the Internet), ADO.NET provides the tools to request, update, and reconcile data in multiple tier systems. The ADO.NET architecture is also implemented in client applications, such as Windows Forms, or HTML pages created by ASP.NET.
System.Data.Common
Contains classes shared by the .NET Framework data providers. A .NET Framework data provider describes a collection of classes used to access a data source, such as a database, in the managed space.
System.Data.Odbc
Encapsulates the .NET Framework Data Provider for ODBC. A .NET Framework data provider describes a collection of classes used to access a data source, such as a database, in the managed space. Using the OdbcDataAdapter class, you can fill a memory-resident DataSet, which you can use to query and update the data source.

For additional information about how to use this namespace, see the OdbcDataReader, the OdbcCommand, and the OdbcConnection classes.

Note: This namespace is supported only in version 1.1 of the .NET Framework.

System.Data.OleDb
Encapsulates the .NET Framework Data Provider for OLE DB. The .NET Framework Data Provider for OLE DB describes a collection of classes used to access an OLE DB data source in the managed space.
System.Data.OracleClient
Encapsulates the .NET Framework Data Provider for Oracle. The .NET Framework Data Provider for Oracle describes a collection of classes used to access an Oracle data source in the managed space.
Note: This namespace is supported only in version 1.1 of the .NET Framework.
System.Data.SqlClient
Encapsulates the .NET Framework Data Provider for SQL Server. The .NET Framework Data Provider for SQL Server describes a collection of classes used to access a SQL Server database in the managed space.
System.Data.SqlServerCE
Describes a collection of classes that can be used to access a database in SQL Server CE from Windows CE-based devices in the managed environment. With this namespace you can create SQL Server CE databases on a device and also establish connections to SQL Server databases that are on a device or on a remote server.

Note: This namespace is supported only in version 1.1 of the .NET Framework.

System.Data.SqlTypes
Provides classes for native data types within SQL Server. These classes provide a safer, faster alternative to other data types. Using the classes in this namespace helps prevent type conversion errors caused in situations where loss of precision could occur. Because other data types are converted to and from SqlTypes behind the scenes, explicitly creating and using objects within this namespace results in faster code as well.
System.Diagnostics
Provides classes that allow you to interact with system processes, event logs, and performance counters. This namespace also provides classes that allow you to debug your application and to trace the execution of your code. For more information, see the Trace and Debug classes.
System.Diagnostics.SymbolStore
Provides classes that allow you to read and write debug symbol information, such as source line to Microsoft intermediate language (MSIL) maps. Compilers targeting the .NET Framework can store the debug symbol information into programmer's database (PDB) files. Debuggers and code profiler tools can read the debug symbol information at run time.
System.DirectoryServices
Provides easy access to Active Directory from managed code. The namespace contains two component classes, DirectoryEntry and DirectorySearcher, which use the Active Directory Services Interfaces (ADSI) technology. ADSI is the set of interfaces that Microsoft provides as a flexible tool for working with a variety of network providers. ADSI gives the administrator the ability to locate and manage resources on a network with relative ease, regardless of the network's size.
System.Drawing
Provides access to GDI+ basic graphics functionality. More advanced functionality is provided in the System.Drawing.Drawing2D, System.Drawing.Imaging, and System.Drawing.Text namespaces.
System.Drawing.Design
Contains classes that extend design-time user interface (UI) logic and drawing. You can further extend this design-time functionality to create custom toolbox items, type-specific value editors that can edit and graphically represent values of their supported types, or type converters that can convert values between certain types. This namespace provides the basic frameworks for developing extensions to the design-time UI.
System.Drawing.Drawing2D
Provides advanced 2-dimensional and vector graphics functionality. This namespace includes the gradient brushes, the Matrix class (used to define geometric transforms), and the GraphicsPath class.
System.Drawing.Imaging
Provides advanced GDI+ imaging functionality. Basic graphics functionality is provided by the System.Drawing namespace.
System.Drawing.Printing
Provides print-related services. Typically, you create a new instance of the PrintDocument class, set the properties that describe what to print, and call the Print method to actually print the document.
System.Drawing.Text
Provides advanced GDI+ typography functionality. Basic graphics functionality is provided by the System.Drawing namespace. The classes in this namespace allow users to create and use collections of fonts.
System.EnterpriseServices
Provides an important infrastructure for enterprise applications. COM+ provides a services architecture for component programming models deployed in an enterprise environment. This namespace provides .NET Framework objects with access to COM+ services, making the .NET Framework objects more practical for enterprise applications.
System.EnterpriseServices.CompensatingResourceManager
Provides classes that allow you to use a Compensating Resource Manager (CRM) in managed code. A CRM is a service provided by COM+ that enables you to include non-transactional objects in Microsoft Distributed Transaction Coordinator (DTC) transactions. Although CRMs do not provide the capabilities of a full resource manager, they do provide transactional atomicity (all-or-nothing behavior) and durability through the recovery log.
System.EnterpriseServices.Internal
Provides infrastructure support for COM+ services. The classes and interfaces in this namespace are specifically intended to support calls into System.EnterpriseServices from the unmanaged COM+ classes.
System.Globalization
Contains classes that define culture-related information, including the language, the country/region, the calendars in use, the format patterns for dates, currency, and numbers, and the sort order for strings. These classes are useful for writing globalized (internationalized) applications.
System.IO
Contains types that allow synchronous and asynchronous reading and writing on data streams and files.
System.IO.IsolatedStorage
Contains types that allow the creation and use of isolated stores. With these stores, you can read and write data that less trusted code cannot access and prevent the exposure of sensitive information that can be saved elsewhere on the file system. Data is stored in compartments that are isolated by the current user and by the assembly in which the code exists.
System.Management
Provides access to a rich set of management information and management events about the system, devices, and applications instrumented to the Windows Management Instrumentation (WMI) infrastructure.
System.Management.Instrumentation
Provides the classes necessary for instrumenting applications for management and exposing their management information and events through WMI to potential consumers. Consumers such as Microsoft Application Center or Microsoft Operations Manager can then manage your application easily, and monitoring and configuring of your application is available for administrator scripts or other applications, both managed as well as unmanaged.
System.Messaging
Provides classes that allow you to connect to, monitor, and administer message queues on the network and send, receive, or peek messages.
System.Net
Provides a simple programming interface for many of the protocols used on networks today. The WebRequest and WebResponse classes form the basis of what are called pluggable protocols, an implementation of network services that enables you to develop applications that use Internet resources without worrying about the specific details of the individual protocols.
System.Net.Sockets
Provides a managed implementation of the Windows Sockets (Winsock) interface for developers who need to tightly control access to the network.
System.Reflection
Contains classes and interfaces that provide a managed view of loaded types, methods, and fields, with the ability to dynamically create and invoke types.
System.Reflection.Emit
Contains classes that allow a compiler or tool to emit metadata and Microsoft intermediate language (MSIL) and optionally generate a PE file on disk. The primary clients of these classes are script engines and compilers.
System.Resources
Provides classes and interfaces that allow developers to create, store, and manage various culture-specific resources used in an application.
System.Runtime.CompilerServices
Provides functionality for compiler writers using managed code to specify attributes in metadata that affect the run-time behavior of the common language runtime. The classes in this namespace are for compiler writers use only.
System.Runtime.InteropServices
Provides a wide variety of members that support COM interop and platform invoke services. If you are unfamiliar with these services, see Interoperating with Unmanaged Code .
System.Runtime.InteropServices.CustomMarshalers
Supports the .NET infrastructure and is not intended to be used directly from your code.
System.Runtime.InteropServices.Expando
Contains the IExpando interface which allows modification of an object by adding or removing its members.
System.Runtime.Remoting
Provides classes and interfaces that allow developers to create and configure distributed applications.
System.Runtime.Remoting.Activation
Provides classes and objects that support server and client activation of remote objects.
System.Runtime.Remoting.Channels
Contains classes that support and handle channels and channel sinks, which are used as the transport medium when a client calls a method on a remote object.
System.Runtime.Remoting.Channels.Http
Contains channels that use the HTTP protocol to transport messages and objects to and from remote locations. By default, the HTTP channels encode objects and method calls in SOAP format for transmission, but other encoding and decoding formatter sinks can be specified in the configuration properties of a channel.
System.Runtime.Remoting.Channels.Tcp
Contains channels that use the TCP protocol to transport messages and objects to and from remote locations. By default, the TCP channels encode objects and method calls in binary format for transmission, but other encoding and decoding formatter sinks can be specified in the configuration properties of a channel.
System.Runtime.Remoting.Contexts
Contains objects that define the contexts all objects reside within. A context is an ordered sequence of properties that defines an environment for the objects within it. Contexts are created during the activation process for objects that are configured to require certain automatic services such synchronization, transactions, just-in-time (JIT) activation, security, and so on. Multiple objects can live inside a context.
System.Runtime.Remoting.Lifetime
Contains classes that manage the lifetime of remote objects. Traditionally, distributed garbage collection uses reference counts and pinging for control over the lifetime of objects. This works well when there are a few clients per service, but doesn't scale well when there are thousands of clients per service. The remoting lifetime service associates a lease with each service, and deletes a service when its lease time expires. The lifetime service can take on the function of a traditional distributed garbage collector, and it also adjusts well when the numbers of clients per server increases.
System.Runtime.Remoting.Messaging
Contains classes used to create and remote messages. The remoting infrastructure uses messages to communicate with remote objects. Messages are used to transmit remote method calls, to activate remote objects, and to communicate information. A message object carries a set of named properties, including action identifiers, envoy information, and parameters.
System.Runtime.Remoting.Metadata
Contains classes and attributes that can be used to customize generation and processing of SOAP for objects and fields. The classes of this namespace can be used to indicate the SOAPAction, type output, XML element name, and the method XML namespace URI.
System.Runtime.Remoting.Metadata.W3cXsd2001
Contains the XML Schema Definition (XSD) defined by the World Wide Web Consortium (W3C) in 2001. The XML Schema Part2: Data types specification from W3C identifies format and behavior of various data types. This namespace contains wrapper classes for the data types that conform to the W3C specification. All date and time types conform to the ISO standards specification.
System.Runtime.Remoting.MetadataServices
Contains the classes used by the Soapsuds.exe command line tool and the user code to convert metadata to and from XML schema for the remoting infrastructure.
System.Runtime.Remoting.Proxies
Contains classes that control and provide functionality for proxies. A proxy is a local object that is an image of a remote object. Proxies enable clients to access objects across remoting boundaries.
System.Runtime.Remoting.Services
Contains service classes that provide functionality to the .NET Framework.
System.Runtime.Serialization
Contains classes that can be used for serializing and deserializing objects. Serialization is the process of converting an object or a graph of objects into a linear sequence of bytes for either storage or transmission to another location. Deserialization is the process of taking in stored information and recreating objects from it.
System.Runtime.Serialization.Formatters
Provides common enumerations, interfaces, and classes that are used by serialization formatters.
System.Runtime.Serialization.Formatters.Binary
Contains the BinaryFormatter class, which can be used to serialize and deserialize objects in binary format.
System.Runtime.Serialization.Formatters.Soap
Contains the SoapFormatter class, which can be used to serialize and deserialize objects in the SOAP format.
System.Security
Provides the underlying structure of the .NET Framework security system, including base classes for permissions.
System.Security.Cryptography
Provides cryptographic services, including secure encoding and decoding of data, as well as many other operations, such as hashing, random number generation, and message authentication.
System.Security.Cryptography.X509Certificates
Contains the common language runtime implementation of the Authenticode X.509 v.3 certificate. This certificate is signed with a private key that uniquely and positively identifies the holder of the certificate.
System.Security.Cryptography.Xml
Contains classes to support the creation and validation of XML digital signatures. The classes in this namespace implement the World Wide Web Consortium Recommendation, "XML-Signature Syntax and Processing", described at http://www.w3.org/TR/xmldsig-core/.
System.Security.Permissions
Defines classes that control access to operations and resources based on policy.
System.Security.Policy
Contains code groups, membership conditions, and evidence. These three types of classes are used to create the rules applied by the .NET Framework security policy system. Evidence classes are the input to security policy and membership conditions are the switches; together these create policy statements and determine the granted permission set. Policy levels and code groups are the structure of the policy hierarchy. Code groups are the encapsulation of a rule and are arranged hierarchically in a policy level.
System.Security.Principal
Defines a principal object that represents the security context under which code is running.
System.ServiceProcess
Provides classes that allow you to implement, install, and control Windows service applications. Services are long-running executables that run without a user interface. Implementing a service involves inheriting from the ServiceBase class and defining specific behavior to process when start, stop, pause, and continue commands are passed in, as well as custom behavior and actions to take when the system shuts down.
System.Text
Contains classes representing ASCII, Unicode, UTF-7, and UTF-8 character encodings; abstract base classes for converting blocks of characters to and from blocks of bytes; and a helper class that manipulates and formats String objects without creating intermediate instances of String.
System.Text.RegularExpressions
Contains classes that provide access to the .NET Framework regular expression engine. The namespace provides regular expression functionality that can be used from any platform or language that runs within the Microsoft .NET Framework.
System.Threading
Provides classes and interfaces that enable multithreaded programming. In addition to classes for synchronizing thread activities and access to data (Mutex, Monitor, Interlocked, AutoResetEvent, and so on), this namespace includes a ThreadPool class that allows you to use a pool of system-supplied threads, and a Timer class that executes callback methods on thread pool threads.
System.Timers
Provides the Timer component, which allows you to raise an event on a specified interval.
System.Web
Supplies classes and interfaces that enable browser-server communication. This namespace includes the HTTPRequest class that provides extensive information about the current HTTP request, the HTTPResponse class that manages HTTP output to the client, and the HTTPServerUtility object that provides access to server-side utilities and processes. System.Web also includes classes for cookie manipulation, file transfer, exception information, and output cache control.
System.Web.Caching
Provides classes for caching frequently used data on the server. This includes the Cache class, a dictionary that allows you to store arbitrary data objects, such as hash tables and data sets. It also provides expiration functionality for those objects, and methods that allow you to add and removed the objects. You can also add the objects with a dependency upon other files or cache entries, and perform a callback to notify your application when an object is removed from the Cache.
System.Web.Configuration
Contains classes that are used to set up ASP.NET configuration.
System.Web.Hosting
Provides the functionality for hosting ASP.NET applications from managed applications outside of Microsoft Internet Information Services (IIS).
System.Web.Mail
Contains classes that enable you to construct and send messages using the CDOSYS Message component. The mail message is delivered through either the SMTP mail service built into Microsoft Windows 2000 or through an arbitrary SMTP server. The classes in this namespace can be used either from ASP.NET or from any managed application.
System.Web.Mobile
Contains the core capabilities, including authentication and error-handling, required for building ASP.NET mobile Web applications.
System.Web.Security
Contains classes that are used to implement ASP.NET security in Web server applications.
System.Web.Services
Consists of the classes that enable you to create XML Web services using ASP.NET and XML Web service clients. XML Web services are applications that provide the ability to exchange messages in a loosely coupled environment using standard protocols such as HTTP, XML, XSD, SOAP, and WSDL. XML Web services enable the building of modular applications within and across companies in heterogeneous environments making them interoperable with a broad variety of implementations, platforms and devices. The SOAP-based XML messages of these applications can have well-defined (structured and typed), or loosely defined parts (using arbitrary XML). The ability of the messages to evolve over time without breaking the protocol is fundamental to the flexibility and robustness of XML Web services as a building block for the future of the Web.
System.Web.Services.Configuration
Consists of the classes that configure how XML Web services created using ASP.NET run.
System.Web.Services.Description
Consists of the classes that enable you to publicly describe an XML Web service by using the Web Services Description Language (WSDL). Each class in this namespace corresponds to a specific element in the WSDL specification, and the class hierarchy corresponds to the XML structure of a valid WSDL document.
System.Web.Services.Discovery
Consists of the classes that allows XML Web service clients to locate the available XML Web services on a Web server through a process called XML Web services Discovery.
System.Web.Services.Protocols
Consists of the classes that define the protocols used to transmit data across the wire during the communication between XML Web service clients and XML Web services created using ASP.NET.
System.Web.SessionState
Supplies classes and interfaces that enable storage of data specific to a single client within a Web application on the server. The session state data is used to give the client the appearance of a persistent connection with the application. State information can be stored within local process memory or, for Web farm configurations, out-of-process using either the ASP.NET State Service or a SQL Server database.
System.Web.UI
Provides classes and interfaces that allow you to create controls and pages that will appear in your Web applications as user interface on a Web page. This namespace includes the Control class, which provides all controls, whether HTML, Web, or User controls, with a common set of functionality. It also includes the Page control, which is generated automatically whenever a request is made for a page in your Web application. Also provided are classes which provide the Web Forms Server Controls data binding functionality, the ability to save the view state of a given control or page, as well as parsing functionality for both programmable and literal controls.
System.Web.UI.Design
Contains classes that can be used to extend design-time support for Web Forms.
System.Web.UI.Design.WebControls
Contains classes that can be used to extend design-time support for Web server controls.
System.Web.UI.HtmlControls
Consists of a collection of classes that allow you to create HTML server controls on a Web Forms page. HTML server controls run on the server and map directly to standard HTML tags supported by most browsers. This allows you to programmatically control the HTML elements on a Web Forms page.
System.Web.UI.MobileControls
Contains a set of ASP.NET server controls that can intelligently render your application for different mobile devices.
System.Web.UI.MobileControls.Adapters
Contains the core device adapter classes used by the ASP.NET mobile controls for device customization and extended device support.
System.Web.UI.WebControls
Contains classes that allow you to create Web server controls on a Web page. Web server controls run on the server and include form controls such as buttons and text boxes. They also include special purpose controls such as a calendar. Because Web server controls run on the server, you can programmatically control these elements. Web server controls are more abstract than HTML server controls. Their object model does not necessarily reflect HTML syntax.
System.Windows.Forms
Contains classes for creating Windows-based applications that take full advantage of the rich user interface features available in the Microsoft Windows operating system.
System.Windows.Forms.Design
Contains classes that support design-time configuration and behavior for Windows Forms components. These classes consist of: Designer classes that provide support for Windows Forms components, a set of design time services, UITypeEditor classes for configuring certain types of properties, and classes for importing ActiveX controls.
System.Xml
Provides standards-based support for processing XML.
System.Xml.Schema
Contains the XML classes that provide standards-based support for XML Schemas definition language (XSD) schemas.
System.Xml.Serialization
Contains classes that are used to serialize objects into XML format documents or streams.
System.Xml.XPath
Contains the XPath parser and evaluation engine. It supports the W3C XML Path Language (XPath) Version 1.0 Recommendation (www.w3.org/TR/xpath).
System.Xml.Xsl
Provides support for Extensible Stylesheet Transformation (XSLT) transforms. It supports the W3C XSL Transformations (XSLT) Version 1.0 Recommendation (www.w3.org/TR/xslt).

Usage

The class library reference documentation can be filtered by language, so that you can view syntax, descriptions, and examples for one language (either Visual Basic, C#, the Managed Extensions for C++, or JScript) or all four languages at once. To filter by language, click the filtering icon Language Filter at the top of any reference page and select a language or choose Show All.

Exceptions

All instance methods in the class library throw an instance of NullReferenceException when an attempt is made to call the method and the underlying object holds a null reference. Because this exception can occur with any instance method, it is not explicitly listed in the reference documentation for each instance method.

The class library documentation lists the other exceptions that each member throws along with a description of the condition under which it is thrown.

Thread Safety

All public static members (methods, properties, fields, and events) within the .NET Framework support concurrent access within a multithreaded environment. Therefore, any .NET Framework static member can be simultaneously invoked from two threads without encountering race conditions, deadlocks, or crashes.

For all classes and structures in the .NET Framework, check the Thread Safety section in the API reference documentation to determine whether it is thread safe. If you want to use a class that is not thread-safe in a multithreaded environment, you must wrap an instance of the class with code that supplies the necessary synchronization constructs.

See Also

.NET Framework Reference | Introduction to the .NET Framework Class Library

Syntax based on .NET Framework version 1.1.
Documentation version 1.1.1.


核心型別
「核心型別」（cor e type）被包含在S y s t e m 命名空間中。
這個命名空間是BCL 的重心，其中包含：類別、介面，以及所有其它型別所依賴的屬性。
BCL 的根源是O b j e c t 型別，所有其它的.NET 型別都是由它衍生而來的。
其它的基礎型別有
V a l u e T y p e （str uct 的基礎型別）、
E n u m （enum 的基礎型別）、
C o n v e r t （用於基礎型別間的轉換）、
E x c e p t i o n （所有例外事件的基礎型別）
，以及預先定義之數值型別的boxed 版本。
整個BC L 所使用介面，像是I C l o n e a b l e 、I C o m p a r a b l e 、I f o r m a t t a b l e 及I c o n v e r t i b l e ，
都會在此處定義。延伸的型別，譬如D a t e T i m e 、T i m e S p a n 及D B N u l l ，也都可使用。
其它的類別包括：單一或多重委派的支援、基本數學運算、屬性，以及例外處置。
與字串有關的更進一步資訊，參見S t r i n g 命名空間。


文字
BCL 提供豐富的文字處理功能。重要的型別包括：S t r i n g 類別（可處理固定不
變的字串）、S t r i n g B u i l d e r 類別（可提供處置字串的運算，並支援可辨認語系
（locale-awar e）的比對運算及多重的字串編碼格式（ASCI I 、Uni code 、UT F-7 與
UTF-8）），以及一組支援正規表示式的類別。
System.Text
System.Text.RegularExpressions

位於其它命名空間的重要型別還包括S y s t e m . S t r i n g


集合
B CL 提供了一組通用的資料結構，譬如A r r a y L i s t 、D i c t i o n a r y 、
H a s h t a b l e 、Q u e u e 、S t a c k 、B i t A r r a y 以及其它。標準化的設計樣式
（desi gn pat t er n）使用了共通的基礎型別（common base t ype）與公開的介面
（publ ic int er f ace），這讓BCL 可以一致化地處置預先定義的集合型別，以及使用
者自訂的集合型別。
至於更詳細的資訊，請參考以下的命名空間：
System.Collections
System.Collections.Bases
位於其它命名空間的重要型別還包括S y s t e m . A r r a y 。


串流與I / O
BCL 對標準輸入、輸出及錯誤之串流的存取提供了良好的支援。它也提供了相關
類別，可用以進行二進位格式檔及文字格式檔的I /O（輸出/入）、註冊檔案系統之
例外事件的通知，以及存取一個使用者自訂的安全儲存區，也就是所謂的I solated St orage
至於更詳細的資訊，請參考以下的命名空間：
System.IO
System.IO.IsolatedStorage
System.Console


網路
BCL 支援了一組層級式的類別，可使用不同的抽象層級藉由網路進行溝通，這些
抽象層級包括：對原始socket 的存取；對TCP 、UDP 及HTTP 等協定支援；一個
以URI 及串流為基礎的、高階的r equest /r espons e 機制；以及一個可插入
（pluggable）的協定處理器。
至於更詳細的資訊，請參考以下的命名空間：
System.Net
System.Net.Sockets
位於其它命名空間的重要型別還包括S y s t e m . I O . S t r e a m 。


執行緒
BCL 提供了豐富的支援，可建立多重執行緒的應用程式，包括：執行緒及執行緒
集區（pool ）的管理；執行緒同步機制，譬如：監控、mut exe 【編註：mut ext（互
斥；對立）是指執行緒之間為避免r ace condi ti on（競爭狀況）所使用的機制。】、
事件、r eader /wr it er 鎖定，等等；以及存取底層作業平台的功能，譬如：I /O 完成
埠及系統時鐘。
至於更詳細的資訊，請參考以下的命名空間：
System.Threading
System.Timers
System.Timers.Design
位於其它命名空間的重要型別還包括S y s t e m . T h r e a d - S t a t i c A t t r i b u t e 。


安全
BCL 提供了一組類別，可以處理.NET 執行期之「程式碼存取安全模型」（Code
Acces s Secur i ty model ）的所有元素，包括：安全政策、安全原則、使用權限設
定，以及證據。這些類別也支援加密演算法，譬如：DES 、3DES 、RC2 、RSA 、
DSig 、MD5 、SHA1 ，以及可對串流進行轉換的Base64 編碼。
至於更詳細的資訊，請參考以下的命名空間：
System.Security
System.Security.Cryptography
System.Security.Cryptography.X509Certificates
System.Security.Cryptography.Xml
System.Security.Permissions
System.Security.Policy
System.Security.Principal


反射（R e f l e c t i o n ）
.N ET 執行期非常仰賴中介資料（m et adata）的存在，以及其動態檢查與處理「中
介資料」的能力。BCL 揭露了一組抽象的類別，它們會鏡射（mi rr or ）出應用程式
裡一些重要的元素（配件、模組、型別與成員）並且為BCL 型別與新型別提供快
速建立實例的支援。
至於更詳細的資訊，請參考以下的命名空間：
System.Reflection
System.Reflection.Emit
位於其它命名空間的重要型別還包括：
System.Type
System. Activator
System.AppDomain.


序列化（S e r i a l i z a t i o n ）
BCL 所提供的支援還包括對任意「物件圖形」（obj ect gr aph）與「串流」（s t ream）
進行序列化的轉換。這項序列化功能可透過檔案或網路儲存並傳送複雜的資料結
構。預設的「序列化函式」（s er iali zer ）提供了bi nar y 及XML 為主的格式編排，
但可透過用者自訂的「編排函式」（f or mat ter ）來加以延伸。
至於更詳細的資訊，請參考以下的命名空間：
System.Runtime.Serialization
System.Runtime.Serialization.Formatters
System.Runtime.Serialization.Formatters.Soap
System.Runtime.Serialization.Formatters.Binary
位於其它命名空間的重要型別還包括：
System.NonSerializedAttribute
System.SerializableAttribute


遠端服務（R e m o t i n g ）
遠端服務是分散式應用程式的的基石，而且BCL 還提供了優異的支援，可執行或
接收遠端的方法呼叫。遠端呼叫可以是同步的或非同步的；支援r equest /r espons e
架構或單向模式；可透過多種傳輸協定（TCP 、HTT P 及SMTP）；並可被進行多
種格式的序列化（SOAP 及bi nar y）。遠端服務之基礎建設支援了多重的啟動模
型、租賃為主（l eas e-based）的物件生命期、分散式物件的身份、透過參照型別或
數值型別的「物件封送」（obj ect marshall i ng），以及訊息的截取。這些型別可透過
使用者自訂的「通道」（channel ）、「序列化函式」（s er i al i zer ）、「代理程式」
（proxy），以及「呼叫環境」（call context ）做進一步的延伸。
至於更詳細的資訊，請參考以下的命名空間：
System.Runtime.Remoting
System.Runtime.Remoting.Channels.Core
System.Runtime.Remoting.Channels.HTTP
System.Runtime.Remoting.Channels.MetadataServices
System.Runtime.Remoting.Channels.SMTP
System.Runtime.Remoting.Channels.TCP
System.Runtime.Remoting.Services
位於其它命名空間的重要型別還包括：
System.AppDomain
System.CallContext
System.ContextBoundObject
System.ContextStaticAttribute
System.MarshalByRefObject


Web 服務
從邏輯上來看，w eb 服務只是r emot i ng（遠端服務）的一個實例。事實上，BCL
對於web 服務的支援被視為ASP .NET 的一部份，而且它跟CLR 的r emoti ng 基礎
設施大部份是分開的。BCL 提供有專門的類別及屬性，可用於描述與發佈web 服
務，找出有何種web 服務被陳列在特定的端點（URI）上，並可叫用w eb 服務的
方法。
至於更詳細的資訊，請參考以下的命名空間：
System.Web.Services
System.Web.Services.Description
System.Web.Services.Discovery
System.Web.Services.Interop
System.Web.Services.Protocols


資料存取
BCL 包含了一組類別，可用以存取資料來源，並可管理複雜的資料集；這就是所
謂的ADO .NET 。這些類別在.NET 平台中將取代Wi n32 之ADO 的角色。ADO+
同時支援了連接及非連接的操作、多重資料提供者（包含非關聯性的資料來源），
以及與XML 之間的序列化轉換。
至於更詳細的資訊，請參考以下的命名空間：
System.Data
System.Data.ADO
System.Data.ADO.Interop
System.Data.CodeGen
System.Data.Design
System.Data.Internal
System.Data.SQL
System.Data.SQLTypes


XML
BCL 針對X ML 1.0 、XML schemas 以及XML 命名空間提供了廣泛的支援，它提供
了兩項個別的XML 剖析模組（一個以DO M2 為主的模型，與一個SA X2 之pull
mode 的變體）以及XSL/T 、X Pat h 與SOAP 1.1 的實作。
至於更詳細的資訊，請參考以下的命名空間：
System.Xml
System.Xml.Serialization
System.Xml.Serialization.IO
System.Xml.Serialization.Schema
System.Xml.XPath
System.Xml.Xsl


圖形
BCL 中包含了支援圖形影像處理的類別；這就是所謂的GDI+。這些類別相當於
Wi n32 的GDI ，並且支援：畫筆（brush）、字型（f ont）、位元映像（bi tmap），文
字處理（text render ing）、基本描繪（dr awi ng pr i mi ti ve）、影像轉換，以及預覽列
印（pr int-pr evi ew）等功能。
至於更詳細的資訊，請參考以下的命名空間：
System.Drawing
System.Drawing.Design
System.Drawing.Drawing2D
System.Drawing.Imaging
System.Drawing.Printing
System.Drawing.Text


豐富的用戶端應用程式
BC L 中包含了建立典型GU I 應用程式的支援。這項支援稱作Wi nd ow s 表格
（Wi ndows For m），而且它的組成為：一份表格套件、一組預先定義好的GUI 元件
集，以及一個RAD 設計者工具適用的元件模型。這些類別提供了多種程度的抽象
化，從低階的訊息迴圈處理器（m es sage-loop handl er ）類別到高階的版面配置管
理員（layout manager ）及視覺化繼承（visual i nher i t ance）。
至於更詳細的資訊，請參考以下的命名空間：
System.WinForms
System.WinForms.ComponentModel
System.WinForms.ComponentModel.COM2Interop
System.WinForms.Design
System.WinForms.PropertyGridInternal


Web 為主的應用程式
BCL 中包括了建立Web 為主之應用程式的支援。這項支援稱作Web 表格（Web
For m），而且它的組成為：一份伺服端的表格套件（它可產生HTML 使用者介
面）、一組預先定義的G UI wi dgets ，以及一個RAD 設計者工具適用的元件模型。
BC L 也包含了一組類別，可用以管理「對談狀態」（s essi on st ate）、安全、快取
（caching）、偵錯、追蹤、當地語系化（local i zat i on）、組態設定，以及Web 為主之
應用程式的部署。最後要說明的是，BCL 還包含了可產生或使用w eb 服務的類別
及屬性。這些功就是所謂的A SP .N ET ，它
將完全取代Wi n32 的ASP 。
至於更詳細的資訊，請參考以下的命名空間：
System.Web
System.Web.Caching
System.Web.Configuration
System.Web.Handlers
System.Web.Hosting
System.Web.Security
System.Web.SessionState
System.Web.UI
System.Web.UI.Design
System.Web.UI.Design.Util
System.Web.UI.Design.WebControls
System.Web.UI.Design.WebControls.ListControls
System.Web.UI.HtmlControls
System.Web.UI.WebControls
System.Web.UI.WebControls.Design
System.Web.Util


全球化（G l o b a l i z a t i o n ）
BCL 提供了支援全球化的類別，它可用以支援字碼頁（code-page）的轉換、可處
理當地語系（local e-awar e）的字串操作、時間/日期的轉換，以及使用資源檔集中
當地語系化（l ocal i zat ion）的工作。
至於更詳細的資訊，請參考以下的命名空間：
System.Globalization
System.Resources


組態（C o n f i g u r a t i o n ）
BCL 還提供.NET 組態系統的存取，這包括：一個針對使用者（per -user ）或針對
應用程式（per -appli cat i on）的組態模型（其可繼承相關的組態設定），以及一個交
易式安裝程式（tr ans cat ed ins t al ler ）的架構。相關的類別可同時使用這項組態架
構，並且可加以延伸。
至於更詳細的資訊，請參考以下的命名空間：
System.Configuration
System.Configuration.Assemblies
System.Configuration.Core
System.Configuration.Design
System.Configuration.Install
System.Configuration.Interceptors
System.Configuration.Internal
System.Configuration.Schema
System.Configuration.Web


進階的元件服務
BCL 提供了建立COM+服務的支援，譬如：分散式交易、JI T 的啟動、物件集區
（object pool i ng）、佇列以及事件。BCL 還包含了透過既存之訊息佇列架構
（MSMQ）進行穩定的、非同步的、單向訊息存取的類型。BCL 同時包含了可用以
存取現有名錄服務（Acti ve Dir ector y）的類別。
至於更詳細的資訊，請參考以下的命名空間：
Microsoft.ComServices
System.DirectoryServices
System.Messaging
System.Messaging.Design


配件（A s s e m b l y ）
BCL 所提供的屬性，可在配件中標記相關的資訊，譬如：標的機器之作業系統與
處理器、配件的版本，以及其它的資訊。
至於更詳細的資訊，請參考以下的命名空間：
System.Runtime.CompilerServices
System.Runtime.CompilerServices.CSharp


診斷與偵錯
BCL 還包含了以下的類別：支援「多重聽眾」（mult il i st ener ）的偵錯追蹤；存取事
件日誌檔，存取行程、執行緒，以及堆疊框的資訊；並且具備製造及使用效能計數
器的能力。
至於更詳細的資訊，請參考以下的命名空間：
System.Diagnostics
System.Diagnostics.Design
System.Diagnostics.SymbolStore


與未受控管之程式碼的互通性
.NET 執行期與未受控管之程式碼的互通性，可透過COM 、COM+及原生的Wi n32
API 呼叫來實施。BCL 提供了一組類別及屬性可支援此項功能，包括：精確地控管
物件的生命期，以及建立使用者定義的自訂封送處理器（mars hal ler ）以處理特定
的互通性狀況。
至於更詳細的資訊，請參考以下的命名空間：
System.Runtime.InteropServices
System.Runtime.InteropServices.CustomMarshalers
System.Runtime.InteropServices.Expando
Microsoft.Win32.Interop
Microsoft.Win32.Interop.Trident
位於其它命名空間的重要型別還包括S y s t e m . B u f f e r 。


元件與工具的支援
在.NET 的執行期間，元件與類別的差異在於，元件具有額外的「中介資料」
（metadat a）及其它措施，可協助元件表格套件的使用，譬如Wi ndows 表格及Web
表格。BCL 所提供之類別及屬性，可同時建立元件以及建立使用元件的工具。這
些類別也包含了產生及編譯C#、Js cri pt 及VB.NET 原始碼的能力。
至於更詳細的資訊，請參考以下的命名空間：
System.CodeDOM
System.CodeDOM.Compiler
System.ComponentModel
System.ComponentModel.Design
System.ComponentModel.Design.CodeModel
System.ComponentModel.Interop


執行期的措施
BCL 所提供的類別可控制執行期的行為。標準的例子是那些可用來控制「資源回
收器」（gar bage col lect or ）的類別，以及那些提供強及弱之參照支援的類別。
至於更詳細的資訊，請參考S y s t e m 命名空間。
位於其它命名空間的重要型別還包括
S y s t e m . R u n t i m e . I n t e r o p S e r v i c e s . G C H a n d l e 。


原生的作業系統措施
BCL 除了可以控制現有的NT 服務以及見建立新服務外，也能夠存取特定之原生
Wi n32 措施，譬如Wi ndows r egi s t r y 以及Wi ndows （WMI）。
至於更詳細的資訊，請參考以下的命名空間：
Accessibility
Microsoft.Win32
System.Core
System.Management
System.ServiceProcess


基礎類別程式庫(Base Class Library:BCL) 簡介
.NET Framework 包含了一組豐富的類別庫讓程式設計人員使用 ，包含
  • 呈現基本資料型態和例外（exception）
  • 支援 I/O 與網路
  • 支援各種型態的反射（reflection）
  • 支援平台與應用程式安全防護
  • 與底層的作業系統整合
  • 為建構 GUI 程式提供服務
  • 提供資料庫存取能力
  • 支援 XML Web 服務的開發
.N et Fr amework 所有的功能幾乎都會透過一組受控管的型別—稱為基礎類別程
式庫（Base Cl ass Libr ary ，簡稱BCL）—公開出來。
因為這些型別都與CLS相容，所以它們都可由任何的.N ET 程式語言來加以取用。
BCL 型別會成群地放置在命名空間中，並透過.NET 平台中的一組配件（DLL s）加以匯出。
當您在C#應用程式中使用這些型別時，您需在編譯時參照適當的配件。
為了能夠在.Net 平台中更有效率地使用C#，了解預定之類別程式庫的一般能力，
是件很重要的事。然而，這些程式庫實在太大，無法一一在書中做完整的討論，
因為它包含了將近4,500 個型別，並組成120 個命名空間，以及匯出成40 個不同的
配件。

相對地，在本章中，我們將提供整個BCL 的概述（劃分成不同的領域）並提供相
關型別以及命名空間的參考，以此為基礎您可以自行在.NET Fr amewor k 之SDK
中探索完整的細節。
可藉以探索BCL 的有用工具包括.NET Fr amework 的SD K 文件、WinCV.exe 類別
瀏覽器，以及IL Asm.exe 反組譯器（di sassembl er ）。


WMI(Windows管理規範)
WMI（Windows管理規範：Windows Management Instrumentation）是Microsoft基於Web的企業管理（WBEM）的實現，同時也是一種基於標準的系統管理介面。Windows 2000或以後的版本默認安裝了WMI。而Windows NT4.0雖然支援WMI，但WMI核心元件並沒有隨著NT4.0一起發佈，如果需要WMI，你可以在VS.NET企業構建版中的第五張盤中的“WMI”目錄中找到它。（需要SP4）支援。

也可以在這裡下載 WMI SDK. WMI SDK

NET框架中與WMI規範有關的命名空間有兩個,分別是System.Management和System.Management.Instrumentation兩個命名空間。（Bitmap from CSDN)

System.Management.Instrumentation命名空間提供的類用來設置用戶自定義的應用程式，使得這些應用程式物件能夠符合WMI的規範，而System.Managemen命名空間提供的類物件滛訪問各種管理物件提供了面向物件的編程介面，命名空間System.Management中的成員是很複雜的，下面六個類應該是學習的重點，分別是ConnectionOptions、ManagementScope、ObjectQuery、ManagementObjectSearcher、ManagementObject-Collection和ManagementObject.


以命令列方式編譯C#(The command line compiler C#)
I’m sure there is a lot of you guys out there who prefer the command line to windows. I myself love the command line. It makes you feel more connected to the computer and in a way it is less complicated (visually anyway), that is if you know what your doing. So in this tutorial I am going to show you how to use the command line compiler and list the commands that can be used.

I. 基本編譯(Basic Compiling)

Ok this is simple say you have a file named first.cs to compile it type

csc first.cs

II. Response files

That’s right C# supports response files. A response file is basically a file that contains commands. Lets say you have 20 files to compile and you want to compile them all with the same commands. You would simply create a file with all these commands and when you compile your code you list the response file(shown below). The extension of a response file is *.rsp but you can most likely use any file name extension.

csc @<responcefile.rsp>

When you compile, the default response file called is csc.rsp. If you want to get a better idea how to make a response file simply check this one out. In my opinion, the best way to make a rsp is simply take the default one and do a “save as” to another file name. Then play around with it. You can also use multiple rsp files if needed. This way you can divide your rsp files into bundles of commands.

III. Commands for response files.

Now your probably wondering what your options there are for commands and what the commands that are in the csc.rsp file do. So here is a list* of all the commands with descriptions. Most of these are available in windows under compiler options but not all of them.

==Error Reporting Options==

/warnaserror[+|-]
  • This causes the compiler to treat everything as errors even warnings.
    /w[arn]:<level>
  • set warning level (0-4)
    /nowarn:<list>
  • Specify a comma-seperated list of warnings to not report
    /fullpaths
  • Specify the full path to a file in compilation errors or warnings

    ==Input Options==

    /addmodule:<file>
  • Specify modules that are part of this assembly
    /codepage:<id>
  • Use the specified code page id to open source files
    /nostdlib[+|-]
  • Do not import the standard library (mscorlib.dll). This might be used to switch to a different standard library for a specific target device.
    /recurse:<filespec>
  • Search subdirectories for files to compile
    /lib:<file list>
  • Specify additional directories to search for references
    /noconfig
  • Don’t auto-include csc.rsp file.
    /r[eference]:<file>
  • Specify metadata file to import

    ==Output Options==

    /o[ptimize] [+|-]
  • Enable optimizations
    /out:<outfile>
  • Set output filename
    /t[arget]:module
  • Create module that can be added to another assembly
    /t[arget]:library
  • Create a library instead of an application
    /t[arget]:exe
  • Create a console application (default)
    /t[arget]:winexe
  • Create a Window GUI application
    /filealign:n
  • Specify then alignment used for the output file sections
    /baseaddress:<addr>
  • Specify the library base address

    ==Processing Options==

    /debug:{full|pdbonly}
  • Emit debugging information Full allows connecting to a running instance.
    /incr[emental] [+|-]
  • Perform an incremental build
    /checked[+|-]
  • Check for overflow and underflow by default
    /unsafe[+|-]
  • Allow “unsafe” code
    /d[efine]:<def-list>
  • Define conditional compilation symbol(s)
    /doc:<file>
  • Specify a file to store XML Doc Comments into
    /win32res:<resfile>
  • Specify a Win32 resource file
    /win32icon:<iconfile>
  • Specify a Win32 icon file
    /res[ource]:<file>[,<name>[,
  • Embeds a resource into this assembly
    /linkers[ource] :<file>[,<name>[,
  • Link aresource into assembly without embedding it

    ==Miscellaneous==

    /? Or /help
  • Display usage message
    /nologo
  • Do not display the compiler copyright banner
    /bugreport:<file>
  • Create a report file
    /utf8output
  • Output compiler messages in UTF8 format
    /main:<classname>
  • Specify the class to use for the Main() entry point

    *This list of commands was derived from the book “A programmers Introduction to C#” second edition


C# Intermediate Language Disassembler(ILDASM)
By Vivek Gupta

This is my first C# article. I searched the net to see what articles were available on C# and found that there were none for the IL disassember, a very useful tool for .NET programmers. Users will find it to be very important once they start using it. You can get IL disassemble tool as ILDasm.exe in directory C:\Program Files\Microsoft.NET\FrameworkSDK\bin (Windows OS).

So what does this tool do?

The answer to this question is found in the tutorial supplied with .NET SDK as "The ILDSAM tool parses any .NET Framework EXE/DLL module and shows the information in a human-readable format. It allows user to see the pseudo assembly language for .NET". IL disassmeber tool shows not only namespace but also types including their interfaces. As its name suggests, it is an intermediate language, so it has its own specification. Users can also write programs using this intermediate language, its very similar to assembly language of the old days.

I will use a simple example and use ILDASM.exe

//Hello World Program HelloWorld.cs
using System;

class HelloWorld
{
     static void Main()
     {
        Console.WriteLine("Hello, world!");
     }
}
Complier it on command line by using csc HelloWorld.cs

Helloworld.exe file will be generated

Now use the command ildasm HelloWorld.exe

You will see a screen like this.

Here you can see all of the Symbols. The table below explains what each graphic symbol means. Some of them you can find in HelloWorld's members.

The tree in this window shows that manifest information contained inside HelloWorld.exe. By double-clicking on any of the types in the tree, you can see more information about the type.

Double-clicking the ".class public auto ansi" entry shows the following information:

Users can see that the HelloWorld type is derived from the System.Object type.

The first method, .ctor, is a constructor. This particular type has just one constructor but other types may have several constructors each with a different signature. If you double-click on the constructor method, a new window appears showing the IL (intermediate language) contained within the method:

The Common Language Runtime is stack based. So, in order to perform any operations, the operands are first pushed onto a virtual stack and then the operator executes. The operator grabs the operands off the stack, performs the desired operation and places the result back on the stack. At any one time, this method will have no more than 8 operands pushed onto the virtual stack. We can see thby looking at the ".maxstack" attribute ( Maximum Stack size ) that appears just before the IL code. In the above code maxstack is shown as 8.

Lets examine the IL code :

IL_0000:  ldarg.0 : Load Object this pointer in stack
IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
IL_0006:  return the value loaded in stack
If user make a double click on main: void()
It will look like this:

If we will examine IL Code:

IL_0000:  ldstr      "Hello, world!"
IL_0005:  call       void [mscorlib]System.Console::WriteLine(class System.String)
IL_000a:  ret
LDSTR: Load String.
First line indicates load String in stack.
Second Line indicates call method System.Console:: WriteLine as the fetch the value from stack put in this method and again put the result in stack.
Third line shows fetch the final value from stack and return it.

There are some advance option also available. The extra options are enabled by running ILDASM with the /ADV ("ADVanced") command-line switch. When /ADV is specified, ILDASM enables additional command-line switches. For the user convenience I will summarize some basic instructions here below.

Instruction | Meaning
LDC | This instruction pushes a hard coded number on the stack.
LDARG and LDARGA | Load argument and load argument address, respectively
LDLOC and LDLOCA | Load local variable and load local variable address, respectively
LDFLD and LDSFLD | Load Object Field and Load Static Field of a Class, respectively
LDELEM | Load an element of an array
LDLEN | Load the length of an array
STARG | Store a value in an argument slot
STELEM | Store an element of an array
STFLD | Store into a field of an object
CEQ | Compare equal
CGT | Compare greater than
CLT | Compare less than
BR | Unconditional branch
BRFALSE and BRTRUE | Branch on false and branch on true, respectively
CONV | Data conversion
NEWARR | Create a zero-based, one-dimensional array
NEWOBJ | Create a new object
BOX | Convert value type to object reference
UNBOX | Convert boxed value type to its raw form
CALL and CALLVIRT | Call a method and call a method associated at runtime with an object, respectively


WinCV - .Net class viewer
所在位置：
C:\Program Files\Microsoft.NET\SDK\v1.1\Bin\WinCV.exe

Every now and then we come across a lot of .Net framework class names. A lot of time we want to know what namespace this class belongs to. If you have access to documentation you can quickly find it. But there is a lesser known tool WinCV - class viewer provided in .Net framework SDK. This utility can be used to quickly search for the information you are looking for a given class.

This utility is present in Bin folder of Framework SDK. You can launch this application in two ways. First is by double clicking on WinCV.exe file in the bin folder. And second is by typing in WinCV.exe on command line.


Windows Forms Resource Editor (Winres.exe)

The Windows Forms Resource Editor is a visual layout tool that helps localization experts localize Windows Forms forms. The .resx or .resources files that are used as input to Winres.exe can be created using a visual design environment such as Microsoft Visual Studio .NET. For information on deploying resources in .NET Framework applications, see Resources in Applications.

winres resourceFile
Argument | Description
resourceFile | The resource file to localize. This file must be a Windows Forms form .resx or .resources file generated by the Visual Studio. NET designer. Winres.exe cannot open generic .resx or .resources files.
Option | Description
/? | Displays command syntax and options for the tool.

Remarks

Winres.exe hosts the Windows Forms Form Designer and Properties window. You can use these features to open a .resources, or .resx, file for a neutral culture, containing a Windows Forms form to localize. In the designer, localizers can edit control labels and adjust the location and size of controls to accommodate the labels for the target culture. Winres.exe allows you to save these modifications in a localized .resx or .resources file for the target culture.

Winres.exe allows third-party localizers to recreate a design-time version of a Windows Forms form and localize it without having access to the source code or all the controls on the Windows Forms form. If Winres.exe cannot resolve the type of a control, it creates a placeholder control in the localized .resx or .resources file. The placeholder control appears on the Windows Forms form as a hatched window. The size and position of the hatched window matches that of the actual control. All the available localizable properties for the placeholder control appear in the Properties window. Any changes that you make to the placeholder control are saved in the actual control.

Note Do not use Winres.exe to edit strings for a neutral culture. Winres.exe saves only localizable properties to the target file. All other information is lost.

Before you begin to localize an application's Windows Forms forms, you should decide whether you want to use Visual Studio .NET or Winres.exe as the localization tool. The localized .resx files produced by each tool are not interchangeable. Therefore, after you have started to localize with one tool, you cannot switch to the other tool.

The advantage of Visual Studio .NET is that you can use it to both develop and localize an application. To localize a form, after development is complete, set the form's Localizable property to true and change its Language property to the desired target culture. Then, edit strings and adjust the location and size of controls to accommodate the strings for the target culture. When you save the localized .resx file, Visual Studio .NET writes only the localizable properties (properties that changed in the target culture) to the file. Visual Studio .NET automatically creates a satellite assembly for the localized .resx file in the correct directory location. For more information on using Visual Studio .NET to localize forms, see Walkthrough: Localizing Windows Forms in the Visual Studio .NET documentation.

Although Visual Studio .NET provides an integrated development and localization environment, Winres.exe is the recommended tool to use if localization will be done by third-party localizers. Because Winres.exe is a localization tool only, it allows for a cleaner separation of an application's code from the forms to be localized and is more practical for managing large projects.

To localize using Winres.exe, you must first develop an application using a visual designer like Visual Studio .NET. When development is complete, set the form's Localizable property to true, and then hand off the .resx file for the neutral culture to a third-party localizer. This .resx file contains extra information that Winres.exe uses to recreate a design-time version of the original form. Due to the differences in the content of the .resx files produced by Winres.exe and Visual Studio .NET, Winres.exe cannot open a .resx file that was previously localized for a target culture using Visual Studio .NET. For example, Winres.exe can open the neutral file project1.resx, but it cannot open the localized file project1.fr-FR.resx generated by Visual Studio .NET. Likewise, a .resx file that was localized for a target culture using Winres.exe is not compatible with Visual Studio .NET. If you choose to use Winres.exe as your localization tool, you must convert your localized .resx files into .resources files using the Resource File Generator (Resgen.exe). Then use either the Assembly Linker (Al.exe) or the C# Compiler (Csc.exe) to compile the .resources files into satellite assemblies. For more information on this process, see Creating Satellite Assemblies.

Examples

To localize a .resx or .resources file associated with a form

  1. Type winres at the command prompt to run Winres.exe.
  2. To open the neutral resources for a form to localize, click the Open command on the File menu and navigate to the file to open. Alternately you can specify the file to open at the command line when you start Winres.exe. The following command starts Winres.exe and loads the form associated with MyResources.resx in the Form Designer.
    winres MyResources.resx

    The following command starts Winres.exe and loads the form associated with MyResources.resources in the Form Designer.

    winres MyResources.resources
  3. Select controls on the form and change text properties to reflect the localized language. Move or resize controls as necessary to accommodate the localized text.
  4. To save the localized version of the .resx or .resources file, click the Save As command on the File menu. The tool displays the Select Culture window. Double-click the appropriate culture. The tool saves the file, using the naming convention that the runtime expects for localized resource files. For example, if you localize MyResources.resources for German in Germany, the tool saves the file as MyResources.de-DE.resources. If you localize MyResources.resx for German in Germany, the tool saves the file as MyResources.de-DE.resx. For more information on resource naming conventions, see Packaging and Deploying Resources. For a list of the predefined culture names used by the runtime, see the CultureInfo Class.


TlbExp.exe(NET轉COM)
Type Library Exporter (TlbExp.exe)

說明：轉換 .NET assembly 到 COM type library
執行範例：

TlbExp NetComponent.dll ComComponent.tlb


TlbImp.exe(COM轉NET)
Type Library Importer (TlbImp.exe)

說明：轉換 COM type library 到 .NET DLL
執行範例：
tlbimp ComComponent.tlb NetComponent.dll


PRB: Cannot Add ActiveX Control to Toolbox
(aximp.exe)Cannot Add ActiveX Control to Toolbox
適用於
This article was previously published under Q320780

SYMPTOMS

After you use Aximp.exe to wrap an ActiveX control, you may receive the following error message when you try to add the Ax wrapper to the .NET Framework Components tab in the Customize Toolbox dialog box:
There are no components in fully qualified path to the Ax wrapper dll that can be placed on the toolbox.

CAUSE

By default, the ToolboxItem attribute is set to False in the generated Ax wrapper. A False value for this attribute prevents the control or wrapper from being added to the Toolbox.

RESOLUTION

There are two resolutions to this problem:
  • Import the Control by Using the Development Environment

    The easiest way to avoid this problem is to add the ActiveX control to the Toolbox from the COM Components tab instead of by running Aximp.exe and using the .NET Framework Components tab in the Customize Toolbox dialog box. The development environment generates the wrappers that you need when you add the control through the COM Components dialog box.
  • Manually Change the Attribute Value
    1. NOTE: All of the file names in the commands in step 1 and step 3 must be fully qualified path names.

    2. Run Aximp.exe with the /source switch to generate the Visual C# code for the Ax wrapper for the specified ActiveX control. The file generates the source file, an interop assembly, and an Ax wrapper assembly for the specified control. For example, the following command generates the Visual C# source code (Axmscomdlg.cs) for the Ax wrapper for the Microsoft Common Dialog Control:
      aximp comdlg32.ocx /out:AxMSComDlg.dll /source
    3. Open the Visual C# source file in a text editor such as Notepad, insert the following attribute statement, and then save the .cs source file:
      [System.ComponentModel.ToolboxItemAttribute(true)]
      NOTE: Make sure that you insert the statement after the namespace and before the class definition.

    4. Use the following command to compile the .cs file:

      NOTE: Make sure that you reference the runtime callable wrapper (RCW) assembly:
      csc /t:library /r:MSComDlg.dll /out:AxMSComDlg.dll AxMSComDlg.cs

MORE INFORMATION

Aximp.exe converts a whole ActiveX Control type library at one time and produces a set of assemblies that contain the Common Language Runtime meta data and control implementation for the types that are defined in the original type library. The generated files are named according to the following pattern:
  • Common Language Runtime proxy for COM types: Progid.dll
  • Windows Forms proxy for ActiveX controls (where Ax signifies ActiveX): AxProgid.dll
For the control that is used as an example in this article (Comdlg32.ocx), the files that are created are Mscomdlg.dll and Axmscomdlg.dll.)

Steps to Reproduce the Problem

This problem can be reproduced by using any ActiveX control. The Microsoft Common Dialog Control (Comdlg32.ocx) is used in this example.
  1. Execute the following command from a Visual Studio .NET command prompt:
    aximp comdlg32.ocx /out:AxMSComDlg.dll /source
    NOTE: This command generates the Ax wrapper (Axmscomdlg.dll), the RCW (Mscomdlg.dll), a program database file (Axmscomdlg.pdb), and the Visual C# source file (Axmscomdlg.cs) for the Ax wrapper.

  2. Start a new Visual Basic or Visual C# Windows Application project. By default, Form1 is created.
  3. On the Tools menu, click Customize Toolbox.
  4. Click the .NET Framework Components tab.
  5. Click Browse, and then locate the folder that contains the Ax wrapper that was generated in step 1.
  6. Click to select Axmscomdlg.dll, and then click Open. You receive the error message that is described in the "Symptoms" section.

The information in this article applies to:

  • Microsoft Visual C# .NET (2002)
  • Microsoft Visual Basic .NET (2002)
  • Microsoft Visual J# .NET (2002)


首先介紹一下.Net環境下的程式形成程序。[參照下圖]

(1)程式員用高級OO語言(C#,VB.Net,VC.Net,Cobol,Python..)編寫程式碼，這些程式碼經過
.Net編譯器（比如Visual Studio.Net），編譯成統一的MSIL(Microsoft Intermediate Language)。NET應用程式是以MSIL的形式出現的，只有在程式執行的時候才通過即時編譯器JIT(Just-In-Time)被編譯為本機程式碼。
(2)程式執行的時候，由JIT裝入程式的MSIL，JIT同時作了很多其他的工作（裝載相應的執行庫，安全檢測。。） 最後JIT將轉化成本地機器碼(EXE或者DLL)。
(3)本地機器碼被裝入記憶體，開始執行。

就是通過這幾個步驟，.net實現了設計語言無關（都轉化成MSIL）；平台無關（執行的
時候根據本地配置，生成相應的機器碼）；安全性（JIT裡面做了很多檢測）。

作為Cracker，可以用.Net Framework SDK自帶的工具進行MSIL和EXE(DLL)之間的互換：
利用FrameworkSDK\Bin\目錄下的ilasm和ildasm，安裝了.Net Framework以後，這兩個程式已經被加為系統路徑，可以在"執行"裡面輸入"ilasm"或者"ildasm"直接打開。

(1)ilasm示例：
下面的命令對 MSIL 檔案 myTestFile.il 進行彙編並產生可執行檔案 myTestFile.exe。
ilasm myTestFile
下面的命令對 MSIL 檔案 myTestFile.il 進行彙編並產生 .dll 檔案 myTestFile.dll。
ilasm myTestFile /dll
下面的命令對 MSIL 檔案 myTestFile.il 進行彙編並產生 .dll 檔案 myNewTestFile.dll。
ilasm myTestFile /dll /output:myNewTestFile.dll
(2)ildasm示例
下面的命令使 PE 檔案 MyHello.exe 的元資料和反彙編程式碼顯示在 Ildasm.exe 的預設 GUI 中。
ildasm myHello.exe
下面的命令對 MyFile.exe 檔案進行反彙編，並將結果 MSIL 彙編程程式文字存儲在 MyFile.il 檔案中。

ildasm MyFile.exe /output:MyFile.il
下面的命令對 MyFile.exe 檔案進行反彙編，並將結果 MSIL 彙編程式文字顯示到控制台視窗中。

ildasm MyFile.exe /text
如果檔案 MyApp.exe 包含嵌入的托管和非托管資源，則下面的命令將產生以下 4 個檔案：MyApp.il、MyApp.res、Icons.resources 和 Message.resources：

ildasm MyApp.exe /output:MyApp.il
下面的命令對 MyFile.exe 的 MyClass 類中的 MyMethod 方法進行反彙編，並將輸出顯示到控制台視窗中。

ildasm /item:MyClass::MyMethod MyFile.exe /text
在上面的示例中，可能有幾個具有不同簽名的 MyMethod 方法。下面的命令對返回類型為 void 且帶有參數 int32 和 System.string 的 MyMethod 方法進行反彙編。

ildasm /item:"MyClass::MyMethod(void(int32,class System.String))" MyFile.exe /text

通過上面分析可知，我們(Cracker)需要分析的對象就是MSIL形式的檔案了，當然估計很快就有不少"混淆器"誕生，讓我們無法從exe中恢復MSIL，不過肯定也會有相應得"反混淆器"被開發出來，所以不必擔憂，嘿嘿~~ [image] 下一貼我將介紹MSIL.

*研究.net可以找一本 Serge Lidin 著的《Inside Microsoft𦲷 .NET IL Assembler 》。
*.NET Interoperability: .NET <-> Win32：
http://www.blong.com/Conferences/BorConUK2002/Interop1/Win32AndDotNetInterop.htm


.NET Interoperability: .NET 坛 Win32

Brian Long (www.blong.com)

Table of Contents

  • Introduction
  • .NET Clients Using Win32 DLL Exports (P/Invoke)
    • Traditional Syntax
    • Attribute Syntax
    • Working Out The Parameter Types
    • Win32 Errors
    • HRESULT Return Values
    • Performance Issues
  • Win32 Clients Using .NET Assembly Exports (Inverse P/Invoke)
    • Creative Round Tripping
      • Round Tripping, Step 1: Disassembly
      • Round Tripping, Step 2: Reassembly
    • Modifying A .NET Assembly Manifest
    • Exporting .NET Methods
    • A Maintenance Nightmare?
  • Summary
  • References/Further Reading
  • About Brian Long

Click here to download the files associated with this article.

Introduction

.NET is a new programming platform representing the future of Windows programming. Developers are moving across to it and learning the new .NET oriented languages and frameworks, but new systems do not appear overnight. It is a lengthy process moving entire applications across to a new platform and Microsoft is very much aware of this.

To this end, .NET supports a number of interoperability mechanisms that allow applications to be moved across from the Win32 platform to .NET piece by piece, allowing developers to still build complete applications, but which comprise of Win32 portions and some .NET portions, of varying amounts.

When building new .NET applications, there are provisions for using existing Win32 DLL exports (both custom DLL routines and standard Win32 API routines) as well as COM objects (which then act like any other .NET object).

When building Win32 applications there is a process that allows you to access individual routines in .NET assemblies. When building Win32 COM client applications, there is a mechanism that lets you use .NET objects as if they were normal COM objects.

This paper investigates the interoperability options that do not involve COM:

  • .NET assemblies accessing Win32 DLL exports (including Win32 APIs)
  • Win32 applications/DLLs accessing routines in .NET assemblies

The accompanying paper, .NET Interoperability: COM Interop (see Reference 1), looks at interoperability between .NET and COM (termed COM Interop).

The coverage will have a specific bias towards a developer moving code from Borland Delphi to Borland Delphi for .NET, however the principles apply to any other development tools. Clearly the Delphi-specific details will not apply to other languages but the high-level information will still be relevant.

Because of the different data types available on the two platforms (such as PChar in Win32 and the new Unicode String type on .NET), inter-platform calls will inevitably require some form of marshaling process to transform parameters and return values between the data types at either end of the call. Fortunately, as we shall see, the marshaling is done for us after an initial process to set up the inter-platform calls.

Note: the information in the paper is based around the Delphi for .NET Preview compiler as shipped with Delphi 7 and Updates to it made available after Delphi 7's release. At the time of writing the Delphi for .NET Preview compiler represents the only .NET-enabled version of Delphi available. When Delphi 8 for .NET (codenamed Octane) becomes available, various steps in this paper that use the Delphi for .NET Preview compiler, as well as some of the code snippets, may require changes.

Note: an updated version of this article specific to Delphi 8 for .NET is now available online. Click here to read it.

.NET Clients Using Win32 DLL Exports (P/Invoke)

This is the most common form of interoperability, which is why we are looking at it first. Whilst the .NET Framework is large and wide ranging, there are still things that you can do using Win32 APIs that are not possible using just the .NET framework. Simple examples include producing noises (using the Win32 APIs MessageBeep and Beep) or performing high accuracy timing (with QueryPerformanceCounter and QueryPerformanceFrequency).

In cases like this, where it would be helpful, or indeed necessary, to make use of a Win32 DLL routine from a .NET application you use a mechanism called the Platform Invocation Service, which is usually referred to as Platform Invoke or simply P/Invoke (or PInvoke). This service operates through a custom attribute, DllImportAttribute, defined in the System.Runtime.InteropServices namespace. The attribute allows the name of the implementing DLL (and other necessary information) to be associated with a procedure or function declaration, thereby allowing the DLL routine to be called.

The marshaling of parameters and return values between the managed .NET world and the unmanaged Win32 world is automatically performed by the Interop Marshaler used by the COM Interop support.

For an example, consider a Win32 DLL that exports three routines with the following signatures:

function DoSomething(I: Integer): Bool; cdecl;
function DoSomethingElseA(Msg: PChar): Bool; cdecl;
function DoSomethingElseW(Msg: PWideChar): Bool; cdecl;

As you can see, they all use the C calling convention, rather than the usual Win32 standard calling convention. The first routine takes an integer and returns a Boolean value, though using the standard Windows type Bool (a 32-bit Boolean value, equivalent to LongBool). The second routine takes a pointer to an ANSI character string (PChar is the same as PAnsiChar) and the last takes a pointer to a Unicode string.

To construct an appropriate import declaration that uses the P/Invoke mechanism you have two options, using the traditional Delphi DLL import syntax or using the custom P/Invoke attribute.

Traditional Syntax

You can use historic Delphi import declaration syntax and completely ignore the custom attribute, although there are caveats to this. We must understand the implications of leaving out the custom attribute in doing this. In point of fact, Delphi for .NET will create a custom attribute behind the scenes and the key thing is to understand what values the attribute fields will take.

The first exported routine can be declared in a .NET import unit like this:

unit Win32DLLImport;

interface

function DoSomething(I: Integer): Boolean; cdecl;

implementation

const
  Win32DLL = 'Win32DLL.dll';

function DoSomething(I: Integer): Boolean;
external Win32DLL name 'DoSomething';

end.

The calling convention is specified using the standard cdecl directive in the declaration part, and the DLL name and optional real DLL export name are specified in the implementation part.

This works fine for routines that do not have textual parameter types or return types. Internally, the compiler massages the declaration to use the P/Invoke attribute, like this:

function DoSomething(I: Integer): Boolean;
...
[DllImport(Win32DLL, CallingConvention = CallingConvention.Cdecl)]
function DoSomething(I: Integer): Boolean;
external;

Note that as well as the attribute constructor parameter (the DLL name) the attribute also has a CallingConvention field (attribute fields are often called parameters) that is set to specify the C calling convention. Indeed there are other parameters available in the attribute, which assume default values, and that is where problems can arise when the routine uses textual parameters or return types.

Attribute Syntax

The alternative to using traditional syntax is to explicitly specify the P/Invoke attribute in the import declaration. This will often be necessary when the routine takes textual parameters due to the default value of the attribute's CharSet parameter.

CharSet can take these values:

  • Ansi: textual parameters are treated as ANSI strings
  • Auto: textual parameters are treated as ANSI strings on Win9x platforms and Unicode strings on NT-based systems (WinNT/2K/XP). This is the default setting
  • None: this is the same as Ansi
  • Unicode: textual parameters are treated as Unicode strings

It is common for custom DLL routines to be implemented to take a fixed string type (either ANSI or Unicode), typically ANSI as Unicode is not implemented on Win9x systems. The same DLL will be deployed on any Windows system.

On the other hand, Win32 APIs that take string parameters are implemented twice; one implementation has an A suffix (the ANSI one) and one has a W suffix (the Unicode one). On Win9x systems the Unicode implementation is stubbed out as Unicode is not supported.

If the CharSet field is set to Ansi and the routine you are declaring is called Foo, at runtime the P/Invoke system will look for Foo in the DLL and use it if found; if it is not found it will look for FooA. However if CharSet is set to Unicode then FooW will be sought first, and if it is not found Foo will be used, if present.

The Auto value for CharSet means that on Win9x systems, string parameters will be turned into ANSI strings and the ANSI entry point search semantics will be used. On NT-based systems the parameters will be turned to Unicode and the Unicode search semantics will be used. For normal Win32 APIs this is just fine, but for most custom DLL routines a specific CharSet value must be specified.

In the case of the sample DLL exports shown above, we have two implementations of a routine, one that takes an ANSI parameter and one that takes a Unicode parameter. These are named following the Win32 conventions and so we could define a single .NET import like this, which would work fine on all Windows systems, calling DoSomethingElseA or DoSomethingElseW based on the Windows system type:

function DoSomethingElse(const Msg: String): Boolean; cdecl;
...
function DoSomethingElse(const Msg: String): Boolean;
external Win32DLL;

This is the same as explicitly writing the P/Invoke attribute like this:

function DoSomethingElse(const Msg: String): Boolean;
...
[DllImport(Win32DLL, EntryPoint = 'DoSomethingElse', CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl)]
function DoSomethingElse(const Msg: String): Boolean;
external;

If we didn't have both an ANSI and Unicode implementation, and instead had just an ANSI version, then the single import declaration would look something like this:

function DoSomethingElse(const Msg: String): Boolean;
...
[DllImport(Win32DLL, EntryPoint = 'DoSomethingElse', CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
function DoSomethingElse(const Msg: String): Boolean;
external;

We can now define two specific .NET imports for the ANSI and Unicode versions of the routine as follows:

function DoSomethingElseA(const Msg: String): Boolean;
function DoSomethingElseW(const Msg: WideString): Boolean;
...
[DllImport(Win32DLL, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
function DoSomethingElseA(const Msg: String): Boolean;
external;

[DllImport(Win32DLL, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
function DoSomethingElseW(const Msg: String): Boolean;
external;

Note that the default value of the CallingConvention parameter is StdCall when you use DllImportAttribute and omit it, however when you use traditional Delphi syntax and do not specify a calling convention, Delphi specifies a calling convention of WinApi, which is equivalent to StdCall on Windows, but equivalent to Cdecl on Windows CE.

Working Out The Parameter Types

In this case the .NET equivalent of the original data types was quite straightforward: PChar, PAnsiChar and PWideChar become String, Bool becomes Boolean and Integer becomes Integer. In other cases, the corresponding types to use in the .NET import declaration may not be so clear, particularly if the original declaration was written in C.

In many cases the appropriate information can be obtained by finding a normal Win32 API that uses the same parameter type in the same way and looking up the declaration in the Win32 import unit supplied with Delphi for .NET, Borland.Win32.Windows.pas (in Delphi for .NET's Source\RTL directory). This unit contains import declarations for the majority of the standard Win32 APIs.

For example, consider an existing API or two that we can test the theory out with: GetComputerName and GetUserName. If these were part of some third party DLL, targeted at C/C++ programmers, that we were using in our Win32 applications then we may well want to use them in a .NET application. The C declarations of these routines look like:

BOOL GetComputerName(
    LPTSTR lpBuffer,	// address of name buffer
    LPDWORD nSize 	// address of size of name buffer
   );
BOOL GetUserName(
    LPTSTR lpBuffer,	// address of name buffer
    LPDWORD nSize 	// address of size of name buffer
   );

Since you have already used them in your Win32 applications you will already have Delphi translations of these (which in this example's case we can get from the Delphi 7 Windows.pas import unit):

function GetComputerName(lpBuffer: PChar; var nSize: DWORD): BOOL; stdcall;
function GetUserName(lpBuffer: PChar; var nSize: DWORD): BOOL; stdcall;

In both cases the lpBuffer parameter is an out parameter that points to a buffer (a zero-based Char array) that receives the string with the computer's or user's name. The nSize parameter is an in/out parameter that specifies how large the buffer is, so the routine doesn't write past the end of it. If the buffer is too small, the routine returns False, otherwise it returns how many characters were written to the buffer.

If the documentation for the routine tells you the maximum size of the returned string you can easily make the buffer that large, otherwise you will have to check the return value; if it fails try a larger buffer.

There are many Win32 routines that take parameters that work this or a similar way, such as GetWindowsDirectory, GetSystemDirectory and GetCurrentDirectory. Sometimes the routine returns the number of characters (either that it wrote, or that it requires) and the buffer size parameter is passed by value (as in the routines just referred to), other times the function returns a Boolean value and the buffer size parameter is passed by reference. Win32 import declarations for these last three routines look like this:

function GetWindowsDirectory(lpBuffer: PChar; uSize: UINT): UINT; stdcall;
function GetSystemDirectory(lpBuffer: PChar; uSize: UINT): UINT; stdcall;
function GetCurrentDirectory(nBufferLength: DWORD; lpBuffer: PChar): DWORD; stdcall;

The corresponding Delphi for .NET declarations for all these routines can be found in Borland.Win32.Windows.pas. The declarations in the interface section look like this:

function GetUserName(lpBuffer: StringBuilder; var nSize: DWORD): BOOL; stdcall;
function GetComputerName(lpBuffer: StringBuilder; var nSize: DWORD): BOOL; stdcall;
function GetWindowsDirectory(lpBuffer: StringBuilder; uSize: UINT): UINT; stdcall;
function GetSystemDirectory(lpBuffer: StringBuilder; uSize: UINT): UINT; stdcall;
function GetCurrentDirectory(nBufferLength: DWORD; lpBuffer: StringBuilder): DWORD; stdcall;

As you can see, these types of string parameters are best represented using StringBuilder objects. StringBuilder is an appropriate type when the underlying Win32 routine will modify the string buffer, whereas String can be used when the routine will not modify its content (.NET String objects are immutable).

StringBuilder objects must have their capacity set to your desired size and that capacity can then be passed as the buffer size. The following five event handlers show how each of these APIs can be called from Delphi for .NET through P/Invoke.

procedure TfrmPInvoke.btnUserNameClick(Sender: TObject; Args: EventArgs);
var
  UserBuf: StringBuilder;
  UserBufLen: DWord;
begin
  UserBuf := StringBuilder.Create(64);
  UserBufLen := UserBuf.Capacity;
  if GetUserName(UserBuf, UserBufLen) then
    MessageBox.Show(UserBuf.ToString)
  else
    //User name is longer than 64 characters
end;

procedure TfrmPInvoke.btnComputerNameClick(Sender: TObject; Args: EventArgs);
var
  ComputerBuf: StringBuilder;
  ComputerBufLen: DWord;
begin
  //Set max size buffer to ensure success
  ComputerBuf := StringBuilder.Create(MAX_COMPUTERNAME_LENGTH);
  ComputerBufLen := ComputerBuf.Capacity;
  if GetComputerName(ComputerBuf, ComputerBufLen) then
    MessageBox.Show(ComputerBuf.ToString)
end;

procedure TfrmPInvoke.btnWindowsDirClick(Sender: TObject; Args: EventArgs);
var
  WinDirBuf: StringBuilder;
begin
  WinDirBuf := StringBuilder.Create(MAX_PATH); //Set max size buffer to ensure success
  GetWindowsDirectory(WinDirBuf, WinDirBuf.Capacity);
  MessageBox.Show(WinDirBuf.ToString)
end;

procedure TfrmPInvoke.btnSystemDirClick(Sender: TObject; Args: EventArgs);
var
  SysDirBuf: StringBuilder;
begin
  SysDirBuf := StringBuilder.Create(MAX_PATH); //Set max size buffer to ensure success
  GetSystemDirectory(SysDirBuf, SysDirBuf.Capacity);
  MessageBox.Show(SysDirBuf.ToString)
end;

procedure TfrmPInvoke.btnCurrentDirClick(Sender: TObject; Args: EventArgs);
var
  CurrDirBuf: StringBuilder;
begin
  CurrDirBuf := StringBuilder.Create(MAX_PATH); //Set max size buffer to ensure success
  GetCurrentDirectory(CurrDirBuf.Capacity, CurrDirBuf);
  MessageBox.Show(CurrDirBuf.ToString)
end;

In addition to the Delphi Win32 import unit you can also find C# P/Invoke declarations for much of the common Win32 API in Appendix E of .NET and COM (see Reference 2).

Win32 Errors

Win32 routines often return False or 0 to indicate they failed (the documentation clarifies whether this is the case), leaving the programmer to call GetLastError to find the numeric error code. Delphi programmers can call SysErrorMessage to turn the error number into an error message string to do with as they will or call RaiseLastWin32Error or RaiseLastOSError to raise an exception with the message set to the error message for the last error code. Additionally Delphi offers the Win32Check routine that can take a Win32 API Boolean return value; this calls RaiseLastOSError if the parameter is False.

It is important that when calling Win32 routines from .NET you do not declare or use a P/Invoke declaration for the Win32 GetLastError API as it is unreliable (due to the interaction between .NET and the underlying OS). The Borland.Win32.Windows.pas unit does provide such a declaration.

Instead you should use Marshal.GetLastWin32Error from the System.Runtime.InteropServices namespace. This routine relies on another DllImportAttribute field being specified. The SetLastError field defaults to False meaning the error code is ignored. If set to True the runtime marshaler will call GetLastError and cache the value for GetLastWin32Error to return.

Note that all the Win32 imports in Delphi for .NET Preview omit this field, meaning it defaults to False and so you will not get any OS error information without redeclaring the pertinent APIs. For example, this is the GetComputerName declaration from the Borland.Win32.Windows.pas implementation section:

function GetComputerName; external kernel32;

However the Delphi for .NET Preview Update remedies this issue by explicitly setting SetLastError to True for all its declarations, giving P/Invoke import declarations like:

const
  advapi32  = 'advapi32.dll';
  kernel32  = 'kernel32.dll';

[DllImport(advapi32, CharSet = CharSet.Auto, SetLastError = True, EntryPoint = 'GetUserName')]
function GetUserName; external;
[DllImport(kernel32, CharSet = CharSet.Auto, SetLastError = True, EntryPoint = 'GetComputerName')]
function GetComputerName; external;
[DllImport(kernel32, CharSet = CharSet.Auto,  SetLastError = True, EntryPoint = 'GetWindowsDirectory')]
function GetWindowsDirectory; external;
[DllImport(kernel32, CharSet = CharSet.Auto, SetLastError = True, EntryPoint = 'GetSystemDirectory')]
function GetSystemDirectory; external;
[DllImport(kernel32, CharSet = CharSet.Auto, SetLastError = True, EntryPoint = 'GetCurrentDirectory')]
function GetCurrentDirectory; external;

Also note that Delphi for .NET Preview Update introduces a routine GetLastError in the implicitly used Borland.Delphi.System unit, implemented simply as:

function GetLastError: Integer;
begin
  Result := System.Runtime.InteropServices.Marshal.GetLastWin32Error;
end;

However, if you use Borland.Win32.Windows and call GetLastError in the same unit, the compiler will call the P/Invoke version in the import unit rather than the helper routine in the Borland.Delphi.System.pas, due to the order in which the units are used and the resultant priority of their scope. If you want to call the helper routine you will need to fully qualify it, calling Borland.Delphi.System.GetLastError.

To aid moving API-based code across we can implement .NET equivalents of the Delphi Win32 error support routines, using the Win32 routine FormatMessage, declared in Borland.Win32.Windows.pas.

function SysErrorMessage(ErrorCode: Integer): string;
var
  Msg: StringBuilder;
const
  FORMAT_MESSAGE_FROM_SYSTEM = $1000;
begin
  Msg := StringBuilder.Create(1024);
  if FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nil, ErrorCode, 0, Msg, Msg.Capacity, nil) <> 0 then
    Result := Msg.ToString
  else
    Result := 'Unrecognised error'
end;

type
  EWin32Error = class(Exception)
  public
    ErrorCode: Integer;
  end;

procedure RaiseLastWin32Error;
var
  LastError: Integer;
begin
  LastError := Marshal.GetLastWin32Error;
  if LastError <> 0 then
    raise EWin32Error.Create(Format('System Error.  Code: %d.'#13'%s', [LastError, SysErrorMessage(LastError)]))
  else
    raise EWin32Error.Create('A call to a Win32 function failed')
end;

function Win32Check(RetVal: Bool): Bool;
begin
  if not RetVal then
    RaiseLastWin32Error;
  Result := RetVal;
end;

The calls to the routines can now be written just as in normal Win32 Delphi applications, for example:

procedure TfrmPInvoke.btnUserNameClick(Sender: TObject; Args: EventArgs);
var
  UserBuf: StringBuilder;
  UserBufLen: LongWord;
begin
  //Buffer too small, so we will get an exception
  UserBuf := StringBuilder.Create(2);
  UserBufLen := UserBuf.Capacity;
  Win32Check(GetUserName(UserBuf, UserBufLen));
  MessageBox.Show(UserBuf.ToString)
end;

procedure TfrmPInvoke.btnWindowsDirClick(Sender: TObject; Args: EventArgs);
var
  WinDirBuf: StringBuilder;
begin
  WinDirBuf := StringBuilder.Create(MAX_PATH); //Set max size buffer to ensure success
  Win32Check(Bool(GetWindowsDirectory(WinDirBuf, WinDirBuf.Capacity)));
  MessageBox.Show(WinDirBuf.ToString)
end;

Because Delphi for .NET Preview does not yet have the application-wide default exception handler, any exception generated here will by default produce a dialog offering you the chance to terminate or continue the application. You can safely continue from these exceptions.

If the Details button on this dialog is pressed you get a useful stack trace pointing you to the execution path that led to the exception.

HRESULT Return Values

As you may be aware, various COM/OLE related Win32 APIs return HResult values. These values return various bits of status information such as success, failure and also error codes. These APIs can be declared using the P/Invoke mechanism as well as any other method (HResults are represented as integers in .NET). For example, let's take the CLSIDFromProgID API, which is declared in Win32 terms as:

function CLSIDFromProgID(pszProgID: POleStr; out clsid: TCLSID): HResult; stdcall;
external ole32 name 'CLSIDFromProgID'

The first parameter is a POleStr (or PWideChar), meaning it is a Unicode string on all Windows platforms. In C terms the parameter type is LPCOLESTR, where the C implies the routine considers the string constant and will not change it (we can use a String parameter instead of a StringBuilder in the P/Invoke definition thanks to this fact).

One way of writing the P/Invoke import is using the standard Delphi syntax:

function CLSIDFromProgID([MarshalAs(UnmanagedType.LPWStr)] ppsz: String; out rclsid: Guid): Integer; stdcall;
external ole32;

Notice in this case that the String parameter needs an attribute of its own to ensure it will always be marshaled correctly on all Windows platforms. By default, a String parameter in this type of declaration will be marshaled as Unicode on NT platforms and ANSI on Win9x platforms. An alternative would be to specify the API uses the Unicode character set:

[DllImport(ole32, CharSet = CharSet.Unicode)]
function CLSIDFromProgID(ppsz: String; out rclsid: Guid): Integer;
external;

Delphi programmers may be familiar with the safecall calling convention that allows HResults to be ignored by the developer. Instead, safecall methods automatically raise exceptions if the HResult returned indicates failure.

P/Invoke supports a similar mechanism with yet another DllImportAttribute field, PreserveSig. This field defaults to True, meaning that the API signature will be preserved, thereby returning a HResult. If you set PreserveSig to False you can remove the HResult return value and a failure HResult will automatically raise an exception. The above declarations could be rewritten as:

[DllImport(ole32, PreserveSig = False)]
procedure CLSIDFromProgID([MarshalAs(UnmanagedType.LPWStr)] ppsz: String; out rclsid: Guid);
external;

or:

[DllImport(ole32, CharSet = CharSet.Unicode, PreserveSig = False)]
procedure CLSIDFromProgID(ppsz: String; out rclsid: Guid);
external;

Performance Issues

Sometimes there may be various ways to express a DLL routine in .NET and indeed the marshaling system will do its best to cope with the way you express the routine signature. However some representations (data mappings between types) are more efficient than others. Take the high accuracy timing routines for example. These are declared in Delphi 7 like this, where TLargeInteger is a variant record containing an Int64 (whose high and low parts can be accessed through other fields):

const
  kernel32  = 'kernel32.dll';

function QueryPerformanceCounter(var lpPerformanceCount: TLargeInteger): BOOL; stdcall;
external kernel32 name 'QueryPerformanceCounter';
function QueryPerformanceFrequency(var lpFrequency: TLargeInteger): BOOL; stdcall;
external kernel32 name 'QueryPerformanceFrequency';

The logical way of translating these routines would be like this:

function QueryPerformanceCounter(var lpPerformanceCount: Int64): Boolean; stdcall;
external kernel32;
function QueryPerformanceFrequency(var lpFrequency: Int64): Boolean; stdcall;
external kernel32;

This requires the marshaler to translate from a BOOL (which is the same a LongBool, a 32-bit Boolean value where all bits are significant) to a Boolean object. It would be more efficient to choose a data type that was the same size and can have the value passed straight through. Also, since the documentation for these APIs specifies that they will write a value to the reference parameter, and are not interested in any value passed in, we can replace the var declaration with out to imply this fact. So a more accurate and more efficient pair of declarations would look like this:

function QueryPerformanceCounter(out lpPerformanceCount: Int64): LongBool; stdcall;
external kernel32;
function QueryPerformanceFrequency(out lpFrequency: Int64): LongBool; stdcall;
external kernel32;

In a case like this where we are calling high performance timers you can go one step further to remove overheads by using the SuppressUnmanagedCodeSecurityAttribute from the System.Security namespace:

[DllImport(kernel32), SuppressUnmanagedCodeSecurity]
function QueryPerformanceCounter(out lpPerformanceCount: Int64): LongBool;
external;
[DllImport(kernel32), SuppressUnmanagedCodeSecurity]
function QueryPerformanceFrequency(out lpFrequency: Int64): LongBool;
external;

This makes the calls to the routines a little more efficient at the expense of normal security checks and thereby means the reported times from the routines will be slightly more accurate. A simple test shows that the logical versus accurate declaration have little to distinguish them at runtime, but the declaration with security disabled is a little quicker.

SuppressUnmanagedCodeSecurityAttribute should only be used on routines that cannot be used maliciously because, as the name suggests, it bypasses the normal runtime security check for calling unmanaged code. A routine marked with this attribute can be called by .NET code that does not have permission to run unmanaged code (such as code running via a Web browser page).

One additional performance benefit you can achieve, according to the available information on the subject, is to cause the P/Invoke signature/metadata validation, DLL loading and routine location to execute in advance of any of the P/Invoke routine calls. By default the first time a P/Invoke routine from a given DLL is called, that is when the DLL is loaded. Similarly, the signature metadata is validated the first time the P/Invoke routine is called. You can do this in advance by calling the Marshal.Prelink method (for a single P/Invoke routine) or the Marshal.PrelinkAll (for all P/Invoke routines defined in a class or unit). Both these come from the System.Runtime.InteropServices namespace.

The two timing routines are declared as standalone routines in the unit, but to fit into the .NET model, this really means they are part of the projectname.Unit namespace (dotNetApp.Unit in this case). So to prelink the two timing routines from a form constructor you could use:

Marshal.Prelink(GetType.Module.GetType('dotNetApp.Unit').GetMethod('QueryPerformanceFrequency'));
Marshal.Prelink(GetType.Module.GetType('dotNetApp.Unit').GetMethod('QueryPerformanceCounter'));

To prelink all P/Invoke routines in the unit from the form constructor, use:

Marshal.PrelinkAll(GetType.Module.GetType('dotNetApp.Unit'));

Simple tests indicate that without the prelink code, the first tests will indeed be a little slower than subsequent tests in the same program run. Prelinking the specified routines individually removes this first-hit delay, but curiouslyI found calling PrelinkAll makes each test in a given session noticeably quicker than with any of the previous tests.

Win32 Clients Using .NET Assembly Exports (Inverse P/Invoke)

The CCW aspect of COM Interop (see Reference 1) permits a COM client to access a .NET object just like any other COM object, but sometimes a Win32 application can benefit from being given access to just a handful of routines in a .NET assembly. This technique is catered for by the .NET platform; the CLR has an inherent capability to expose any .NET method to the outside (Win32) world using a mechanism that is the exact reverse of that used by P/Invoke, hence the term Inverse P/Invoke. However only C++ With Managed Extensions (Managed C++) and the underlying Intermediate Language (IL) support this ability directly. There is also little printed coverage of this technique, other than in Chapter 15 of Inside Microsoft .NET IL Assembler (see Reference 3).

Creative Round Tripping

Because programming tools do not cater for exporting .NET assembly methods we have to resort to some cunning trickery to take advantage of this technique, namely creative round tripping.

Round tripping is a term describing a two step process that involves taking a managed Win32 file (a .NET assembly) and disassembling it to the corresponding IL source code and metadata (and any managed or unmanaged resources), and then reassembling the IL code, metadata and resources into an equivalent .NET binary.

Because of the rich, descriptive nature of the metadata in managed PE (Portable Executable, the Win32 file format) files this round-tripping process is very reliable. A few select things do not survive the process, but these are not things that are supported by the Delphi for .NET compiler. For example, data on data (data that contains the address of another data constant) and embedded native, non-managed code. Also, local variable names will be lost if there is no PDB file available, since they are only defined in debug information, not in metadata.

Round tripping in itself is only useful to prove that you get a working executable back after a disassembly/reassembly process. The term creative round tripping is used to describe a round tripping job with an extra step. After disassembling the assembly into IL code, you modify the IL code before reassembly.

Creative round tripping is used in these scenarios:

  • changing the IL code generated by a compiler in a way not permitted by the compiler, such as to export .NET assembly methods
  • adding custom ILAsm code to your classes
  • merging several modules into one module

Clearly we will be focusing on the first area, since Delphi for .NET does not support exporting .NET methods. Let's first look at the two steps involved in round tripping to get the gist of things before looking at the details of creative round tripping.

Round Tripping, Step 1: Disassembly

To disassemble a .NET assembly you use the .NET Framework IL Disassembler, ildasm.exe, which comes with the Framework SDK. Let's take an example assembly, dotNetAssembly.dll, which contains two standalone routines DoSomething and DoSomethingElse:

procedure DoSomething(I: Integer);
begin
  MessageBox.Show(IntToStr(I))
end;

procedure DoSomethingElse(const Msg: String);
begin
  MessageBox.Show(Msg)
end;

Note that whilst these are written as standalone routines, Delphi for .NET will ensure they are implemented as static class methods, since all CLS-compliant routines in .NET must be methods. Every source file in a Delphi for .NET project has an implicit class, called Unit, containing everything in the source file. So these routines end up acting as though they were declared something like:

type
  Unit = class(System.Object)
  public
    class static procedure DoSomething(I: Integer);
    class static procedure DoSomethingElse(const Msg: String);
  end;

To disassemble the assembly use:

ildasm dotNetAssembly.dll /linenum /out:dotNetAssembly.il

This produces the named IL file and will also store any unmanaged resources in a file called dotNetAssembly.res and any managed resources in files with the names that are specified in the assembly metadata. The /linenum option will cause the IL file to include references to the original source lines, assuming debug information is available in a PDB file.

Round Tripping, Step 2: Reassembly

To re-assemble everything back to a .NET assembly you use the IL Assembler, ilasm.exe, which comes as part of the .NET Framework:

ilasm /dll dotNetAssembly.il /out:dotNetAssembly.dll /res:dotNetAssembly.res /quiet

Modifying A .NET Assembly Manifest

To expose methods from an assembly you must make some changes to the assembly manifest (found at the top of the IL file before the class declarations). There will be references to other assemblies in the manifest as well as general module information:

.module dotNetAssembly.dll
// MVID: {B865276C-A90F-4CA2-8AF1-0BF42A04A451}
.imagebase 0x00400000
.subsystem 0x00000002
.file alignment 512
.corflags 0x00000001

The first change is to define a v-table fixup containing as many slots as there are methods to export. In our case we have two methods to export, so the manifest should be changed to this:

.module dotNetAssembly.dll
// MVID: {B865276C-A90F-4CA2-8AF1-0BF42A04A451}
.imagebase 0x00400000
.subsystem 0x00000002
.file alignment 512
.corflags 0x00000001
.data VT_01 = int32[2]
.vtfixup [2] int32 fromunmanaged at VT_01

Notice that the number of methods is specified twice, once in the integer array (which is data space used for the v-table fixup, each slot being 32-bits in size) and once in the v-table fixup definition (which is defined to contain two slots and is mapped over the integer array).

Before leaving the manifest there is one other change that must be made if you want your assembly to operate on Windows XP. By default the .corflags directive, which sets the runtime header flags, specifies a value of 1, which equates to the COMIMAGE_FLAGS_ILONLY flag (defined in the CorHdr.h include file in the .NET Framework SDK). If this flag is set, the XP loader ignores the key section of the assembly file and the fixups are not fixed up. This causes fatal errors when trying to use the assembly exports. To resolve the problem you must specify the COMIMAGE_FLAGS_32BITREQUIRED flag (whose value is 2):

.module dotNetAssembly.dll
// MVID: {B865276C-A90F-4CA2-8AF1-0BF42A04A451}
.imagebase 0x00400000
.subsystem 0x00000002
.file alignment 512
.corflags 0x00000002
.data VT_01 = int32[2]
.vtfixup [2] int32 fromunmanaged at VT_01

Exporting .NET Methods

Now that we have a v-table fixup for the exported methods, we must get each method to appear as an entry in it. The IL representation of the methods currently looks like this:

.method public static void  DoSomething(int32 I) cil managed
{
  // Code size       13 (0xd)
  .maxstack  1
  .line 32:0 'dotNetAssembly.dpr'
  IL_0000:  ldarg.0
  IL_0001:  call       string Borland.Delphi.System.Unit::IntToStr(int32)
  IL_0006:  call       valuetype [System.Windows.Forms]System.Windows.Forms.DialogResult
                         [System.Windows.Forms]System.Windows.Forms.MessageBox::Show(string)
  IL_000b:  pop
  .line 33:0
  IL_000c:  ret
} // end of method Unit::DoSomething

.method public static void  DoSomethingElse([in] string Msg) cil managed
{
  // Code size       8 (0x8)
  .maxstack  1
  .line 37:0
  IL_0000:  ldarg.0
  IL_0001:  call       valuetype [System.Windows.Forms]System.Windows.Forms.DialogResult
                         [System.Windows.Forms]System.Windows.Forms.MessageBox::Show(string)
  IL_0006:  pop
  .line 38:0
  IL_0007:  ret
} // end of method Unit::DoSomethingElse

To turn them into unmanaged exports they should be changed to:

.method public static void  DoSomething(int32 I) cil managed
{
  // Code size       13 (0xd)
  .maxstack  1
  .line 32:0 'dotNetAssembly.dpr'
  .vtentry 1:1
  .export [1] as DoSomething
  IL_0000:  ldarg.0
  IL_0001:  call       string Borland.Delphi.System.Unit::IntToStr(int32)
  IL_0006:  call       valuetype [System.Windows.Forms]System.Windows.Forms.DialogResult
                         [System.Windows.Forms]System.Windows.Forms.MessageBox::Show(string)
  IL_000b:  pop
  .line 33:0
  IL_000c:  ret
} // end of method Unit::DoSomething

.method public static void  DoSomethingElse([in] string Msg) cil managed
{
  // Code size       8 (0x8)
  .maxstack  1
  .line 37:0
  .vtentry 1:2
  .export [2] as DoSomethingElse
  IL_0000:  ldarg.0
  IL_0001:  call       valuetype [System.Windows.Forms]System.Windows.Forms.DialogResult
                         [System.Windows.Forms]System.Windows.Forms.MessageBox::Show(string)
  IL_0006:  pop
  .line 38:0
  IL_0007:  ret
} // end of method Unit::DoSomethingElse

Each method requires a .vtentry directive to link it to the v-table fixup (the red font shows the slot number being specified) and an .export directive to indicate the exported name.

Assembling the file with the appropriate command-line produces:

C:\Temp> ilasm /dll dotNetAssembly.il /out:dotNetAssembly.dll /res:dotNetAssembly.res /quiet
Microsoft (R) .NET Framework IL Assembler.  Version 1.0.3705.0
Copyright (C) Microsoft Corporation 1998-2001. All rights reserved.
Assembling 'dotNetAssembly.il' , no listing file, to DLL --> 'dotNetAssembly.dll'
Source file is ANSI

EmitExportStub: dwVTFSlotRVA=0x00000000
EmitExportStub: dwVTFSlotRVA=0x00000004
Writing PE file
Operation completed successfully

The important information is that two export stubs are emitted. Indeed, using Delphi's TDump utility with the -ee command-line switch (to list the exported routines) proves the point:

C:\Temp>tdump -ee dotnetassembly.dll
Turbo Dump  Version 5.0.16.12 Copyright (c) 1988, 2000 Inprise Corporation
                Display of File DOTNETASSEMBLY.DLL

EXPORT ord:0001='DoSomething'
EXPORT ord:0002='DoSomethingElse'

Note that ilasm.exe is invoked with the /quiet command-line option to avoid seeing every single method listed out as it gets assembled, followed by details of how many members were emitted in the PE file for each class.

These routines can now be called just like any other DLL routine from a Win32 application:

unit dotNetAssemblyImport;

interface

procedure DoSomething(I: Integer); stdcall;
procedure DoSomethingElse(Msg: PChar); stdcall;

implementation

const
  dotNETAssembly = 'dotNETAssembly.dll';

procedure DoSomething(I: Integer); stdcall; external dotNETAssembly;
procedure DoSomethingElse(Msg: PChar); stdcall; external dotNETAssembly;

end.
The same data marshaling rules apply with Inverse P/Invoke routines as apply to normal P/Invoke routines. Since we didn't specify any marshaling attributes in the declarations of the routines, the String parameter in DoSomethingElse will be marshaled as a PChar (this is taken account of in the Win32 import unit above).

A Maintenance Nightmare?

The main issue developers see with Inverse P/Invoke is the maintenance problem. If you have to modify the compiler-generated assembly through creative round tripping then what happens when you recompile the DLL with your compiler? It would appear you have to go back and manually update the assembly again to export the routines.

Whilst this argument is valid, there is nothing stopping you from writing a utility that automates this post-compilation phase. Such a utility could then be incorporated into the build process and always be executed after the assembly is produced by the compiler.

Such a utility would be best written as a command-line application, however a GUI project that shows the idea accompanies this paper, called mme.dpr (Managed Method Exporter).

Summary

This paper has looked at the mechanisms that facilitate building Windows systems out of Win32 and .NET code. This will continue to be a useful technique whilst .NET is still at an early stage of its life and Win32 dominates in terms of existing systems and developer skills. Indeed, due to the nature of legacy code this may continue long after .NET programming dominates the Windows arena.

The coverage of interoperability mechanism has been intended to be complete enough to get you started without having too many unanswered questions. However it is inevitable in a paper of this size that much information has been omitted. The references below should provide much of the information that could not be fitted into this paper.

References

  1. .NET Interoperability: COM Interop by Brian Long.
    This paper looks at the issues involved in .NET code using Win32 COM objects and also Win32 COM client applications accessing.NET objects, using the COM Interop mechanism.
  2. .NET and COM, The Complete Interoperability Guide by Adam Nathan (of Microsoft), SAMS.
    This covers everything you will need to know about interoperability between .NET and COM, plus lots more you won't ever need.
  3. Inside Microsoft .NET IL Assembler by Serge Lidin (of Microsoft), Microsoft Press.
    This book describes the CIL (Common Intermediate Language) in detail and is the only text I've seen that shows how to export .NET assembly methods for Win32 clients. The author was responsible for developing the IL Disassembler and Assembler and various other aspects of the .NET Framework.

About Brian Long

Brian Long used to work at Borland UK, performing a number of duties including Technical Support on all the programming tools. Since leaving in 1995, Brian has been providing training and consultancy services to the Delphi and C++Builder communities, and more recently to the .NET community.

If you need training in these products, or need solutions to problems you have with them, please get in touch, or visit Brian's Web site.

Besides authoring a Borland Pascal problem-solving book published in 1994, Brian is a regular columnist in The Delphi Magazine and has had numerous articles published in Developer's Review, Computing, Delphi Developer's Journal and EXE Magazine. He was nominated for the Spirit of Delphi 2000 award.

In his spare time (and waiting for his C++ programs to compile) Brian has learnt the art of juggling and making inflatable origami paper frogs.


C# 簡 介
  • C# (唸成「C sharp」) 是 Microsoft 新開發的程式語言，用於發展在 .NET 平台上運作的元件式（component-based）Internet 應用程式與服務 ， C# 擁有 C/C++ 的強大功能以及Visual Basic簡易使用的特性，和 C++ 與 Java 一樣亦為物件導向(object- oriented)程式語言；雖然微軟聲稱其C#的語法95%幾乎與C++相同，但C#的語法其實更像Java，由於微軟與昇陽一直以來視彼此為競爭對手，因此在微軟的原文書中對Java這個字幾乎是隻字不提，更確切地說法，C#的語法其實是由C/C++、Visual Basic和Java四種語言融合而成。
  • C# 免除了DLL Hell, 徹底解決了com元件的登錄，註冊與更新時的版本衝突問題，透過config.web管理，將所需元件放置在 /bin目錄下即可， 除了不需要註冊之外，元件也不會有鎖定的情況，因為執行程式時 會複製/bin下找到的DLL，由於載入的是shadow-copy，因此原始的元件可以被任意地替換，即使程式仍在執行也沒有問題。

標準

  • 微軟在2000年6月公布C#，同年8月微軟、惠普和英特爾共同提報 CLI 和 C# 規格至 「歐洲電腦製造商協會」(ECMA) 的程式語言技術委員會（TC39）。這些共同的贊助廠商，連同其他ECMA成員，包括IBM、Fujitsu Software、惠普、客座專家、Plum Hall、Monash University、ISE和Ximian在內，共同改善提報核准為ECMA標準的規格。
  • 2001年12月，C#程式語言及通用語言架構（Common Language Infrastructure/CLI）通過ECMA的許可成為第一版的標準分別為 ECMA-334 和 ECMA-335 ，2001年12月，修正為第二版。
  • 2003 年 4 月， C#程式語言及通用語言架構（Common Language Infrastructure/CLI）通過國際標準組織 (The International Organization for Standardization/ISO)和世界電訊科技委員會（International Electrotechnical Committee/IEC）的標準認證，成為開發Web services的標準程式語言及架構 『ISO/IEC 23270 (C#), ISO/IEC 23271 (CLI) and ISO/IEC 23272 (CLI TR)』。


C# 程式的一般結構
1.C# 程式可以由一個或多個檔案組成。
2.每個檔案可以包含一個或多個命名空間 (Namespace)。
3.一個命名空間除了可以包含其他的命名空間，還可以包含:
類別、結構、介面、列舉 (Enumeration) 、委派 (Delegate)
等型別。
4.但是每個類別不能跨越多個檔案。


簡介Main() 方法
C# 程式必須包含一個 Main 方法，以便控制項在其中開始和結束。
您可以在 Main 方法中建立物件，和執行其他方法。

Main 方法是位於一個類別或結構內的一種靜態方法。
在「Hello World!」範例中，這個方法位在 Hello 類別中。
宣告 Main 的方式有下列三種：

它會傳回 void：
static void Main()
{
...
}

它也可以傳回一個 int：
static int Main()
{
...
return 0;
}

它也可以接受引數：
static int Main(string[] args)
{
...
return 0;
}


C# 傳遞參數的種類
C# 傳遞參數的種類共有三種，預設傳遞參數的方法為傳值方式，最常見也最有效率：
in (Pass by value)
in out (Pass by reference)
out (Output parameters)

依照傳遞參數的型別，有可分為下列四種：
以傳值方式傳遞數值型別(Value Types)
以傳址方式傳遞數值型別(Value Types)
以傳值方式傳遞參考型別(Reference Types)
以傳址方式傳遞參考型別(Reference Types)


使用完整名稱空間
名稱空間 (Namespace) 和型別具有唯一名稱，此名稱由表示邏輯階層架構的完整名稱所描述。例如，A.B 是巢狀於名稱空間 (或稱類型 A) 中的名稱空間 (或稱類型 B) 的名稱。
名稱空間可以用來幫助組織程式的結構，可以避免兩套程式碼集中命名的衝突。

下面程式碼片段中便具有巢狀的類別和名稱空間。每一實體後的註解代表完整的名稱。

namespace N1 // N1
{
class C1 // N1.C1
{
class C2 // N1.C1.C2
{
}
}
namespace N2 // N1.N2
{
class C2 // N1.N2.C2
{
}
}
}


不同名稱空間的呼叫 (範例)
using System;

   namespace Namespace1
   {
     public class Class1
     {
       public static void hello()
       {
         Console.WriteLine("Namespace1的Class1的hello()");
      }
      public static void test()
      {
        hello();
        Class1.hello();
        Namespace1.Class1.hello();
        Namespace2.Class1.hello();
      }
      [STAThread]
      static void Main(string[] args)
      {
       Namespace1.Class1.test();
       Namespace2.Class1.test();
     }
   }
 }
 namespace Namespace2
 {
   class Class1
   {
      public static void hello()
     {
        Console.WriteLine("Namespace2的Class1的hello()");
     }
     public static void test()
     {
       hello();
       Class1.hello();
       Namespace1.Class1.hello();
       Namespace2.Class1.hello();
     }
  }
 }


命名慣例
http://msdn.microsoft.com/library/en-us/cpgenref/html/cpconNamingGuidelines.asp


內建資料型態 (Basic/Built-in types )
全部型別(Type)都是從基本類別 object class而來，
一般資料型態有兩種：
1.內建的資料型態
2.使用者自定的資料型態
下面是內建資料型態的列表：
型別 | 位元組 | 說明
byte | 1 | unsigned byte
sbyte | 1 | signed byte
short | 2 | signed short
ushort | 2 | unsigned short
int | 4 | signed integer
uint | 4 | unsigned integer
long | 8 | signed long
ulong | 8 | unsigned long
float | 4 | floating point number
double | 8 | double precision number
decimal | 8 | fixed precision number
string |  | unicode string
char |  | unicode char
bool | true, false | boolean
Note: Type range in C# and C++ are different; for example, long in C++ is 4 bytes, and in C# it is 8 bytes. Also, the bool type and string types are different than those in C++. Bool accepts only true and false and not any integer.


使用者自定的資料型態(User-defined types )
使用者自定的資料型態，包含如下：
1.Classes
2.Structs
3.Interfaces


記憶體配置 (Memory allocation)
記憶體配置分為：
數值型別(Value Types)
參考型別(Reference Types)

Value types

Value types are those data types that are allocated in the stack. They include:

  • All basic or built-in types except strings
  • Structs
  • Enum types

Reference type

Reference types are allocated on the heap and are garbage collected when they are no longer being used. They are created using the new operator, and there is no delete operator for these types, unlike in C++, where the user has to explicitely delete the types created using the delete operator. In C#, they are automatically collected by the garbage collector.

Reference types include:

  • Classes
  • Interfaces
  • Collection types such as arrays
  • String


數值型別和參考型別比較
Value Types | Reference Types
Simple Types (char, int..); Enum types; Struct types | Class types; Interface types; Delegate types; Array types
Stack-allocated or allocated inline in a structure | Heap-allocated
Directly contain their data | Store references to their data (known as objects)
Each has its own copy of data | Two reference variables can reference same object
Operations on one cannot affect another | Operations on one can affect another


常數宣告
範例：
using System;
namespace DefaultNamespace
{
class
MainClass
{
const int
MAXSIZE=100;
public static void Main(string[]
args)
{
Console.WriteLine("{0}",MAXSIZE);
}
}
}
=====================================================
★const 和 enum 宣告的比較：
const int VER =
42;
const int BIG = 0x4d4d;
const int LIT = 0x4949;

enum Demo
{
  VER = 42,
  BIG = 0x4d4d,
  LIT = 0x4949
}
說明：
  const：必須定義在Class之內.
  enum ：可定義於Class之外部或內部.


字串常值逸出序列
逸出序列 | 說明
\t | 定位字元 (Unicode 0x0009)。
\r | 換行字元 (0x000d)。
\n | 新行字元 (換行符號) (0x000a)。
\v | 垂直索引標籤 (0x000b)。
\a | 警告 (0x0007)。
\b | 退格鍵 (0x0008)。
\f | 換頁字元 (0x000c)。
\0 | Null (0x0000)。
\\ | 反斜線 (0x005c)。
\' | 單引號 (0x0027)。
\" | 雙引號 (0x0022)。
\xD | 含可變位數的十六進位字元碼。
\uABCD | Unicode 字元 0xABCD (u 或 U 都可以，其中 A、B、C 和 D 是有效的十六進位數字 0-9、a-f、A-F)。


日期時間
System.DateTime currentTime=new System.DateTime();
1. 取得年月日時分秒：currentTime=System.DateTime.Now;
2 .取得年 ：int 年=currentTime.Year;
3. 取得月 ：int 月=currentTime.Month;
4 .取得日 ：int 日=currentTime.Day;
5. 取得時 ：int 時=currentTime.Hour;
6. 取得分 ：int 分=currentTime.Minute;
7. 取得秒 ：int 秒=currentTime.Second;
8. 取得毫秒 ：int 毫秒=currentTime.Millisecond;
9. 取中文日期顯示-年月日時分 ：
    string strY=currentTime.ToString("f");  //不顯示秒
10. 取中文日期顯示-年月：
    string strYM=currentTime.ToString("y");
11. 取中文日期顯示-月日：
    string strMD=currentTime.ToString("m");
12. 取得預設格式的年月日，格式為：2003-9-23
    string strYMD=currentTime.ToString("d");
13. 取得預設格式的時分，格式為：14：24
    string strT=currentTime.ToString("t");
（變數可用中文）


變數.ToString()
12345.ToString("n");  //產生 12,345.00
12345.ToString("C");
//產生 NT$12,345.00
12345.ToString("e");
//產生 1.234500e+004
12345.ToString("f4"); //產生 12345.0000
12345.ToString("x");
//產生 3039 (16進制)
12345.ToString("p");
//產生 1,234,500.00%


變數.Length (取字串長度)
如：
string str="台灣";
int Len = str.Length ;  //Len宣告成整數， str是字串的變數名稱


資料型態轉換
在 C# 中 轉 換 Data Type 是 一 件 很 簡 單 的 事 情 。
因 為 可 以 用 Convert 這 一 個 class。

由 string 轉 去 int

string strNum = "12345";
int iNum = Convert.ToInt32(strNum);

--------------------------------------------------------------------
由 2 進 制 的 string 轉 去 int

string strNum = "1010";
int iNum = Convert.ToInt32(strNum, 2); //iNum will be 10 in decimal

ToInt32的 第 二 個 parameter 是 base， 可 以 是 2, 8, 10 或 16 進 制 。
--------------------------------------------------------------------

由 int 轉 去 string

int iNum = 10;
string strNum = Convert.ToString(iNum);
Console.WriteLine(strNum);

Convert class 提 供 了 很 多 Data Type 轉 換 的 Methods， 我 也 不 再 介 紹 了 。


基本算術運算
1.加號：+
2.減號：-
3.乘號：*
4.除號：/
5.餘數：%
6.除外，另一運算元-負號(-)。
上述六種運算符號的執行優先順序為：
一、高優先順序：負號(-)
二、中優先順序：乘號(*)、除號(/)、餘數(%)
三、低優先順序：加號(+)、減號(-)


型別的轉換
例如：
 a，b為整數
 原式：s=a/b;
 強制改成浮點數，如下：
  s=(float)a/(float)b;


特殊運算式
1.遞增：i++、++i
2.遞減：i--、--i
3.基本運算式 i=i+1; 改成特殊運算式 i+=1;
例如：

基本運算式 | 特殊運算式
i=i+j | i+=j
i=i-j | i-=j
i=i*j | i*=j
i=i/j | i/=j
i=i%j | i%=j


sizeof
sizeof：算出任何型別的資料，所佔用記憶體位置數量(以Byte為單元)
格式：
   sizeof(某個資料型態);
例如：
 若  n= sizeof(char) ,則結果： n=1


標準輸入： Read()
範例：
using System;
namespace DefaultNamespace
{
 class MainClass
 {
  public static void Main(string[] args)
  {
    int i;
    Console.WriteLine("輸入字串:");
    while ((i = Console.Read()) != -1)
      Console.WriteLine((char)i + ": " + i);
  }
 }
}
備註：
The Read() method reads the next character from the standard input stream and returns its American Standard Code

執行：

輸入字串:
az
a: 97
z: 122
: 13

: 10
請按任意鍵繼續 . . .

說明執行結果，所代表的意思：

a: 97, ..., z: 122

「Enter」按鍵: 13

新行: 10


標準輸入： ReadLine()
範例：
using System;

namespace DefaultNamespace
{
 class MainClass
 {
  public static void Main(string[] args)
  {
   double price;
   string inputString;
Console.Write("輸入價格: ");
inputString = Console.ReadLine();
price = double.Parse(inputString );
Console.Write("價格 = ");
Console.WriteLine("{0:C}",
price);
}
}
}

執行結果：
輸入價格: 20
價格 = NT$20.00
請按任意鍵繼續 . . .


標準輸出：Write()
Console.Write("Hello ");
Console.WriteLine("World");

或

Console.WriteLine("Hello World");
Console.Write("\n");


標準輸出：WriteLine()
範例1:
Console.WriteLine("PGUI " + 2004);
範例2:
int year = 2004;
Console.WriteLine("PGUI " + year);
結果：PGUI 2004

範例3:
double x = 55.77;
Console.WriteLine("x = " + x);

結果：x = 55.77

範例4:
char c = 'x'; double d = 0.5;
Console.WriteLine(c + " = " + d);

結果：x = 0.5

範例5:
string s = "Hello World";
Console.WriteLine(s);

結果：Hello World

範例6:
int x = 2004; double y = 0.5;
Console.WriteLine("{0} {1}", x, y);

結果：2004 0.5

範例7:
double y = 7.5;
Console.WriteLine("{0, 10:C5}", y);

結果：NT$7.50000


if 敘述 (範例：奇數與偶數判斷)
using System;
namespace DefaultNamespace
{
class
MainClass
{
public static void Main(string[]
args)
{
int
number,rem;
string
inputstring;
Console.WriteLine("請輸入任意數：");
inputstring=Console.ReadLine();
number=int.Parse(inputstring);
rem=number %
2;
if(rem==1)
Console.WriteLine("{0}為奇數",number);
else
Console.WriteLine("{0}為偶數",number);
}
}
}


switch 敘述
using System;
namespace DefaultNamespace
{
class
MainClass
{
public static void Main(string[]
args)
{
int
i;
string
inputstring;
Console.WriteLine("
1.DOS...");
Console.WriteLine(" 2.Windows
XP...");
Console.WriteLine(" 3.Windows 2003
Server...");
Console.WriteLine("
輸入選項值(1-3)：");
inputstring=Console.ReadLine();
i=int.Parse(inputstring);
switch(i)
{
case
1:Console.WriteLine(" 結果=>已選擇 DOS");
break;
case 2:Console.WriteLine(" 結果=>已選擇 Windows
XP");
break;
case
3:Console.WriteLine(" 結果=>已選擇 Windows 2003
Server");
break;
default:Console.WriteLine("錯誤=>無此選項!\n");
break;
}
}
}
}
結果：
 1.DOS...
 2.Windows XP...
 3.Windows 2003 Server...
 輸入選項值(1-3)：
 2
 結果=>已選擇 Windows XP
請按任意鍵繼續 . . .


While 敘述(1) ( 範例：九九乘法)
using System;
namespace DefaultNamespace
{
class
MainClass
{
public static void Main(string[]
args)
{
int
i,j,result;
i=1;
while(i<=9)
{
j=1;
while(j<=9)
{
result=i*j;
Console.WriteLine("{0}*{1}={2}",i,j++,result);
}
i++;
Console.WriteLine("\n");
}
}
}
}


for 敘述(1) ( 範例：九九乘法)
using System;
namespace DefaultNamespace
{
class
MainClass
{
public static void Main(string[]
args)
{
int
i,j,result;
for(i=1;i<=9;i++)
{
for(j=1;j<=9;j++)
{
result=i*j;
Console.WriteLine("{0}*{1}={2}",i,j,result);
}
i++;
Console.WriteLine("\n");
}
}
}
}


do..While 敘述 (範例：1加到100)
using System;
namespace DefaultNamespace
{
class
MainClass
{
public static void Main(string[]
args)
{
int
i,sum;
i=1;
sum=0;
do
{
sum+=i++;
}while(i<=100);
Console.WriteLine("1加到100，結果為{0}",sum);
}
}
}


for 敘述(2) ( 範例：列出65至90間所有ASCII字元)
using System;
namespace DefaultNamespace
{
 class MainClass
 {
  public static void Main(string[] args)
  {
   int i;
   for (i=65;i<=90;i++)
    Console.WriteLine("{0}= {1}",i,(char)i);
  }
 }
}


While 敘述(2) ( 範例：求最大公因數)
利用輾轉相除法，求最大公因數(gcd)
程式碼如下：
using System;
namespace DefaultNamespace
{
class
MainClass
{
public static void Main(string[]
args)
{
int
number1,number2,tmp;
string
inputstring;

Console.WriteLine("請輸入第一個數：");
inputstring=Console.ReadLine();
number1=int.Parse(inputstring);

Console.WriteLine("請輸入第二個數：");
inputstring=Console.ReadLine();
number2=int.Parse(inputstring);

while (number2 !=
0)
{
tmp=number1 %
number2;
number1 =
number2;
number2=tmp;
}
Console.WriteLine("最大公因數={0}",number1);
}
}
}
結果：
請輸入第一個數：
14
請輸入第二個數：
2
最大公因數=2
請按任意鍵繼續 . . .


For Each 敘述
using System;
namespace DefaultNamespace
{
class
MainClass
{
public static void Main(string[]
args)
{
int[] arrInt =
{0,1,2,3};
foreach (int i in
arrInt)
{
Console.WriteLine("i= " +
i);
}
}
}
}
結果：
i= 0
i= 1
i= 2
i= 3
請按任意鍵繼續 . . .


資料型態(Data Type)
Inherits from System.Array

Note on Resize

Use Clone(), Copy(), CopyTo() methods to keep the old data.

資料型態(Data Type)

// define
int[] int1 = new int[5];    // 0 to 4, 5 items
// int[5] int2;    // syntax error

// define without initial size
int[] int2;
int2 = new int[5];

// define and initialize
int[] int32 = new int[] {0, 1, 2, 3, 4};
int[] int33 = {0, 1, 2, 3, 4};

// define and assign value later
int[] int4;
int4 = new int[] {0, 1, 2, 3, 4};

// resize
int[] int5 = new int[5];
int5 = new int[9];  // old data is lost

// rectangular array, the second dimension is always the same
int[,] int6 = new int[5, 3];
int[,] int7;
int7 = new int[5, 3];

// jagged array, the second dimension varies
int[][] int8;
int8 = new int[5][];
int8[0] = new int[3];
int8[1] = new int[4];
Debug.WriteLine(int8.Length.ToString());    // 6
Debug.WriteLine(int8[0].Length.ToString()); // 4
// Debug.WriteLine(int8[2].Length.ToString()); // run-time error

// sample
Char[] splitArray = new Char[] {';'};


物件型態(Reference Type)
// define
object[] obj1 = new object[5];    // 0 to 4, 5 items
// object[5] obj2;    // syntax error

// define without initial size
object[] obj2;
obj2 = new object[5];

// define and initialize
object[] obj32 = new object[] {new object(),
                                  new object(), new object(),
                                  new object(), new object()};
object[] obj33 = {new object(),
                     new object(), new object(),
                     new object(), new object()};

// define and assign value later
object[] obj4;
obj4 = new object[] {new object(),
                        new object(), new object(),
                        new object(), new object()};

// resize
object[] obj5 = new object[5];
obj5 = new object[9];  // old data is lost

// rectangular array, the second dimension is always the same
object[,] obj6 = new object[5, 3];
object[,] obj7;
obj7 = new object[5, 3];

// jagged array, the second dimension varies
object[][] obj8;
obj8 = new object[5][];
obj8[0] = new object[3];
obj8[1] = new object[4];
Debug.WriteLine(obj8.Length.ToString());    // 6
Debug.WriteLine(obj8[0].Length.ToString()); // 4
// Debug.WriteLine(obj8[2].Length.ToString()); // run-time error

// sample
DataTable table1 = new DataTable();
DataColumn column1 = new DataColumn("RowId");
table1.Columns.Add(column1);
table1.PrimaryKey = new DataColumn[] {table1.Columns["RowId"]};


一維陣列

using System;
namespace DefaultNamespace
{
class
MainClass
{
public static void
Main(string[]
args)
{
int[] array = new int[10];
for( int i = 0; i < array.Length;
i++ )
{
array[i] =
i;
Console.WriteLine("{0}",array[i]);
}
}
}
}
結果：
0
1
2
3
4
5
6
7
8
9
請按任意鍵繼續 . . .


兩整數值互相交換
using System;
namespace DefaultNamespace
{
 class MainClass
 {
  public static void Main(string[] args)
  {
   int a=5;
   int b=3;
   Console.WriteLine("a={0}, b={1}", a, b);
   swapValue(ref a, ref b);
   Console.WriteLine("a={0}, b={1}", a, b);
  }
  /// <summary>
  /// 兩整數值互相交換
  /// </summary>
  public static void swapValue(ref int a, ref int b)
  {
   int tmp = a;
   a = b;
   b = tmp;
  }
 }
}


平方根 (Math.Sqrt)
using System;
namespace DefaultNamespace
{
class
MainClass
{
public static void Main(string[]
args)
{
double
x=2.0;
Console.WriteLine("{0}",Math.Sqrt(x));
}
}
}
結果：
 1.4142135623731
 請按任意鍵繼續 . . .


三角函數(Sin,Cos,tan...)
三角函數：
 Sin,Cos,tan,Asin,Acos,Atan,Atan2,sinh,conh,tanh
範例：
using System;
namespace DefaultNamespace
{
class
MainClass
{
public static void Main(string[]
args)
{
double
x=3.1415926;
Console.WriteLine("Sin={0}",Math.Sin(x));
Console.WriteLine("Cos={0}",Math.Cos(x));
Console.WriteLine("Tan={0}",Math.Tan(x));
}
}
}
結果：
Sin=5.35897931700532E-08
Cos=-0.999999999999999
Tan=-5.35897931700533E-08
請按任意鍵繼續
. . .


整數處理(Floor、Ceiling、Abs、Sign)
Floor   ：傳回不大於X的最大整數
Ceiling ：傳回不小於X的最小整數
Abs     ：傳回X的絕對值
Sign    ：傳回-1∼0∼1之間的識別數值
程式碼範例：
using System;
namespace DefaultNamespace
{
 class MainClass
 {
  public static void Main(string[] args)
  {
   double x=8.3;
   double
y=-2;
Console.WriteLine("Floor={0}",Math.Floor(x));
Console.WriteLine("Ceiling={0}",Math.Ceiling(x));
Console.WriteLine("Abs={0}",Math.Abs(y));
   Console.WriteLine("Sign={0}",Math.Sign(y));
  }
 }
}
結果：
Floor=8
Ceiling=9
Abs=2
Sign=-1
請按任意鍵繼續 . . .


Pow函數
Pow函數：求某數的某次方值
範例：
      y
   X   =>使用Pow函數，傳回此公式結果。
程式碼：
using System;
namespace DefaultNamespace
{
class
MainClass
{
public static void Main(string[]
args)
{
double
x=3.2;
double
y=1.8;
Console.WriteLine("Pow(x,y)={0}",Math.Pow(x,y));
}
}
}
結果：
Pow(x,y)=8.1146531454009
請按任意鍵繼續 . . .


其他函數(Exp、Log、Log10)
                 x
Exp   ：指數函數 e
Log   ：自然對數函數
Log10 ：以10為底的對數函數
程式碼：
using System;
namespace DefaultNamespace
{
class
MainClass
{
public static void Main(string[]
args)
{
double
x=8.0;
Console.WriteLine("Exp(x)={0}",Math.Exp(x));
Console.WriteLine("Log(x)={0}",Math.Log(x));
Console.WriteLine("Log10(x)={0}",Math.Log10(x));
}
}
}
結果：
Exp(x)=2980.95798704173
Log(x)=2.07944154167984
Log10(x)=0.903089986991944
請按任意鍵繼續 . . .


遞回函數呼叫
第一種寫法：
using System;
namespace DefaultNamespace
{
 class MainClass
 {
  public static void Main(string[] args)
  {
   int i;
   for (i=0;i<5;i++)
    Console.WriteLine("{0}!= {1}",i,factorial(i));
  }

  public static int factorial(int j)
  {
   int sum;
   if(j==0)
    sum=1;
   else
    sum=j*factorial(j-1);
   return sum;
  }
 }
}
第二種寫法：
using System;
namespace DefaultNamespace
{
 class MainClass
 {
  public static void Main(string[] args)
  {
   int i;
   for (i=0;i<5;i++)
    Console.WriteLine("{0}!= {1}",i,factorial(i));
  }

  public static int factorial(int j)
  {
   return((j ==0) ? 1 : (j * factorial(j-1)));
  }
 }
}
結果：
0!= 1
1!= 1
2!= 2
3!= 6
4!= 24
請按任意鍵繼續 . . .


隨機數函數 (1) (System.Random)
由1到100之間，隨機產生10個數。
程式碼如下：
using System;
namespace DefaultNamespace
{
class
MainClass
{
public static void Main(string[]
args)
{
Random rand = new
Random();
for (int
i=1;i<=10;i++)
//產生10個數
Console.WriteLine("{0}",rand.Next( 1, 100 ));
//1-100之間
}
}
}


隨機數函數(2) -猜數字遊戲 0-99
程式碼：
using System;
namespace DefaultNamespace
{
class
MainClass
{
public static void Main(string[]
args)
{
int
num=100;
int ran,guess;
int
count=0;
string inputstring;
Random rand = new
Random();
ran=rand.Next( 0,
num);
while
(true)
{
count++;
Console.WriteLine("猜
0-99 之間的整數：");
inputstring=Console.ReadLine();
guess=int.Parse(inputstring);
if
(ran==guess)
{
Console.WriteLine("好棒喔！答對了！");
break;
}
if
(ran>guess)
Console.WriteLine("錯！你應該在猜大一點...\n");
else
Console.WriteLine("錯！你應該在猜小一點...\n");
}
Console.WriteLine("你總共猜了 {0}
次",count);
}
}
}
結果：
猜 0-99 之間的整數：
50
錯！你應該在猜大一點...
猜 0-99 之間的整數：
60
錯！你應該在猜小一點...
猜 0-99 之間的整數：
55
好棒喔！答對了！
你總共猜了 3 次
請按任意鍵繼續 . . .


前端處理程式(C# Preprocessor Directives)- #if 指令
#define demo
using System;
namespace DefaultNamespace
{
 class MainClass
 {
  public static void Main(string[] args)
  {
         #if demo
            Console.WriteLine("Hello World Demo");
         #else
            Console.WriteLine("Hello World");
         #endif
  }
 }
}


C# Preprocessors
Even though the C# compiler does not have a separate preprocessor,there are some preprocessing directives supported by the C# compiler which helps in conditional compilation. Unlike C++ directives the C# directives cannot be used for creating macros. Following is the list of preprocessing directives supported by C#.
  • #if
  • #else
  • #elif
  • #endif
  • #define
  • #undef
  • #warning
  • #error
  • #line
  • #region
  • #endregion
#if, along with the #else, #elif,endif, #define, and #undef directives, lets you include or exclude code based on the condition of one or more symbols.This can be most useful when compiling code for a debug build or when compiling for a specific configuration.

The #define directive is used for defining a symbol.When this symbol is used as the expression in a #if directive or #elif directive the expression will evaluate to true. The syntax for using the #define directive is
#define symbol

A symbol can also be defined using the /define compiler option.The syntax for using this compiler option is
csc sourcefilename /define symbol

Multiple symbols can be defined with /define by using ;(semicolon) or ,(comma) to separate the symbol names.The #undef directive is used for undefining a symbol.When this symbol is used as the expression in a #if directive or #elif directive the expression will evaluate to false. The syntax for using the #undef directive is
#undef symbol

Note:The #define and #undef directives must precede all the statements other than directives in a file

The #if directive is used to test symbols and if they evaluate to true the compiler executes all the code between #if directive and the next directive.The syntax for using #if directive is

#if symbol [operator symbol] ....
Multiple symbols can be evaluated using ==,!=,&&,|| operators.

The #elif directive is used in compound conditional statments.The #elif directive is evaluated if all the preceding #if and #elif directives evaluate to false. If the #elif expression evaluates to true the compiler executes all the code between #elif directive and the next directive.The syntax for using #elif directive is
#elif symbol [operator symbol] ....

The #else directive is used in compound conditional statments.The #else directive is evaluated if all the preceding #if and #elif directives evaluate to false. If the #else expression evaluates to true the compiler executes all the code between #else directive and the #endif directive.

The #endif directive is used for terminating #if /STRONG> directive.

Note:The #if directive should be explicitly terminated with #endif directive.
Example

#define DEBUG
using System;
class PreProcessorTest
{
  static void Main()
  {
    #if (DEBUG)
        Console.WriteLine("DebuG is True");
    #else
        Console.WriteLine("DebuG is False");
    #endif
  }
}

Compiling the above code will result in the following output
DebuG is True

The #line directive is used to change the complier's line number and filename in error and warning messages. The syntax for using #line directive is
#line number ["filename"]
Example
using System;
class PreProcessorTest{
         static void Main()
          {
           #line 100
           Console.LineWrite("God is Great");
           }
}

Compiling the above code will result in the following error.
PreProcessorTest.cs(100,2): error CS0117: 'System.Console' does not contain a d definition for 'LineWrite'
The error message show the error line number as 100 even though the actual line of error is 7

The #warning directive is used to generate a warning from a specific location in the code.It is normally used within a conditional directive.The syntax for using #warning directive is
#warning message

The #error directive is used to generate an error from a specific location in our code.It is normally used within a conditional directive.The syntax for using the #error directive is
#error message

The #region and #endregion are used to specify a block of code which can be expanded or collapsed when using the outline feature of Visual Studio editor.The syntax for using the #region directive is
#region regionname
Note:The #region directive should be explicitly terminated with #endregion directive.


Structures (結構)

struct 型別是一種數值型別，可以包含建構函式、常數、欄位、方法、屬性、索引子、運算子和巢狀型別 (Nested Type)，結構也能實作介面。
結構不可以宣告預設的 (無參數的) 的建構函式。
不過可以使用有參數的建構函式。
存取structure裡的memeber比存取class裡的member要快一點。
範例：
class TestStruct
{
 public static void Main()
 {
SimpleStruct st = new
SimpleStruct(4);
System.Console.WriteLine(st.i);
st.aMethod();
}
}

struct SimpleStruct
{
  public int i;
  public SimpleStruct(int j)
  {
   i=j;
  }
  public void aMethod()
  {
   System.Console.WriteLine("Inside aMethod");
  }
}

結果：
4
Inside aMethod

Features of Structures:
========================================================
* A structure or struct can contain only fields, methods, Etc.,

* In struct we can't initialize the variable whereas in class it can be possible

* It must be initialized either through function or using object

* Fields can't be given initial values at that time of creation.

* struct can't have a constructor.

* struct can't support the concept of inheritance

* We can derive a structure from an interface

* We can't inherit from sealed class

* A structure could not inherit from a class, the reverse is also true

* You can't declare a struct as sealed, because by default it is sealed

* A structure declare as abstract can't be used as a base class, i.e., be used in a derivation

* No destructor for struct

* struct are created on the stack and die when we reach the closing brace


enum(列舉)
enum Weekdays
{
  Saturday, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday
}


類別(Class)與結構(Structs) 比較

Classes and structs are same as in C++, except in the difference of their memory allocation. Objects of classes are allocated in the heap, and are created using new, where as structs are allocated in the stack. Structs in C# are very light and fast datatypes. For heavy datatypes, you should create classes.

範例:

struct Date
{
  int day;
  int month;
  int year;
}

class Date
{
  int day;
  int month;
  int year;
  string weekday;
  string monthName;

  public int GetDay()
  {
    return day;
  }

  public int GetMonth()
  {
    return month;
  }

  public int GetYear()
  {
    return year;
  }

  public void SetDay( int Day )
  {
    day = Day;
  }

  public void SetMonth( int Month )
  {
    month = Month;
  }

  public void SetYear( int Year )
  {
    year = Year;
  }

  public bool IsLeapYear()
  {
    return (year/4 == 0);
  }

  public void SetDate( int day, int month, int year )
  {
  }

  ...
}


分辨 File 類型
假 設 我 們 有 一 個 string， 它 載 著 一 個 檔 案 的 路 徑 ，
我 們 現 在 想 知 道 那 一 個 File 是 檔 案 還 是 資 料 夾 。
我 們 可 以 使 用 FileAttributes。

public static void CheckFileAttribute(string strFilePath)
{
 try
 {
  FileAttributes aAttributes = File.GetAttributes(strFilePath);
  if ( aAttributes == FileAttributes.Directory )
       Console.WriteLine(strFilePath + " 是一個資料夾");
  else
       Console.WriteLine(strFilePath + " 不是一個資料夾");
 } catch ( IOException e )
   {
      Console.WriteLine(e.Message);
   }
}


鏈結串列

The following code demonstrates how to write amd use a link list in C#.

using System;

namespace PardesiServices
{
 class LinkList
 {
  public string Val;
  public object NextItem;
  [STAThread]
  static void Main(string[] args)
  {
   LinkList obList = new LinkList();
   obList.Val = "Head";
   LinkList obHead = obList;
   // Add 10 items to the list.
   for (int i = 0; i < 10; i++)
   {
    obList.NextItem = new LinkList();
    obList = (LinkList)obList.NextItem;
    obList.Val = i.ToString();
   }
   // Print the added items.
   while (obHead != null)
   {
    Console.WriteLine("Item: {0}", obHead.Val);
    obHead = (LinkList)obHead.NextItem;
   }
  }
 }
}


冒泡排序
using System;
...
namespace BubbleSorter
{
 public class BubbleSorter
 {
  public void Sort(int [] list)
  {
   int i,j,temp;
   bool done=false;
   j=1;
   while((j<list.Length)&&(!done))
   {
    done=true;
    for(i=0;i<list.Length-j;i++)
    {
     if(list[i]>list[i+1])
     {
      done=false;
      temp=list[i];
      list[i]=list[i+1];
      list[i+1]=temp;
     }
    }
    j++;
   }
  }
 }

 public class MainClass
 {
  public static void Main()
  {
   int[] iArrary=new int[]{1,5,13,6,10,55,99,2,87,12,34,75,33,47};
   BubbleSorter sh=new BubbleSorter();
   sh.Sort(iArrary);
   for(int m=0;m<iArrary.Length;m++)
    Console.Write("{0} ",iArrary[m]);
   Console.WriteLine();
  }
 }
}


選擇排序
using System;

namespace SelectionSorter
{
 public class SelectionSorter
 {
  private int min;
  public void Sort(int [] list)
  {
   for(int i=0;i<list.Length-1;i++)
   {
    min=i;
    for(int j=i+1;j<list.Length;j++)
    {
     if(list[j]<list[min])
      min=j;
    }
    int t=list[min];
    list[min]=list[i];
    list[i]=t;
   }
  }
 }

 public class MainClass
 {
  public static void Main()
  {
   int[] iArrary=new int[]{1,5,3,6,10,55,9,2,87,12,34,75,33,47};
   SelectionSorter ss=new SelectionSorter();
   ss.Sort(iArrary);
   for(int m=0;m<iArrary.Length;m++)
    Console.Write("{0}  ",iArrary[m]);
   Console.WriteLine();
  }
 }
}


插入排序
using System;

namespace ShellSorter
{
 public class ShellSorter
 {
  public void Sort(int [] list)
  {
   int inc;
   for(inc=1;inc<=list.Length/9;inc=3*inc+1);
   for(;inc>0;inc/=3)
   {
    for(int i=inc+1;i<=list.Length;i+=inc)
    {
     int t=list[i-1];
     int j=i;
     while((j>inc)&&(list[j-inc-1]>t))
     {
      list[j-1]=list[j-inc-1];
      j-=inc;
     }
     list[j-1]=t;
    }
   }
  }
 }

 public class MainClass
 {
  public static void Main()
  {
   int[] iArrary=new int[]{1,5,13,6,10,55,99,2,87,12,34,75,33,47};
   ShellSorter sh=new ShellSorter();
   sh.Sort(iArrary);
   for(int m=0;m<iArrary.Length;m++)
    Console.Write("{0} ",iArrary[m]);
   Console.WriteLine();
  }
 }
}


Shell排序
using System;

namespace ShellSorter
{
 public class ShellSorter
 {
  public void Sort(int [] list)
  {
   int inc;
   for(inc=1;inc<=list.Length/9;inc=3*inc+1);
   for(;inc>0;inc/=3)
   {
    for(int i=inc+1;i<=list.Length;i+=inc)
    {
     int t=list[i-1];
     int j=i;
     while((j>inc)&&(list[j-inc-1]>t))
     {
      list[j-1]=list[j-inc-1];
      j-=inc;
     }
     list[j-1]=t;
    }
   }
  }
 }

 public class MainClass
 {
  public static void Main()
  {
   int[] iArrary=new int[]{1,5,13,6,10,55,99,2,87,12,34,75,33,47};
   ShellSorter sh=new ShellSorter();
   sh.Sort(iArrary);
   for(int m=0;m<iArrary.Length;m++)
    Console.Write("{0} ",iArrary[m]);
   Console.WriteLine();
  }
 }
}


using System;
using System.Text.RegularExpressions;
namespace DefaultNamespace
{
 class MainClass
 {
  public static void Main(string[] args)
  {
            string expression = @"[a-zA-Z]\.";
            Regex regular = new Regex(expression, RegexOptions.Compiled);
            Console.WriteLine("Regular Expression: {0}", expression);

            string search;

            search = "a";
            Console.WriteLine("Search for {0} is {1}", search, regular.IsMatch(search));
            search = "a.";
            Console.WriteLine("Search for {0} is {1}", search, regular.IsMatch(search));
            search = "ab.";
            Console.WriteLine("Search for {0} is {1}", search, regular.IsMatch(search));
            search = "ab..";
            Console.WriteLine("Search for {0} is {1}", search, regular.IsMatch(search));
            search = "ab";
            Console.WriteLine("Search for {0} is {1}", search, regular.IsMatch(search));
            search = "aB.";
            Console.WriteLine("Search for {0} is {1}", search, regular.IsMatch(search));
            search = "aB..";
            Console.WriteLine("Search for {0} is {1}", search, regular.IsMatch(search));
            search = "aB";
            Console.WriteLine("Search for {0} is {1}", search, regular.IsMatch(search));
            search = "a.B.";
            Console.WriteLine("Search for {0} is {1}", search, regular.IsMatch(search));
            search = "";
            Console.WriteLine("Search for {0} is {1}", search, regular.IsMatch(search));

            // first attempt on exact match, see final attempt for better one
            expression = @"[a-zA-Z]\.$";
            Console.WriteLine("Regular Expression: {0}", expression);
            search = "ab.";
            Match m = Regex.Match(search, expression);
            Console.WriteLine("Exact match for {0} is {1}", search, (m.Success && m.Index == 0 && m.Length == search.Length));

            // second attempt
            expression = @"[a-zA-Z]\.$";
            Console.WriteLine("Regular Expression: {0}", expression);
            search = "ab.";
            m = Regex.Match(search, expression);
            Console.WriteLine("Exact match for {0} is {1}", search, (m.Success) && (m.Value == search));

            // final attempt to find exact match
            // ^ match begin of line, $ match end of line
            expression = @"^[a-zA-Z]\.$";
            regular = new Regex(expression, RegexOptions.Compiled);
            Console.WriteLine("Regular Expression: {0}", expression);

            search = "a";
            Console.WriteLine("Search for {0} is {1}", search, regular.IsMatch(search));
            search = "a.";
            Console.WriteLine("Search for {0} is {1}", search, regular.IsMatch(search));
            search = "ab.";
            Console.WriteLine("Search for {0} is {1}", search, regular.IsMatch(search));
            search = "ab..";
            Console.WriteLine("Search for {0} is {1}", search, regular.IsMatch(search));
            search = "ab";
            Console.WriteLine("Search for {0} is {1}", search, regular.IsMatch(search));
            search = "aB.";
            Console.WriteLine("Search for {0} is {1}", search, regular.IsMatch(search));
            search = "aB..";
            Console.WriteLine("Search for {0} is {1}", search, regular.IsMatch(search));
            search = "aB";
            Console.WriteLine("Search for {0} is {1}", search, regular.IsMatch(search));
            search = "a.B.";
            Console.WriteLine("Search for {0} is {1}", search, regular.IsMatch(search));
            search = "";
            Console.WriteLine("Search for {0} is {1}", search, regular.IsMatch(search));

            expression = @"^[a-zA-Z]$|^[a-zA-Z]\.$|^[a-zA-Z]\.[a-zA-Z]\.$";
            regular = new Regex(expression, RegexOptions.Compiled);
            Console.WriteLine("Regular Expression: {0}", expression);

            search = "a";
            Console.WriteLine("Exact match for {0} is {1}", search, regular.IsMatch(search));
            search = "a.";
            Console.WriteLine("Exact match for {0} is {1}", search, regular.IsMatch(search));
            search = "ab.";
            Console.WriteLine("Exact match for {0} is {1}", search, regular.IsMatch(search));
            search = "ab..";
            Console.WriteLine("Exact match for {0} is {1}", search, regular.IsMatch(search));
            search = "ab";
            Console.WriteLine("Exact match for {0} is {1}", search, regular.IsMatch(search));
            search = "aB.";
            Console.WriteLine("Exact match for {0} is {1}", search, regular.IsMatch(search));
            search = "aB..";
            Console.WriteLine("Exact match for {0} is {1}", search, regular.IsMatch(search));
            search = "aB";
            Console.WriteLine("Exact match for {0} is {1}", search, regular.IsMatch(search));
            search = "a.B.";
            Console.WriteLine("Exact match for {0} is {1}", search, regular.IsMatch(search));
            search = "";
            Console.WriteLine("Exact match for {0} is {1}", search, regular.IsMatch(search));

            Console.Write("按 Enter 鍵 繼續: ");
            Console.ReadLine();

  }
 }
}


Hello world程式 -1
1.檔案->新增->新增專案->C#->Console應用程式->確定
2.執行
程式碼如下：
using System;
namespace DefaultNamespace
{
class
MainClass
{
public static void Main(string[]
args)
{
Console.WriteLine("Hello
World!");
}
}
}


Hello world程式-2
using System;
namespace DefaultNamespace
{
 class MainClass
 {
  public static void Main(string[] args)
  {
   dispMessage("Hello world 程式-2");
  }
  public static void dispMessage(string msg)
  {
   Console.WriteLine(msg);
  }
 }
}


視窗應用程式-基本架構
1.檔案->新增->新增專案->C#->Windows應用程式->確定
2.執行
程式碼如下：
using System;
using System.Windows.Forms; //參考區

namespace DefaultNamespace  //名稱空間區段開始
{
public class MainForm : System.Windows.Forms.Form //Class區段開始
{
  //元件初始化區
  public MainForm()
  {
   InitializeComponent();
  }

  #region 表單視窗設計 程式碼自動產生區
  private void InitializeComponent()
  {
   // Form1
   this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
   this.ClientSize = new System.Drawing.Size(292, 266);
   this.Text = "MainForm";
   this.Name = "MainForm";
  }
  #endregion

  [STAThread] //程式進入點
  public static void Main(string[] args)
  {
   Application.Run(new MainForm());
  }
  } //Class區段 結束
} //名稱空間 結束


C# 和 C++ 的比較
下列連結中表格包含 C++ 與 C# 功能之間的重要比較。
如果您是 C++ 程式設計人員，這個表格將概要地提供您兩種語言之間最大的差異。
 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cscon/html/vclrfComparisonBetweenCCSharp.asp


From the Team

Welcome to the Team section of the Visual C# Developer Center. Provided by the C# Product Team, the content in this section includes samples, articles, columns, and other information produced by the team. This section also contains message boards on which you can ask questions of the C# team members.

Eric Gunnerson
Visual C# Team

Blogs from the C# Team
Get connected with the C# team through their blogs (web logs). Ask questions, read about the development process behind your favorite language and tools, and more.

  • Eric Gunnerson
  • Gus Perez
  • Dan Fernandez
C# Language
Find specifications and other information about C# in the C# Language section. It's also the place to interact with the C# language designers and other experts.

Getting Help
Find the answers to your questions about Visual C# on the Microsoft public newsgroups. In these newsgroups, you can interact with Visual C# product team members, MVPs, and other C# enthusiasts.

  • microsoft.public.dotnet.languages.csharp
Sample Code from the C# Team
Check out sample applications from the C# Team, along with libraries for you to use. For more code samples, go to the downloads/code samples page of this developer center.

Frequently Asked Questions
Find answers to your C# questions in this list of common questions answered by team members.

Tools
Find various tools to help you in your C# development.

  • .NET Framework SDK Downloads
  • Classes and Libraries
  • AQdevTeam

Friends of C#

  • C# Station (providing C# help and links since July 4th, 2000!!)
  • .NET Weblogs @ ASP.NET
  • ASP.NET Tutorials, Components, and Links at 123aspx.com
  • Blogs on GotDotNet
  • C# at Suite101.com
  • C# Information Portal—Mantro Technologies
  • C# Help
  • dotnetspider.com
  • c-sharpcenter.com
  • csharp-corner.com
  • CSharpFriends—ASP.NET & C# Tutorials
  • Cshrp.net, an Online C# Resource
  • DevASP.NET for ASP.NET, XML, and C# Developers
  • DotNetBips—Applying .NET
  • GotDotNet: The Microsoft .NET Framework Community
  • Matthew Reynolds' .NET 247
  • RDPTools Website
  • The Code Project—Free Source Code and Tutorials
  • tiberi.us
  • Visual C# .NET Developer's Cookbook
  • Wimdows.net, Your Guide to ASP.net!
  • www.csharpsoft.com


C# 語法快速參考卡
// CLASS1.CS -- Syntax-at-a-Glance for the C# programming language.
// A quick code reference for programmers who work in many languages.
// Executable code, minimal comments document the essence of the language.
// Copyright (C) 2001 StructureByDesign.  All Rights Reserved.

using System;
using System.Collections;
using System.IO;

namespace StructureByDesign.Syntax
{
public class Class1: Object
{
    public static int Main(string[] args)       // Entry point.
    {
        System.Console.WriteLine("Hello");
        Class2 aclass2 = new Class2();
        aclass2.run();
        return 0;
    }
}

interface Interface1
{
    void run();
}

class Class2: Class1, Interface1
{
    public const int CONSTANT = 1;          // Access not restricted, implicitly static.
    private int m_intPrivateField;          // Access limited to containing type.
    public Class2() : base()                // Constructor.
    {
        initialize();
    }
    protected void initialize()             // Object initialization.
    {                                       // Access limited to containing class or types derived.
        Number = 1;
    }
    protected int Number                    // Language property feature.
    {
        get
        {
            return m_intPrivateField;
        }
        set
        {
            m_intPrivateField = value;      // Implicit parameter.
        }
    }
    public void run()
    {
        anonymousCode();
        arrays();
        collections();
        comparison();
        control();
        filesStreamsAndExceptions();
        numbersAndMath();
        primitivesAndConstants();
        runtimeTyping();
        strings();
    }
    void anonymousCode()
    {
        Delegate adelegate = new Delegate(Run);
        adelegate();
    }
    delegate void Delegate();
    void Run()
    {
        Console.WriteLine("Run");
    }
    void arrays()
    {
        int[] arrayOfInts = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
        arrayOfInts[0] = 9;
        assert(arrayOfInts[0] == arrayOfInts[9]);

        String[] arrayOfStrings = new String[10];
        assert(arrayOfStrings[0] == null);
        assert(arrayOfStrings.Length == 10);

        arrayOfStrings = new String[] { "one", "two" };

        byte[,] arrayOfBytes = { {0,0,0},
                                 {0,1,2},
                                 {0,2,4}};
        assert(arrayOfBytes[2,2] == 4);
    }
    void collections()
    {
        IList ailist = new ArrayList();
        ailist.Add("zero"); ailist.Add("one"); ailist.Add("three");
        ailist[2] = "two";
        assert(ailist[2].Equals("two"));
        ailist.Remove("two");
        ((ArrayList)ailist).Sort();
        for(IEnumerator aie = ((ArrayList)ailist).GetEnumerator(); aie.MoveNext(); )
            ;
        foreach(String astring in ailist)
            ;

        IDictionary aidictionary = new Hashtable();
        aidictionary.Add("key", "value");
        assert(aidictionary["key"].Equals("value"));

        // Set not available.
    }
    void comparison()
    {
        int aint1 = 1;
        int aint2 = 2;
        int aint = 1;
        String astring1 = "one";
        String astring2 = "two";
        String astring = astring1;

        assert(aint == aint1);
        assert(aint1 != aint2);
        assert(astring == astring1);
        assert(astring1 == String.Copy("one"));         // For strings == is overloaded to compare values.
        assert(!astring1.Equals(astring2));
        assert(astring1.Equals(String.Copy("one")));

        astring = null;
        if (astring != null && astring.Length > 0)      // Conditional evaluation.
            assert(false);

        if (aint2 < 0 || 1 < aint2)
            assert(true);
    }
    void control()
    {
        if (true)
            assert(true);
        else
            assert(false);
        /////
        switch ('b') {
            case 'a':
                assert(false);
                break;
            case 'b':
                assert(true);
                break;
            default:
                assert(false);
                break;
        }
        /////
        for (int ai1 = 0; ai1 < 10; ai1++)
            assert(true);
        /////
        int ai = 0;
        while (ai < 10) {
            assert(true);
            ai++;
        }

        do
            ai--;
        while (ai > 0);

        for (int x = 0; x < 10; x++)        // Labeled break/continue not available.
            for (int y = 0; y < 10; y++)
                if (x == 9)
                    break;
                else
                    continue;
    }
    void filesStreamsAndExceptions()
    {
        FileInfo afileinfo = new FileInfo("list.txt");
        try {
            StreamWriter asw = new StreamWriter("list.txt");
            asw.WriteLine("line");
            asw.WriteLine("line");
            asw.Close();

            assert(afileinfo.Exists);

            StreamReader asr = new StreamReader("list.txt");
            String astringLine;
            while ((astringLine = asr.ReadLine()) != null)
                assert(astringLine.Equals("line"));
            asr.Close();
        } catch (IOException aexception) {
            System.Console.WriteLine(aexception.Message);
            throw new NotSupportedException();
        }
        finally {
            afileinfo.Delete();
        }
    }
    void numbersAndMath()
    {
        assert(Int32.Parse("123") == 123);
        assert(123.ToString().Equals("123"));

        assert(Math.PI.ToString("n3").Equals("3.142"));

        assert(Int32.MaxValue < Int64.MaxValue);

        assert(Math.Abs(Math.Sin(0) - 0) <= Double.Epsilon);
        assert(Math.Abs(Math.Cos(0) - 1) <= Double.Epsilon);
        assert(Math.Abs(Math.Tan(0) - 0) <= Double.Epsilon);

        assert(Math.Abs(Math.Sqrt(4) - 2) <= Double.Epsilon);
        assert(Math.Abs(Math.Pow(3,3) - 27) <= Double.Epsilon);

        assert(Math.Max(0,1) == 1);
        assert(Math.Min(0,1) == 0);

        assert(Math.Abs(Math.Ceiling(9.87) - 10.0) <= Double.Epsilon);
        assert(Math.Abs(Math.Floor(9.87) - 9.0) <= Double.Epsilon);
        assert(Math.Round(9.87) == 10);

        Random arandom = new Random();
        double adouble = arandom.NextDouble();
        assert(0.0 <= adouble && adouble < 1.0);
        int aint = arandom.Next(10);
        assert(0 <= aint && aint < 10);
    }
    enum Season: byte { Spring=0, Summer, Fall, Winter };

    void primitivesAndConstants()
    {
        bool abool = false;
        char achar = 'A';           // 16 bits, Unicode

        byte abyte = 0x0;           // 8 bits, unsigned, hex constant
        sbyte asbyte = 0;           // 8 bits, signed

        short ashort = 0;           // 16 bits, signed
        ushort aushort = 0;         // 16 bits, unsigned

        int aint = 0;               // 32 bits, signed
        uint aunit = 0;             // 32 bits, unsigned

        long along = 0L;            // 64 bits, signed
        ulong aulong = 0;           // 64 bits, unsigned

        float afloat = 0.0F;        // 32 bits
        double adouble = 0.0;       // 64 bits

        decimal adecimal = 0;       // 128 bits, financial calculations

        Season aseason = Season.Fall;
        assert((byte)aseason == 2);
    }
    void runtimeTyping()
    {
        assert(new int[] { 1 } is int[]);
        assert(new ArrayList() is ArrayList);

        assert((new ArrayList()).GetType() == typeof(ArrayList));
        assert(typeof(Int32) is Type);      // Type of primitive type.

        assert(Type.GetType("System.Collections.ArrayList") == typeof(ArrayList));
    }
    void strings()
    {
        String astring1 = "one";
        String astring2 = "TWO";

        assert((astring1 + "/" + astring2).Equals("one/TWO"));
        assert(astring2.ToLower().Equals("two"));   // Equals ignoring case not available.
        assert(astring1.Length == 3);
        assert(astring1.Substring(0,2).Equals("on"));
        assert(astring1[2] == 'e');
        assert(astring1.ToUpper().Equals("ONE"));
        assert(astring2.ToLower().Equals("two"));
        assert(astring1.CompareTo("p") < 0);
        assert(astring1.IndexOf('e') == 2);
        assert(astring1.IndexOf("ne") == 1);
        assert(astring1.Trim().Length == astring1.Length);

        assert(Char.IsDigit('1'));
        assert(Char.IsLetter('a'));
        assert(Char.IsWhiteSpace('\t'));
        assert(Char.ToLower('A') == 'a');
        assert(Char.ToUpper('a') == 'A');
    }

    private void assert(bool abool)
    {
        if (!abool)
            throw new Exception("assert failed");
    }
 }
}


using System;
using System.Runtime.InteropServices;
using System.Text;
using HANDLE = System.IntPtr;
using HWND = System.IntPtr;
namespace Win32
{
public struct OVERLAPPED
{
public int Internal;
public int
InternalHigh;
public int offset;
public int
OffsetHigh;
public HANDLE hEvent;
}
public
struct SECURITY_ATTRIBUTES
{
public int
nLength;
public int lpSecurityDescriptor;
public
int bInheritHandle;
}
public struct PROCESS_INFORMATION
{
public HANDLE hProcess;
public HANDLE
hThread;
public int dwProcessId;
public int
dwThreadId;
}
public struct COMMPROP
{
public short wPacketLength;
public
short wPacketVersion;
public int
dwServiceMask;
public int dwReserved1;
public int
dwMaxTxQueue;
public int dwMaxRxQueue;
public int
dwMaxBaud;
public int dwProvSubType;
public int
dwProvCapabilities;
public int
dwSettableParams;
public int
dwSettableBaud;
public short wSettableData;
public
short wSettableStopParity;
public int
dwCurrentTxQueue;
public int
dwCurrentRxQueue;
public int dwProvSpec1;
public
int dwProvSpec2;
[MarshalAs(UnmanagedType.ByValArray,
SizeConst=1)] public short[] wcProvChar;
}
public struct
COMSTAT
{
public int fBitFields;
public
int cbInQue;
public int cbOutQue;
}
public
struct DCB
{
public int
DCBlength;
public int BaudRate;
public int
fBitFields;
public short wReserved;
public short
XonLim;
public short XoffLim;
public byte
ByteSize;
public byte Parity;
public byte
StopBits;
public byte XonChar;
public byte
XoffChar;
public byte ErrorChar;
public byte
EofChar;
public byte EvtChar;
public short
wReserved1;
}
public struct COMMTIMEOUTS
{
public int ReadIntervalTimeout;
public
int ReadTotalTimeoutMultiplier;
public int
ReadTotalTimeoutConstant;
public int
WriteTotalTimeoutMultiplier;
public int
WriteTotalTimeoutConstant;
}
public struct SYSTEM_INFO
{
public int dwOemID;
public int
dwPageSize;
public int
lpMinimumApplicationAddress;
public int
lpMaximumApplicationAddress;
public int
dwActiveProcessorMask;
public int
dwNumberOrfProcessors;
public int
dwProcessorType;
public int
dwAllocationGranularity;
public int
dwReserved;
}
#region Global Memory
Flags
#endregion
public struct MEMORYSTATUS
{
public int dwLength;
public int
dwMemoryLoad;
public int dwTotalPhys;
public int
dwAvailPhys;
public int dwTotalPageFile;
public
int dwAvailPageFile;
public int
dwTotalVirtual;
public int
dwAvailVirtual;
}
public struct GENERIC_MAPPING
{
public int GenericRead;
public int
GenericWrite;
public int GenericExecute;
public
int GenericAll;
}
public struct LUID
{
public int LowPart;
public int
HighPart;
}
public struct LUID_AND_ATTRIBUTES
{
public LUID pLuid;
public int
Attributes;
}
public struct ACL
{
public byte AclRevision;
public byte
Sbz1;
public short AclSize;
public short
AceCount;
public short Sbz2;
}
public struct
ACE_HEADER
{
public byte AceType;
public
byte AceFlags;
public int AceSize;
}
public
struct ACCESS_ALLOWED_ACE
{
public ACE_HEADER
Header;
public int Mask;
public int
SidStart;
}
public struct ACCESS_DENIED_ACE
{
public ACE_HEADER Header;
public int
Mask;
public int SidStart;
}
public struct
SYSTEM_AUDIT_ACE
{
public ACE_HEADER
Header;
public int Mask;
public int
SidStart;
}
public struct SYSTEM_ALARM_ACE
{
public ACE_HEADER Header;
public int
Mask;
public int SidStart;
}
public struct
ACL_REVISION_INFORMATION
{
public int
AclRevision;
}
public struct ACL_SIZE_INFORMATION
{
public int AceCount;
public int
AclBytesInUse;
public int
AclBytesFree;
}
public struct SECURITY_DESCRIPTOR
{
public byte Revision;
public byte
Sbz1;
public int Control;
public int
Owner;
public int Group;
public ACL
Sacl;
public ACL Dacl;
}
public struct
PRIVILEGE_SET
{
public int
PrivilegeCount;
public int
Control;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=1)]
public LUID_AND_ATTRIBUTES[] Privilege;
}
public struct
EXCEPTION_RECORD
{
public int
ExceptionCode;
public int ExceptionFlags;
public
int pExceptionRecord;
public int
ExceptionAddress;
public int
NumberParameters;
[MarshalAs(UnmanagedType.ByValArray,
SizeConst=15)] public int [] ExceptionInformation;
}
public
struct EXCEPTION_DEBUG_INFO
{
public EXCEPTION_RECORD
pExceptionRecord;
public int
dwFirstChance;
}
public struct CREATE_THREAD_DEBUG_INFO
{
public HANDLE hThread;
public int
lpThreadLocalBase;
public int
lpStartAddress;
}
public struct CREATE_PROCESS_DEBUG_INFO
{
public HANDLE hFile;
public HANDLE
hProcess;
public HANDLE hThread;
public int
lpBaseOfImage;
public int
dwDebugInfoFileOffset;
public int
nDebugInfoSize;
public int
lpThreadLocalBase;
public int
lpStartAddress;
public int lpImageName;
public
short fUnicode;
}
public struct EXIT_THREAD_DEBUG_INFO
{
public int dwExitCode;
}
public
struct EXIT_PROCESS_DEBUG_INFO
{
public int
dwExitCode;
}
public struct LOAD_DLL_DEBUG_INFO
{
public HANDLE hFile;
public int
lpBaseOfDll;
public int
dwDebugInfoFileOffset;
public int
nDebugInfoSize;
public int lpImageName;
public
short fUnicode;
}
public struct UNLOAD_DLL_DEBUG_INFO
{
public int lpBaseOfDll;
}
public
struct OUTPUT_DEBUG_STRING_INFO
{
public string
lpDebugStringData;
public short fUnicode;
public
short nDebugStringLength;
}
public struct RIP_INFO
{
public int dwError;
public int
dwType;
}
public struct OFSTRUCT
{
public byte cBytes;
public byte
fFixedDisk;
public short nErrCode;
public short
Reserved1;
public short
Reserved2;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=128)]
public byte[] szPathName;
}
public struct CRITICAL_SECTION
{
public int pDebugInfo;
public int
LockCount;
public int RecursionCount;
public int
pOwningThread;
public int pLockSemaphore;
public
int Reserved;
}
public struct BY_HANDLE_FILE_INFORMATION
{
public int dwFileAttributes;
public
FILETIME ftCreationTime;
public FILETIME
ftLastAccessTime;
public FILETIME
ftLastWriteTime;
public int
dwVolumeSerialNumber;
public int
nFileSizeHigh;
public int nFileSizeLow;
public int
nNumberOfLinks;
public int nFileIndexHigh;
public
int nFileIndexLow;
}
public struct MEMORY_BASIC_INFORMATION
{
public int BaseAddress;
public int
AllocationBase;
public int
AllocationProtect;
public int RegionSize;
public
int State;
public int Protect;
public int
lType;
}
public struct EVENTLOGRECORD
{
public int Length;
public int
Reserved;
public int RecordNumber;
public int
TimeGenerated;
public int TimeWritten;
public
int EventID;
public short EventType;
public short
NumStrings;
public short EventCategory;
public
short ReservedFlags;
public int ClosingRecordNumber;
public int StringOffset;
public int
UserSidLength;
public int UserSidOffset;
public
int DataLength;
public int DataOffset;
}
public struct TOKEN_GROUPS
{
public int
GroupCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=1)]
 public SID_AND_ATTRIBUTES[] Groups;
}
public struct
TOKEN_PRIVILEGES
{
public int
PrivilegeCount;
[MarshalAs(UnmanagedType.ByValArray,
SizeConst=1)] public LUID_AND_ATTRIBUTES[]
Privileges;
}
public struct CONTEXT
{
public double FltF0;
public double
FltF1;
public double FltF2;
public double
FltF3;
public double FltF4;
public double
FltF5;
public double FltF6;
public double
FltF7;
public double FltF8;
public double
FltF9;
public double FltF10;
public double
FltF11;
public double FltF12;
public double
FltF13;
public double FltF14;
public double
FltF15;
public double FltF16;
public double
FltF17;
public double FltF18;
public double
FltF19;
public double FltF20;
public double
FltF21;
public double FltF22;
public double
FltF23;
public double FltF24;
public double
FltF25;
public double FltF26;
public double
FltF27;
public double FltF28;
public double
FltF29;
public double FltF30;
public double
FltF31;
public double IntV0;
public double
IntT0;
public double IntT1;
public double
IntT2;
public double IntT3;
public double
IntT4;
public double IntT5;
public double
IntT6;
public double IntT7;
public double
IntS0;
public double IntS1;
public double
IntS2;
public double IntS3;
public double
IntS4;
public double IntS5;
public double
IntFp;
public double IntA0;
public double
IntA1;
public double IntA2;
public double
IntA3;
public double IntA4;
public double
IntA5;
public double IntT8;
public double
IntT9;
public double IntT10;
public double
IntT11;
public double IntRa;
public double
IntT12;
public double IntAt;
public double
IntGp;
public double IntSp;
public double
IntZero;
public double Fpcr;
public double
SoftFpcr;
public double Fir;
public int
Psr;
public int
ContextFlags;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=4)]
public int []Fill;
}
public struct EXCEPTION_POINTERS
{
public EXCEPTION_RECORD
pExceptionRecord;
public CONTEXT
ContextRecord;
}
public struct LDT_BYTES
{
public byte BaseMid;
public byte
Flags1;
public byte Flags2;
public byte
BaseHi;
}
public struct LDT_ENTRY
{
public short LimitLow;
public short
BaseLow;
public int HighWord;
}
public
struct TIME_ZONE_INFORMATION
{
public int
Bias;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=32)] public
short[] StandardName;
public SYSTEMTIME
StandardDate;
public int
StandardBias;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=32)]
public short[] DaylightName;
public SYSTEMTIME
DaylightDate;
public int DaylightBias;
}
public
struct WIN32_STREAM_ID
{
public int
dwStreamID;
public int dwStreamAttributes;
public
int dwStreamSizeLow;
public int
dwStreamSizeHigh;
public int
dwStreamNameSize;
public byte
cStreamName;
}
public struct STARTUPINFO
{
public int cb;
public string
lpReserved;
public string lpDesktop;
public string
lpTitle;
public int dwX;
public int
dwY;
public int dwXSize;
public int
dwYSize;
public int dwXCountChars;
public int
dwYCountChars;
public int dwFillAttribute;
public
int dwFlags;
public short wShowWindow;
public
short cbReserved2;
public int lpReserved2;
public
HANDLE hStdInput;
public HANDLE hStdOutput;
public
HANDLE hStdError;
}
public struct CPINFO
{
public int MaxCharSize;
[MarshalAs(UnmanagedType.ByValArray,
SizeConst=Kernel.MAX_DEFAULTCHAR)] public byte[] DefaultChar;
[MarshalAs(UnmanagedType.ByValArray,
SizeConst=Kernel.MAX_LEADBYTES)] public byte[] LeadByte;
}
public struct NUMBERFMT
{
public
int NumDigits;
public int LeadingZero;
public
int Grouping;
public string lpDecimalSep;
public
string lpThousandSep;
public int NegativeOrder;
}
public struct CURRENCYFMT
{
public
int NumDigits;
public int LeadingZero;
public
int Grouping;
public string lpDecimalSep;
public
string lpThousandSep;
public int NegativeOrder;
public int PositiveOrder;
public string
lpCurrencySymbol;
}
public struct COORD
{
public short x;
public short
y;
}
public struct SMALL_RECT
{
public short Left;
public short
Top;
public short Right;
public short
Bottom;
}
public struct KEY_EVENT_RECORD
{
public int bKeyDown;
public short
wRepeatCount;
public short wVirtualKeyCode;
public
short wVirtualScanCode;
public byte uChar;
public
int dwControlKeyState;
}
public struct MOUSE_EVENT_RECORD
{
public COORD dwMousePosition;
public
int dwButtonState;
public int
dwControlKeyState;
public int
dwEventFlags;
}
public struct WINDOW_BUFFER_SIZE_RECORD
{
public COORD dwSize;
}
public
struct MENU_EVENT_RECORD
{
public int
dwCommandId;
}
public struct FOCUS_EVENT_RECORD
{
public int bSetFocus;
}
public
struct CHAR_INFO
{
public short
Char;
public short Attributes;
}
public struct
CONSOLE_SCREEN_BUFFER_INFO
{
public COORD
dwSize;
public COORD dwCursorPosition;
public
short wAttributes;
public SMALL_RECT
srWindow;
public COORD
dwMaximumWindowSize;
}
public struct CONSOLE_CURSOR_INFO
{
public int dwSize;
public int
bVisible;
}
public struct SID_IDENTIFIER_AUTHORITY
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst=6)]
public byte[] Value;
}
public struct SID_AND_ATTRIBUTES
{
public int Sid;
public int
Attributes;
}
public struct WIN32_FIND_DATA
{
public int dwFileAttributes;
public
FILETIME ftCreationTime;
public FILETIME ftLastAccessTime;
public FILETIME ftLastWriteTime;
public int
nFileSizeHigh;
public int nFileSizeLow;
public int
dwReserved0;
public int
dwReserved1;
[MarshalAs(UnmanagedType.ByValTStr,
SizeConst=Kernel.MAX_PATH)]
public string cFileName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=14)]
public string cAlternate;
}
public struct
COMMCONFIG
{
public int dwSize;
public
short wVersion;
public short wReserved;
public DCB
dcbx;
public int dwProviderSubType;
public int
dwProviderOffset;
public int
dwProviderSize;
public byte
wcProviderData;
}
public struct SERVICE_STATUS
{
public int dwServiceType;
public int
dwCurrentState;
public int
dwControlsAccepted;
public int
dwWin32ExitCode;
public int
dwServiceSpecificExitCode;
public int
dwCheckPoint;
public int dwWaitHint;
}
public
struct ENUM_SERVICE_STATUS
{
public string
lpServiceName;
public string lpDisplayName;
public
SERVICE_STATUS ServiceStatus;
}
public struct
QUERY_SERVICE_LOCK_STATUS
{
public int
fIsLocked;
public string lpLockOwner;
public int
dwLockDuration;
}
public struct QUERY_SERVICE_CONFIG
{
public int dwServiceType;
public int
dwStartType;
public int dwErrorControl;
public
string lpBinaryPathName;
public string
lpLoadOrderGroup;
public int dwTagId;
public
string lpDependencies;
public string
lpServiceStartName;
public string
lpDisplayName;
}
public struct SERVICE_TABLE_ENTRY
{
public string lpServiceName;
public
int lpServiceProc;
}
public struct LARGE_INTEGER
{
public int lowpart;
public int
highpart;
}
public struct PERF_DATA_BLOCK
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=4)]
public string Signature;
public int
LittleEndian;
public int Version;
public int
Revision;
public int TotalByteLength;
public int
HeaderLength;
public int NumObjectTypes;
public
int DefaultObject;
public SYSTEMTIME
SystemTime;
public LARGE_INTEGER PerfTime;
public
LARGE_INTEGER PerfFreq;
public LARGE_INTEGER
PerTime100nSec;
public int
SystemNameLength;
public int
SystemNameOffset;
}
public struct PERF_OBJECT_TYPE
{
public int TotalByteLength;
public int
DefinitionLength;
public int HeaderLength;
public
int ObjectNameTitleIndex;
public string
ObjectNameTitle;
public int
ObjectHelpTitleIndex;
public string
ObjectHelpTitle;
public int DetailLevel;
public
int NumCounters;
public int DefaultCounter;
public
int NumInstances;
public int CodePage;
public
LARGE_INTEGER PerfTime;
public LARGE_INTEGER
PerfFreq;
}
public struct PERF_COUNTER_DEFINITION
{
public int ByteLength;
public int
CounterNameTitleIndex;
public string
CounterNameTitle;
public int
CounterHelpTitleIndex;
public string
CounterHelpTitle;
public int DefaultScale;
public
int DetailLevel;
public int CounterType;
public
int CounterSize;
public int
CounterOffset;
}
public struct PERF_INSTANCE_DEFINITION
{
public int ByteLength;
public int
ParentObjectTitleIndex;
public int
ParentObjectInstance;
public int UniqueID;
public
int NameOffset;
public int NameLength;
}
public
struct PERF_COUNTER_BLOCK
{
public int
ByteLength;
}
public struct OSVERSIONINFO
{
public int dwOSVersionInfoSize;
public
int dwMajorVersion;
public int
dwMinorVersion;
public int dwBuildNumber;
public
int dwPlatformId;
[MarshalAs(UnmanagedType.ByValTStr,
SizeConst=128)] public string szCSDVersion;
}
public struct
SYSTEM_POWER_STATUS
{
public byte
ACLineStatus;
public byte BatteryFlag;
public byte
BatteryLifePercent;
public byte Reserved1;
public
int BatteryLifeTime;
public int
BatteryFullLifeTime;
}
public abstract class AdvApi
{
[DllImport("AdvApi32")] public static extern int ImpersonateLoggedOnUser(HANDLE hToken);
[DllImport("advapi32")] public static extern int IsTextUnicode(IntPtr lpBuffer, int cb, ref int lpi);
[DllImport("advapi32")] public static extern int LogonUser(string lpszUsername, string lpszDomain, string lpszPassword, int dwLogonType, int dwLogonProvider, ref int phToken);
[DllImport("advapi32")] public static extern int NotifyChangeEventLog(HANDLE hEventLog, HANDLE hEvent);
[DllImport("advapi32")] public static extern int SetThreadToken(int Thread, int Token);
[DllImport("advapi32")] public static extern Byte GetSidSubAuthorityCount(IntPtr pSid);
[DllImport("advapi32")] public static extern SID_IDENTIFIER_AUTHORITY GetSidIdentifierAuthority(IntPtr pSid);
[DllImport("advapi32")] public static extern int AbortSystemShutdown(string lpMachineName);
[DllImport("advapi32")] public static extern int AccessCheck(ref SECURITY_DESCRIPTOR pSecurityDescriptor, int ClientToken, int DesiredAccess, GENERIC_MAPPING GenericMapping, PRIVILEGE_SET PrivilegeSet, int PrivilegeSetLength, int GrantedAccess, int Status);
[DllImport("advapi32")] public static extern int AccessCheckAndAuditAlarm(string SubsystemName, IntPtr HandleId, string ObjectTypeName, string ObjectName, SECURITY_DESCRIPTOR SecurityDescriptor, int DesiredAccess, GENERIC_MAPPING GenericMapping, int ObjectCreation, int GrantedAccess, int AccessStatus, ref int pfGenerateOnClose);
[DllImport("advapi32")] public static extern int AddAccessAllowedAce(ref ACL pAcl, int dwAceRevision, int AccessMask, IntPtr pSid);
[DllImport("advapi32")] public static extern int AddAccessDeniedAce(ref ACL pAcl, int dwAceRevision, int AccessMask, IntPtr pSid);
[DllImport("advapi32")] public static extern int AddAce(ref ACL pAcl, int dwAceRevision, int dwStartingAceIndex, IntPtr pAceList, int nAceListLength);
[DllImport("advapi32")] public static extern int AddAuditAccessAce(ref ACL pAcl, int dwAceRevision, int dwAccessMask, IntPtr pSid, int bAuditSuccess, int bAuditFailure);
[DllImport("advapi32")] public static extern int AdjustTokenGroups(int TokenHandle, int ResetToDefault, TOKEN_GROUPS NewState, int BufferLength, TOKEN_GROUPS PreviousState, int ReturnLength);
[DllImport("advapi32")] public static extern int AdjustTokenPrivileges(int TokenHandle, int DisableAllPrivileges, TOKEN_PRIVILEGES NewState, int BufferLength, TOKEN_PRIVILEGES PreviousState, int ReturnLength);
[DllImport("advapi32")] public static extern int AllocateAndInitializeSid(ref SID_IDENTIFIER_AUTHORITY pIdentifierAuthority, Byte nSubAuthorityCount, int nSubAuthority0, int nSubAuthority1, int nSubAuthority2, int nSubAuthority3, int nSubAuthority4, int nSubAuthority5, int nSubAuthority6, int nSubAuthority7, ref int lpPSid);
[DllImport("advapi32")] public static extern int AllocateLocallyUniqueId(LARGE_INTEGER Luid);
[DllImport("advapi32")] public static extern int AreAllAccessesGranted(int GrantedAccess, int DesiredAccess);
[DllImport("advapi32")] public static extern int AreAnyAccessesGranted(int GrantedAccess, int DesiredAccess);
[DllImport("advapi32")] public static extern int BackupEventLog(HANDLE hEventLog, string lpBackupFileName);
[DllImport("advapi32")] public static extern int ChangeServiceConfig(HANDLE hService, int dwServiceType, int dwStartType, int dwErrorControl, string lpBinaryPathName, string lpLoadOrderGroup, ref int lpdwTagId, string lpDependencies, string lpServiceStartName, string lpPassword, string lpDisplayName);
[DllImport("advapi32")] public static extern int ClearEventLog(HANDLE hEventLog, string lpBackupFileName);
[DllImport("advapi32")] public static extern int CloseEventLog(HANDLE hEventLog);
[DllImport("advapi32")] public static extern int CloseServiceHandle(HANDLE hSCObject);
[DllImport("advapi32")] public static extern int ControlService(HANDLE hService, int dwControl, ref SERVICE_STATUS lpServiceStatus);
[DllImport("advapi32")] public static extern int CopySid(int nDestinationSidLength, IntPtr pDestinationSid, IntPtr pSourceSid);
[DllImport("advapi32")] public static extern int CreatePrivateObjectSecurity(ref SECURITY_DESCRIPTOR ParentDescriptor, SECURITY_DESCRIPTOR CreatorDescriptor, SECURITY_DESCRIPTOR NewDescriptor, int IsDirectoryObject, int Token, GENERIC_MAPPING GenericMapping);
[DllImport("advapi32")] public static extern int CreateProcessAsUser(HANDLE hToken, string lpApplicationName, string lpCommandLine, ref SECURITY_ATTRIBUTES lpProcessAttributes, ref SECURITY_ATTRIBUTES lpThreadAttributes, int bInheritHandles, int dwCreationFlags, string lpEnvironment, string lpCurrentDirectory, ref STARTUPINFO lpStartupInfo, ref PROCESS_INFORMATION lpProcessInformation);
[DllImport("advapi32")] public static extern int CreateService(HANDLE hSCManager, string lpServiceName, string lpDisplayName, int dwDesiredAccess, int dwServiceType, int dwStartType, int dwErrorControl, string lpBinaryPathName, string lpLoadOrderGroup, ref int lpdwTagId, string lpDependencies, string lp, string lpPassword);
[DllImport("advapi32")] public static extern int DeleteAce(ref ACL pAcl, int dwAceIndex);
[DllImport("advapi32")] public static extern int DeleteService(HANDLE hService);
[DllImport("advapi32")] public static extern int DeregisterEventSource(HANDLE hEventLog);
[DllImport("advapi32")] public static extern int DestroyPrivateObjectSecurity(ref SECURITY_DESCRIPTOR ObjectDescriptor);
[DllImport("advapi32")] public static extern int DuplicateToken(int ExistingTokenHandle, short ImpersonationLevel, int DuplicateTokenHandle);
[DllImport("advapi32")] public static extern int EnumDependentServices(HANDLE hService, int dwServiceState, ref ENUM_SERVICE_STATUS lpServices, int cbBufSize, ref int pcbBytesNeeded, ref int lpServicesReturned);
[DllImport("advapi32")] public static extern int EnumServicesStatus(HANDLE hSCManager, int dwServiceType, int dwServiceState, ref ENUM_SERVICE_STATUS lpServices, int cbBufSize, ref int pcbBytesNeeded, ref int lpServicesReturned, ref int lpResumeHandle);
[DllImport("advapi32")] public static extern int EqualPrefixSid(IntPtr pSid1, IntPtr pSid2);
[DllImport("advapi32")] public static extern int EqualSid(IntPtr pSid1, IntPtr pSid2);
[DllImport("advapi32")] public static extern int FindFirstFreeAce(ref ACL pAcl, ref int pAce);
[DllImport("advapi32")] public static extern int GetAce(ref ACL pAcl, int dwAceIndex, IntPtr pAce);
[DllImport("advapi32")] public static extern int GetAclInformation(ref ACL pAcl, IntPtr pAclInformation, int nAclInformationLength, short dwAclInformationClass);
[DllImport("advapi32")] public static extern int GetFileSecurity(string lpFileName, int RequestedInformation, ref SECURITY_DESCRIPTOR pSecurityDescriptor, int nLength, ref int lpnLengthNeeded);
[DllImport("advapi32")] public static extern int GetKernelObjectSecurity(HANDLE handle, int RequestedInformation, ref SECURITY_DESCRIPTOR pSecurityDescriptor, int nLength, ref int lpnLengthNeeded);
[DllImport("advapi32")] public static extern int GetLengthSid(IntPtr pSid);
[DllImport("advapi32")] public static extern int GetNumberOfEventLogRecords(HANDLE hEventLog, int NumberOfRecords);
[DllImport("advapi32")] public static extern int GetOldestEventLogRecord(HANDLE hEventLog, int OldestRecord);
[DllImport("advapi32")] public static extern int GetPrivateObjectSecurity(ref SECURITY_DESCRIPTOR ObjectDescriptor, int SecurityInformation, SECURITY_DESCRIPTOR ResultantDescriptor, int DescriptorLength, int ReturnLength);
[DllImport("advapi32")] public static extern int GetSecurityDescriptorControl(ref SECURITY_DESCRIPTOR pSecurityDescriptor, short pControl, ref int lpdwRevision);
[DllImport("advapi32")] public static extern int GetSecurityDescriptorDacl(ref SECURITY_DESCRIPTOR pSecurityDescriptor, ref int lpbDaclPresent, ref ACL pDacl, ref int lpbDaclDefaulted);
[DllImport("advapi32")] public static extern int GetSecurityDescriptorGroup(ref SECURITY_DESCRIPTOR pSecurityDescriptor, IntPtr pGroup, ref int lpbGroupDefaulted);
[DllImport("advapi32")] public static extern int GetSecurityDescriptorLength(ref SECURITY_DESCRIPTOR pSecurityDescriptor);
[DllImport("advapi32")] public static extern int GetSecurityDescriptorOwner(ref SECURITY_DESCRIPTOR pSecurityDescriptor, IntPtr pOwner, ref int lpbOwnerDefaulted);
[DllImport("advapi32")] public static extern int GetSecurityDescriptorSacl(ref SECURITY_DESCRIPTOR pSecurityDescriptor, ref int lpbSaclPresent, ref ACL pSacl, ref int lpbSaclDefaulted);
[DllImport("advapi32")] public static extern int GetServiceDisplayName(HANDLE hSCManager, string lpServiceName, StringBuilder lpDisplayName, ref int cchBuffer);
[DllImport("advapi32")] public static extern int GetServiceKeyName(HANDLE hSCManager, string lpDisplayName, StringBuilder lpServiceName, ref int cchBuffer);
[DllImport("advapi32")] public static extern int GetSidLengthRequired(Byte nSubAuthorityCount);
[DllImport("advapi32")] public static extern int GetSidSubAuthority(IntPtr pSid, int nSubAuthority);
[DllImport("advapi32")] public static extern int GetTokenInformation(int TokenHandle, short TokenInformationClass, IntPtr TokenInformation, int TokenInformationLength, int ReturnLength);
[DllImport("advapi32")] public static extern int GetUserName(StringBuilder lpBuffer, int nSize);
[DllImport("advapi32")] public static extern int ImpersonateNamedPipeClient(HANDLE hNamedPipe);
[DllImport("advapi32")] public static extern int ImpersonateSelf(short ImpersonationLevel);
[DllImport("advapi32")] public static extern int InitializeAcl(ref ACL pAcl, int nAclLength, int dwAclRevision);
[DllImport("advapi32")] public static extern int InitializeSecurityDescriptor(ref SECURITY_DESCRIPTOR pSecurityDescriptor, int dwRevision);
[DllImport("advapi32")] public static extern int InitializeSid(IntPtr Sid, ref SID_IDENTIFIER_AUTHORITY pIdentifierAuthority, Byte nSubAuthorityCount);
[DllImport("advapi32")] public static extern int InitiateSystemShutdown(string lpMachineName, string lpMessage, int dwTimeout, int bForceAppsClosed, int bRebootAfterShutdown);
[DllImport("advapi32")] public static extern int IsValidAcl(ref ACL pAcl);
[DllImport("advapi32")] public static extern int IsValidSecurityDescriptor(ref SECURITY_DESCRIPTOR pSecurityDescriptor);
[DllImport("advapi32")] public static extern int IsValidSid(IntPtr pSid);
[DllImport("advapi32")] public static extern int LockServiceDatabase(HANDLE hSCManager);
[DllImport("advapi32")] public static extern int LookupAccountName(string lpSystemName, string lpAccountName, int Sid, int cbSid, string ReferencedDomainName, int cbReferencedDomainName, int peUse);
[DllImport("advapi32")] public static extern int LookupAccountSid(string lpSystemName, IntPtr Sid, string name, int cbName, string ReferencedDomainName, int cbReferencedDomainName, int peUse);
[DllImport("advapi32")] public static extern int LookupPrivilegeDisplayName(string lpSystemName, string lpName, string lpDisplayName, int cbDisplayName, ref int lpLanguageID);
[DllImport("advapi32")] public static extern int LookupPrivilegeName(string lpSystemName, ref LARGE_INTEGER lpLuid, string lpName, int cbName);
[DllImport("advapi32")] public static extern int LookupPrivilegeValue(string lpSystemName, string lpName, ref LARGE_INTEGER lpLuid);
[DllImport("advapi32")] public static extern int MakeAbsoluteSD(ref SECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, ref SECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor, ref int lpdwAbsoluteSecurityDescriptorSize, ref ACL pDacl, ref int lpdwDaclSize, ref ACL pSacl, ref int lpdwSaclSize, IntPtr pOwner, ref int lpdwOwnerSize, IntPtr pPrimaryGroup, ref int lpdwPrimaryGroupSize);
[DllImport("advapi32")] public static extern int MakeSelfRelativeSD(ref SECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor, ref SECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, ref int lpdwBufferLength);
[DllImport("advapi32")] public static extern int NotifyBootConfigStatus(int BootAcceptable);
[DllImport("advapi32")] public static extern int ObjectCloseAuditAlarm(string SubsystemName, IntPtr HandleId, int GenerateOnClose);
[DllImport("advapi32")] public static extern int ObjectPrivilegeAuditAlarm(string SubsystemName, IntPtr HandleId, int ClientToken, int DesiredAccess, PRIVILEGE_SET Privileges, int AccessGranted);
[DllImport("advapi32")] public static extern int OpenBackupEventLog(string lpUNCServerName, string lpFileName);
[DllImport("advapi32")] public static extern int OpenEventLog(string lpUNCServerName, string lpSourceName);
[DllImport("advapi32")] public static extern int OpenSCManager(string lpMachineName, string lpDatabaseName, int dwDesiredAccess);
[DllImport("advapi32")] public static extern int OpenService(HANDLE hSCManager, string lpServiceName, int dwDesiredAccess);
[DllImport("advapi32")] public static extern int OpenThreadToken(int ThreadHandle, int DesiredAccess, int OpenAsSelf, int TokenHandle);
[DllImport("advapi32")] public static extern int PrivilegeCheck(int ClientToken, PRIVILEGE_SET RequiredPrivileges, ref int pfResult);
[DllImport("advapi32")] public static extern int PrivilegedServiceAuditAlarm(string SubsystemName, string ServiceName, int ClientToken, PRIVILEGE_SET Privileges, int AccessGranted);
[DllImport("advapi32")] public static extern int QueryServiceConfig(HANDLE hService, ref QUERY_SERVICE_CONFIG lpServiceConfig, int cbBufSize, ref int pcbBytesNeeded);
[DllImport("advapi32")] public static extern int QueryServiceLockStatus(HANDLE hSCManager, ref QUERY_SERVICE_LOCK_STATUS lpLockStatus, int cbBufSize, ref int pcbBytesNeeded);
[DllImport("advapi32")] public static extern int QueryServiceObjectSecurity(HANDLE hService, int dwSecurityInformation, IntPtr lpSecurityDescriptor, int cbBufSize, ref int pcbBytesNeeded);
[DllImport("advapi32")] public static extern int QueryServiceStatus(HANDLE hService, ref SERVICE_STATUS lpServiceStatus);
[DllImport("advapi32")] public static extern int ReadEventLog(HANDLE hEventLog, int dwReadFlags, int dwRecordOffset, ref EVENTLOGRECORD lpBuffer, int nNumberOfBytesToRead, ref int pnBytesRead, ref int pnMinNumberOfBytesNeeded);
[DllImport("advapi32")] public static extern int RegCloseKey(HANDLE hKey);
[DllImport("advapi32")] public static extern int RegConnectRegistry(string lpMachineName, HANDLE hKey, ref int phkResult);
[DllImport("advapi32")] public static extern int RegCreateKey(HANDLE hKey, string lpSubKey, ref int phkResult);
[DllImport("advapi32")] public static extern int RegCreateKeyEx(HANDLE hKey, string lpSubKey, int Reserved, string lpClass, int dwOptions, int samDesired, ref SECURITY_ATTRIBUTES lpSecurityAttributes, ref int phkResult, ref int lpdwDisposition);
[DllImport("advapi32")] public static extern int RegDeleteKey(HANDLE hKey, string lpSubKey);
[DllImport("advapi32")] public static extern int RegDeleteValue(HANDLE hKey, string lpValueName);
[DllImport("advapi32")] public static extern int RegEnumKey(HANDLE hKey, int dwIndex, string lpName, int cbName);
[DllImport("advapi32")] public static extern int RegEnumKeyEx(HANDLE hKey, int dwIndex, string lpName, ref int lpcbName, ref int lpReserved, string lpClass, ref int lpcbClass, ref FILETIME lpftLastWriteTime);
[DllImport("advapi32")] public static extern int RegEnumValue(HANDLE hKey, int dwIndex, string lpValueName, ref int lpcbValueName, ref int lpReserved, ref int lpType, Byte lpData, ref int lpcbData);
[DllImport("advapi32")] public static extern int RegFlushKey(HANDLE hKey);
[DllImport("advapi32")] public static extern int RegGetKeySecurity(HANDLE hKey, int SecurityInformation, ref SECURITY_DESCRIPTOR pSecurityDescriptor, ref int lpcbSecurityDescriptor);
[DllImport("advapi32")] public static extern int RegLoadKey(HANDLE hKey, string lpSubKey, string lpFile);
[DllImport("advapi32")] public static extern int RegNotifyChangeKeyValue(HANDLE hKey, int bWatchSubtree, int dwNotifyFilter, HANDLE hEvent, int fAsynchronus);
[DllImport("advapi32")] public static extern int RegOpenKey(HANDLE hKey, string lpSubKey, ref int phkResult);
[DllImport("advapi32")] public static extern int RegOpenKeyEx(HANDLE hKey, string lpSubKey, int ulOptions, int samDesired, ref int phkResult);
[DllImport("advapi32")] public static extern int RegQueryInfoKey(HANDLE hKey, string lpClass, ref int lpcbClass, ref int lpReserved, ref int lpcSubKeys, ref int lpcbMaxSubKeyLen, ref int lpcbMaxClassLen, ref int lpcValues, ref int lpcbMaxValueNameLen, ref int lpcbMaxValueLen, ref int lpcbSecurityDescriptor, ref FILETIME lpftLastWriteTime);
[DllImport("advapi32")] public static extern int RegQueryValue(HANDLE hKey, string lpSubKey, string lpValue, ref int lpcbValue);
[DllImport("advapi32")] public static extern int RegQueryValueEx(HANDLE hKey, string lpValueName, ref int lpReserved, ref int lpType, IntPtr lpData, ref int lpcbData);
[DllImport("advapi32")] public static extern int RegReplaceKey(HANDLE hKey, string lpSubKey, string lpNewFile, string lpOldFile);
[DllImport("advapi32")] public static extern int RegRestoreKey(HANDLE hKey, string lpFile, int dwFlags);
[DllImport("advapi32")] public static extern int RegSaveKey(HANDLE hKey, string lpFile, ref SECURITY_ATTRIBUTES lpSecurityAttributes);
[DllImport("advapi32")] public static extern int RegSetKeySecurity(HANDLE hKey, int SecurityInformation, ref SECURITY_DESCRIPTOR pSecurityDescriptor);
[DllImport("advapi32")] public static extern int RegSetValue(HANDLE hKey, string lpSubKey, int dwType, string lpData, int cbData);
[DllImport("advapi32")] public static extern int RegSetValueEx(HANDLE hKey, string lpValueName, int Reserved, int dwType, IntPtr lpData, int cbData);
[DllImport("advapi32")] public static extern int RegUnLoadKey(HANDLE hKey, string lpSubKey);
[DllImport("advapi32")] public static extern int RegisterEventSource(string lpUNCServerName, string lpSourceName);
[DllImport("advapi32")] public static extern int RegisterServiceCtrlHandler(string lpServiceName, ref int lpHandlerProc);
[DllImport("advapi32")] public static extern int ReportEvent(HANDLE hEventLog, int wType, int wCategory, int dwEventID, IntPtr lpUserSid, int wNumStrings, int dwDataSize, ref int lpStrings, IntPtr lpRawData);
[DllImport("advapi32")] public static extern int RevertToSelf();
[DllImport("advapi32")] public static extern int SetAclInformation(ref ACL pAcl, IntPtr pAclInformation, int nAclInformationLength, short dwAclInformationClass);
[DllImport("advapi32")] public static extern int SetFileSecurity(string lpFileName, int SecurityInformation, ref SECURITY_DESCRIPTOR pSecurityDescriptor);
[DllImport("advapi32")] public static extern int SetKernelObjectSecurity(HANDLE handle, int SecurityInformation, SECURITY_DESCRIPTOR SecurityDescriptor);
[DllImport("advapi32")] public static extern int SetPrivateObjectSecurity(int SecurityInformation, SECURITY_DESCRIPTOR ModificationDescriptor, SECURITY_DESCRIPTOR ObjectsSecurityDescriptor, GENERIC_MAPPING GenericMapping, int Token);
[DllImport("advapi32")] public static extern int SetSecurityDescriptorDacl(ref SECURITY_DESCRIPTOR pSecurityDescriptor, int bDaclPresent, ref ACL pDacl, int bDaclDefaulted);
[DllImport("advapi32")] public static extern int SetSecurityDescriptorGroup(ref SECURITY_DESCRIPTOR pSecurityDescriptor, IntPtr pGroup, int bGroupDefaulted);
[DllImport("advapi32")] public static extern int SetSecurityDescriptorOwner(ref SECURITY_DESCRIPTOR pSecurityDescriptor, IntPtr pOwner, int bOwnerDefaulted);
[DllImport("advapi32")] public static extern int SetSecurityDescriptorSacl(ref SECURITY_DESCRIPTOR pSecurityDescriptor, int bSaclPresent, ref ACL pSacl, int bSaclDefaulted);
[DllImport("advapi32")] public static extern int SetServiceObjectSecurity(HANDLE hService, int dwSecurityInformation, IntPtr lpSecurityDescriptor);
[DllImport("advapi32")] public static extern int SetServiceStatus(HANDLE hServiceStatus, ref SERVICE_STATUS lpServiceStatus);
[DllImport("advapi32")] public static extern int SetTokenInformation(int TokenHandle, short TokenInformationClass, IntPtr TokenInformation, int TokenInformationLength);
[DllImport("advapi32")] public static extern int StartService(HANDLE hService, int dwNumServiceArgs, ref int lpServiceArgVectors);
[DllImport("advapi32")] public static extern int StartServiceCtrlDispatcher(ref SERVICE_TABLE_ENTRY lpServiceStartTable);
[DllImport("advapi32")] public static extern int UnlockServiceDatabase(IntPtr ScLock);
[DllImport("advapi32")] public static extern void FreeSid(IntPtr pSid);
[DllImport("advapi32")] public static extern void MapGenericMask(int AccessMask, GENERIC_MAPPING GenericMapping);
[DllImport("advapi32")] public static extern int GetUserNameW(Byte lpBuffer, int nSize);
[DllImport("advapi32")] public static extern int OpenProcessToken(int ProcessHandle, int DesiredAccess, int TokenHandle);
}
public abstract class Version
{
[DllImport("version")] public static extern int GetFileVersionInfo(string lptstrFilename, int dwHandle, int dwLen, IntPtr lpData);
[DllImport("version")] public static extern int GetFileVersionInfoSize(string lptstrFilename, ref int lpdwHandle);
[DllImport("version")] public static extern int VerFindFile(int uFlags, string szFileName, string szWinDir, string szAppDir, string szCurDir, ref int lpuCurDirLen, string szDestDir, ref int lpuDestDirLen);
[DllImport("version")] public static extern int VerInstallFile(int uFlags, string szSrcFileName, string szDestFileName, string szSrcDir, string szDestDir, string szCurDir, string szTmpFile, ref int lpuTmpFileLen);
[DllImport("version")] public static extern int VerQueryValue(IntPtr pBlock, string lpSubBlock, ref int lplpBuffer, ref int puLen);
}
 public abstract class
Kernel
{
[DllImport("kernel32")] public static extern
void OutputDebugString(string
lpszOutputString);
[DllImport("KERNEL32")] public static extern
int ConvertDefaultLocale(int Locale);
[DllImport("KERNEL32")]
public static extern int EnumDateFormats(int lpDateFmtEnumProc, int Locale, int
dwFlags);
[DllImport("KERNEL32")] public static extern int
EnumSystemCodePages(int lpCodePageEnumProc, int
dwFlags);
[DllImport("KERNEL32")] public static extern int
EnumSystemLocales(int lpLocaleEnumProc, int
dwFlags);
[DllImport("KERNEL32")] public static extern int
EnumTimeFormats(int lpTimeFmtEnumProc, int Locale, int
dwFlags);
[DllImport("KERNEL32")] public static extern int
GetThreadLocale();
[DllImport("KERNEL32")] public static extern
int IsValidLocale(int Locale, int
dwFlags);
[DllImport("KERNEL32")] public static extern void
ZeroMemory(IntPtr dest, int numBytes);
[DllImport("kernel32")]
public static extern COORD GetLargestConsoleWindowSize(HANDLE
hConsoleOutput);
[DllImport("kernel32")] public static extern int
AllocConsole();
[DllImport("kernel32")] public static extern int
BackupRead(HANDLE hFile, Byte lpBuffer, int nNumberOfBytesToRead, ref int
lpNumberOfBytesRead, int bAbort, int bProcessSecurity, IntPtr
lpContext);
[DllImport("kernel32")] public static extern int
BackupSeek(HANDLE hFile, int dwLowBytesToSeek, int dwHighBytesToSeek, ref int
lpdwLowByteSeeked, ref int lpdwHighByteSeeked, ref int
lpContext);
[DllImport("kernel32")] public static extern int
BackupWrite(HANDLE hFile, Byte lpBuffer, int nNumberOfBytesToWrite, ref int
lpNumberOfBytesWritten, int bAbort, int bProcessSecurity, ref int
lpContext);
[DllImport("kernel32")] public static extern int
Beep(int dwFreq, int dwDuration);
[DllImport("kernel32")] public
static extern int BeginUpdateResource(string pFileName, int
bDeleteExistingResources);
[DllImport("kernel32")] public static
extern int BuildCommDCB(string lpDef, ref DCB
lpDCB);
[DllImport("kernel32")] public static extern int
BuildCommDCBAndTimeouts(string lpDef, ref DCB lpDCB, ref COMMTIMEOUTS
lpCommTimeouts);
[DllImport("kernel32")] public static extern int
CallNamedPipe(string lpNamedPipeName, IntPtr lpInBuffer, int nInBufferSize,
IntPtr lpOutBuffer, int nOutBufferSize, ref int lpBytesRead, int
nTimeOut);
[DllImport("kernel32")] public static extern int
ClearCommBreak(int nCid);
[DllImport("kernel32")] public static
extern int ClearCommError(HANDLE hFile, ref int lpErrors, ref COMSTAT
lpStat);
[DllImport("kernel32")] public static extern int
CloseHandle(HANDLE hObject);
[DllImport("kernel32")] public
static extern int CommConfigDialog(string lpszName, HWND hwnd, ref COMMCONFIG
lpCC);
[DllImport("kernel32")] public static extern int
CompareFileTime(ref FILETIME lpFileTime1, ref FILETIME
lpFileTime2);
[DllImport("kernel32")] public static extern int
CompareString(int Locale, int dwCmpFlags, string lpString1, int cchCount1,
string lpString2, int cchCount2);
[DllImport("kernel32")] public
static extern int ConnectNamedPipe(HANDLE hNamedPipe, ref OVERLAPPED
lpOverlapped);
[DllImport("kernel32")] public static extern int
ContinueDebugEvent(int dwProcessId, int dwThreadId, int
dwContinueStatus);
[DllImport("kernel32")] public static extern
int CopyFile(string lpExistingFileName, string lpNewFileName, int
bFailIfExists);
[DllImport("kernel32")] public static extern int
CreateConsoleScreenBuffer(int dwDesiredAccess, int dwShareMode, ref
SECURITY_ATTRIBUTES lpSecurityAttributes, int dwFlags, IntPtr
lpScreenBufferData);
[DllImport("kernel32")] public static extern
int CreateDirectory(string lpPathName, ref SECURITY_ATTRIBUTES
lpSecurityAttributes);
[DllImport("kernel32")] public static
extern int CreateDirectoryEx(string lpTemplateDirectory, string lpNewDirectory,
ref SECURITY_ATTRIBUTES
lpSecurityAttributes);
[DllImport("kernel32")] public static
extern int CreateEvent(ref SECURITY_ATTRIBUTES lpEventAttributes, int
bManualReset, int bInitialState, string
lpName);
[DllImport("kernel32")] public static extern int
CreateFile(string lpFileName, int dwDesiredAccess, int dwShareMode, ref
SECURITY_ATTRIBUTES lpSecurityAttributes, int dwCreationDisposition, int
dwFlagsAndAttributes, HANDLE
hTemplateFile);
[DllImport("kernel32")] public static extern int
CreateFileMapping(HANDLE hFile, ref SECURITY_ATTRIBUTES lpFileMappigAttributes,
int flProtect, int dwMaximumSizeHigh, int dwMaximumSizeLow, string
lpName);
[DllImport("kernel32")] public static extern int
CreateIoCompletionPort(int FileHandle, int ExistingCompletionPort, int
CompletionKey, int
NumberOfConcurrentThreads);
[DllImport("kernel32")] public static
extern int CreateMailslot(string lpName, int nMaxMessageSize, int lReadTimeout,
ref SECURITY_ATTRIBUTES
lpSecurityAttributes);
[DllImport("kernel32")] public static
extern int CreateMutex(ref SECURITY_ATTRIBUTES lpMutexAttributes, int
bInitialOwner, string lpName);
[DllImport("kernel32")] public
static extern int CreateNamedPipe(string lpName, int dwOpenMode, int dwPipeMode,
int nMaxInstances, int nOutBufferSize, int nInBufferSize, int nDefaultTimeOut,
ref SECURITY_ATTRIBUTES
lpSecurityAttributes);
[DllImport("kernel32")] public static
extern int CreatePipe(int phReadPipe, int phWritePipe, ref SECURITY_ATTRIBUTES
lpPipeAttributes, int nSize);
[DllImport("kernel32")] public
static extern int CreateProcess(string lpApplicationName, string lpCommandLine,
ref SECURITY_ATTRIBUTES lpProcessAttributes, ref SECURITY_ATTRIBUTES
lpThreadAttributes, int bInheritHandles, int dwCreationFlags, IntPtr
lpEnvironment, string lpCurrentDriectory, ref STARTUPINFO lpStartupInfo, ref
PROCESS_INFORMATION
lpProcessInformation);
[DllImport("kernel32")] public static
extern int CreateRemoteThread(HANDLE hProcess, ref SECURITY_ATTRIBUTES
lpThreadAttributes, int dwStackSize, ref int lpStartAddress, IntPtr lpParameter,
int dwCreationFlags, ref int lpThreadId);
[DllImport("kernel32")]
public static extern int CreateSemaphore(ref SECURITY_ATTRIBUTES
lpSemaphoreAttributes, int lInitialCount, int lMaximumCount, string
lpName);
[DllImport("kernel32")] public static extern int
CreateTapePartition(HANDLE hDevice, int dwPartitionMethod, int dwCount, int
dwSize);
[DllImport("kernel32")] public static extern int
CreateThread(ref SECURITY_ATTRIBUTES lpThreadAttributes, int dwStackSize, ref
int lpStartAddress, IntPtr lpParameter, int dwCreationFlags, ref int
lpThreadId);
[DllImport("kernel32")] public static extern int
DebugActiveProcess(int dwProcessId);
[DllImport("kernel32")]
public static extern int DefineDosDevice(int dwFlags, string lpDeviceName,
string lpTargetPath);
[DllImport("kernel32")] public static
extern int DeleteFile(string lpFileName);
[DllImport("kernel32")]
public static extern int DeviceIoControl(HANDLE hDevice, int dwIoControlCode,
IntPtr lpInBuffer, int nInBufferSize, IntPtr lpOutBuffer, int nOutBufferSize,
ref int lpBytesReturned, ref OVERLAPPED
lpOverlapped);
[DllImport("kernel32")] public static extern int
DisableThreadLibraryCalls(HANDLE
hLibModule);
[DllImport("kernel32")] public static extern int
DisconnectNamedPipe(HANDLE hNamedPipe);
[DllImport("kernel32")]
public static extern int DosDateTimeToFileTime(int wFatDate, int wFatTime, ref
FILETIME lpFileTime);
[DllImport("kernel32")] public static
extern int DuplicateHandle(HANDLE hSourceProcessHandle, HANDLE hSourceHandle,
HANDLE hTargetProcessHandle, ref int lpTargetHandle, int dwDesiredAccess, int
bInheritHandle, int dwOptions);
[DllImport("kernel32")] public
static extern int EndUpdateResource(HANDLE hUpdate, int
fDiscard);
[DllImport("kernel32")] public static extern int
EnumCalendarInfo(int lpCalInfoEnumProc, int Locale, int Calendar, int
CalType);
[DllImport("kernel32")] public static extern int
EnumResourceLanguages(HANDLE hModule, string lpType, string lpName, ref int
lpEnumFunc, int lParam);
[DllImport("kernel32")] public static
extern int EnumResourceNames(HANDLE hModule, string lpType, ref int lpEnumFunc,
int lParam);
[DllImport("kernel32")] public static extern int
EnumResourceTypes(HANDLE hModule, ref int lpEnumFunc, int
lParam);
[DllImport("kernel32")] public static extern int
EraseTape(HANDLE hDevice, int dwEraseType, int
bimmediate);
[DllImport("kernel32")] public static extern int
EscapeCommFunction(int nCid, int nFunc);
[DllImport("kernel32")]
public static extern int ExpandEnvironmentStrings(string lpSrc, string lpDst,
int nSize);
[DllImport("kernel32")] public static extern int
FileTimeToDosDateTime(ref FILETIME lpFileTime, ref int lpFatDate, ref int
lpFatTime);
[DllImport("kernel32")] public static extern int
FileTimeToLocalFileTime(ref FILETIME lpFileTime, ref FILETIME
lpLocalFileTime);
[DllImport("kernel32")] public static extern
int FileTimeToSystemTime(ref FILETIME lpFileTime, ref SYSTEMTIME
lpSystemTime);
[DllImport("kernel32")] public static extern int
FillConsoleOutputAttribute(HANDLE hConsoleOutput, int wAttribute, int nLength,
COORD dwWriteCoord, ref int
lpNumberOfAttrsWritten);
[DllImport("kernel32")] public static
extern int FillConsoleOutputCharacter(HANDLE hConsoleOutput, Byte cCharacter,
int nLength, COORD dwWriteCoord, ref int
lpNumberOfCharsWritten);
[DllImport("kernel32")] public static
extern int FindClose(HANDLE hFindFile);
[DllImport("kernel32")]
public static extern int FindCloseChangeNotification(HANDLE
hChangeHandle);
[DllImport("kernel32")] public static extern int
FindFirstChangeNotification(string lpPathName, int bWatchSubtree, int
dwNotifyFilter);
[DllImport("kernel32")] public static extern int
FindFirstFile(string lpFileName, WIN32_FIND_DATA
lpFindFileData);
[DllImport("kernel32")] public static extern int
FindNextChangeNotification(HANDLE
hChangeHandle);
[DllImport("kernel32")] public static extern int
FindNextFile(HANDLE hFindFile, WIN32_FIND_DATA
lpFindFileData);
[DllImport("kernel32")] public static extern int
FindResource(HANDLE hInstance, string lpName, string
lpType);
[DllImport("kernel32")] public static extern int
FindResourceEx(HANDLE hModule, string lpType, string lpName, int
wLanguage);
[DllImport("kernel32")] public static extern int
FlushConsoleInputBuffer(HANDLE
hConsoleInput);
[DllImport("kernel32")] public static extern int
FlushFileBuffers(HANDLE hFile);
[DllImport("kernel32")] public
static extern int FlushInstructionCache(HANDLE hProcess, IntPtr lpBaseAddress,
int dwSize);
[DllImport("kernel32")] public static extern int
FlushViewOfFile(IntPtr lpBaseAddress, int
dwNumberOfBytesToFlush);
[DllImport("kernel32")] public static
extern int FoldString(int dwMapFlags, string lpSrcStr, int cchSrc, string
lpDestStr, int cchDest);
[DllImport("kernel32")] public static
extern int FormatMessage(int dwFlags, IntPtr lpSource, int dwMessageId, int
dwLanguageId, string lpBuffer, int nSize, int
Arguments);
[DllImport("kernel32")] public static extern int
FreeConsole();
[DllImport("kernel32")] public static extern int
FreeEnvironmentStrings(string lpsz);
[DllImport("kernel32")]
public static extern int FreeLibrary(HANDLE
hLibModule);
[DllImport("kernel32")] public static extern int
FreeResource(HANDLE hResData);
[DllImport("kernel32")] public
static extern int GenerateConsoleCtrlEvent(int dwCtrlEvent, int
dwProcessGroupId);
[DllImport("kernel32")] public static extern
int GetACP();
[DllImport("kernel32")] public static extern int
GetBinaryType(string lpApplicationName, ref int
lpBinaryType);
[DllImport("kernel32")] public static extern int
GetCPInfo(int CodePage, ref CPINFO
lpCPInfo);
[DllImport("kernel32")] public static extern int
GetCommConfig(HANDLE hCommDev, ref COMMCONFIG lpCC, ref int
lpdwSize);
[DllImport("kernel32")] public static extern int
GetCommMask(HANDLE hFile, ref int
lpEvtMask);
[DllImport("kernel32")] public static extern int
GetCommModemStatus(HANDLE hFile, ref int
lpModemStat);
[DllImport("kernel32")] public static extern int
GetCommProperties(HANDLE hFile, ref COMMPROP
lpCommProp);
[DllImport("kernel32")] public static extern int
GetCommState(int nCid, ref DCB lpDCB);
[DllImport("kernel32")]
public static extern int GetCommTimeouts(HANDLE hFile, ref COMMTIMEOUTS
lpCommTimeouts);
[DllImport("kernel32")] public static extern int
GetCommandLine();
[DllImport("kernel32")] public static extern
int GetCompressedFileSize(string lpFileName, ref int
lpFileSizeHigh);
[DllImport("kernel32")] public static extern int
GetComputerName(string lpBuffer, int
nSize);
[DllImport("kernel32")] public static extern int
GetConsoleCP();
[DllImport("kernel32")] public static extern int
GetConsoleCursorInfo(HANDLE hConsoleOutput, ref CONSOLE_CURSOR_INFO
lpConsoleCursorInfo);
[DllImport("kernel32")] public static
extern int GetConsoleMode(HANDLE hConsoleHandle, ref int
lpMode);
[DllImport("kernel32")] public static extern int
GetConsoleOutputCP();
[DllImport("kernel32")] public static
extern int GetConsoleScreenBufferInfo(HANDLE hConsoleOutput, ref
CONSOLE_SCREEN_BUFFER_INFO
lpConsoleScreenBufferInfo);
[DllImport("kernel32")] public static
extern int GetConsoleTitle(string lpConsoleTitle, int
nSize);
[DllImport("kernel32")] public static extern int
GetCurrencyFormat(int Locale, int dwFlags, string lpValue, ref CURRENCYFMT
lpFormat, string lpCurrencyStr, int
cchCurrency);
[DllImport("kernel32")] public static extern int
GetCurrentDirectory(int nBufferLength, string
lpBuffer);
[DllImport("kernel32")] public static extern int
GetCurrentProcess();
[DllImport("kernel32")] public static extern
int GetCurrentProcessId();
[DllImport("kernel32")] public static
extern int GetCurrentThread();
[DllImport("kernel32")] public
static extern int GetCurrentThreadId();
[DllImport("kernel32")]
public static extern int
GetCurrentTime();
[DllImport("kernel32")] public static extern
int GetDateFormat(int Locale, int dwFlags, ref SYSTEMTIME lpDate, string
lpFormat, string lpDateStr, int cchDate);
[DllImport("kernel32")]
public static extern int GetDefaultCommConfig(string lpszName, ref COMMCONFIG
lpCC, ref int lpdwSize);
[DllImport("kernel32")] public static
extern int GetDiskFreeSpace(string lpRootPathName, ref int lpSectorsPerCluster,
ref int lpBytesPerSector, ref int lpNumberOfFreeClusters, ref int
lpTotalNumberOfClusters);
  [DllImport("kernel32")] public static extern int
GetDiskFreeSpaceEx(string lpDirectoryName,out ulong lpFreeBytesAvailable,out
ulong lpTotalNumberOfBytes,out ulong
lpTotalNumberOfFreeBytes);
[DllImport("kernel32")] public static
extern int GetDriveType(string nDrive);
[DllImport("kernel32")]
public static extern int GetEnvironmentVariable(string lpName, string lpBuffer,
int nSize);
[DllImport("kernel32")] public static extern int
GetExitCodeProcess(HANDLE hProcess, ref int
lpExitCode);
[DllImport("kernel32")] public static extern int
GetExitCodeThread(HANDLE hThread, ref int
lpExitCode);
[DllImport("kernel32")] public static extern int
GetFileAttributes(string lpFileName);
[DllImport("kernel32")]
public static extern int GetFileInformationByHandle(HANDLE hFile, ref
BY_HANDLE_FILE_INFORMATION
lpFileInformation);
[DllImport("kernel32")] public static extern
int GetFileSize(HANDLE hFile, ref int
lpFileSizeHigh);
[DllImport("kernel32")] public static extern int
GetFileTime(HANDLE hFile, ref FILETIME lpCreationTime, ref FILETIME
lpLastAccessTime, ref FILETIME
lpLastWriteTime);
[DllImport("kernel32")] public static extern
int GetFileType(HANDLE hFile);
[DllImport("kernel32")] public
static extern int GetFullPathName(string lpFileName, int nBufferLength,
StringBuilder lpBuffer, string
lpFilePart);
[DllImport("kernel32")] public static extern int
GetHandleInformation(HANDLE hObject, ref int
lpdwFlags);
[DllImport("kernel32")] public static extern int
GetLastError();
[DllImport("kernel32")] public static extern int
GetLocaleInfo(int Locale, int LCType, string lpLCData, int
cchData);
[DllImport("kernel32")] public static extern int
GetLogicalDriveStrings(int nBufferLength, StringBuilder
lpBuffer);
[DllImport("kernel32")] public static extern int
GetLogicalDrives();
[DllImport("kernel32")] public static extern
int GetMailslotInfo(HANDLE hMailslot, ref int lpMaxMessageSize, ref int
lpNextSize, ref int lpMessageCount, ref int
lpReadTimeout);
[DllImport("kernel32")] public static extern int
GetModuleFileName(HANDLE hModule, StringBuilder lpFileName, int
nSize);
[DllImport("kernel32")] public static extern int
GetModuleHandle(string lpModuleName);
[DllImport("kernel32")]
public static extern int GetNamedPipeHandleState(HANDLE hNamedPipe, ref int
lpState, ref int lpCurInstances, ref int lpMaxCollectionCount, ref int
lpCollectDataTimeout, string lpUserName, int
nMaxUserNameSize);
[DllImport("kernel32")] public static extern
int GetNamedPipeInfo(HANDLE hNamedPipe, ref int lpFlags, ref int
lpOutBufferSize, ref int lpInBufferSize, ref int
lpMaxInstances);
[DllImport("kernel32")] public static extern int
GetNumberFormat(int Locale, int dwFlags, string lpValue, ref NUMBERFMT lpFormat,
string lpNumberStr, int cchNumber);
[DllImport("kernel32")]
public static extern int GetNumberOfConsoleInputEvents(HANDLE hConsoleInput, ref
int lpNumberOfEvents);
[DllImport("kernel32")] public static
extern int GetNumberOfConsoleMouseButtons(int
lpNumberOfMouseButtons);
[DllImport("kernel32")] public static
extern int GetOEMCP();
[DllImport("kernel32")] public static
extern int GetOverlappedResult(HANDLE hFile, ref OVERLAPPED lpOverlapped, ref
int lpNumberOfBytesTransferred, int
bWait);
[DllImport("kernel32")] public static extern int
GetPriorityClass(HANDLE hProcess);
[DllImport("kernel32")] public
static extern int GetPrivateProfileInt(string lpApplicationName, string
lpKeyName, int nDefault, string
lpFileName);
[DllImport("kernel32")] public static extern int
GetPrivateProfileSection(string lpAppName, StringBuilder lpReturnedString, int
nSize, string lpFileName);
[DllImport("kernel32")] public static
extern int GetPrivateProfileString(string lpApplicationName, IntPtr lpKeyName,
string lpDefault, StringBuilder lpReturnedString, int nSize, string
lpFileName);
[DllImport("kernel32")] public static extern int
GetPrivateProfileString(string lpApplicationName, string lpKeyName, string
lpDefault, StringBuilder lpReturnedString, int nSize, string
lpFileName);
[DllImport("kernel32")] public static extern int
GetProcessAffinityMask(HANDLE hProcess, ref int lpProcessAffinityMask, int
SystemAffinityMask);
[DllImport("kernel32")] public static extern
int GetProcessHeap();
[DllImport("kernel32")] public static
extern int GetProcessHeaps(int NumberOfHeaps, int
ProcessHeaps);
[DllImport("kernel32")] public static extern int
GetProcessShutdownParameters(int lpdwLevel, ref int
lpdwFlags);
[DllImport("kernel32")] public static extern int
GetProcessTimes(HANDLE hProcess, ref FILETIME lpCreationTime, ref FILETIME
lpExitTime, ref FILETIME lpKernelTime, ref FILETIME
lpUserTime);
[DllImport("kernel32")] public static extern int
GetProcessWorkingSetSize(HANDLE hProcess, ref int lpMinimumWorkingSetSize, ref
int lpMaximumWorkingSetSize);
[DllImport("kernel32")] public
static extern int GetProfileInt(string lpAppName, string lpKeyName, int
nDefault);
[DllImport("kernel32")] public static extern int
GetProfileSection(string lpAppName, string lpReturnedString, int
nSize);
[DllImport("kernel32")] public static extern int
GetProfileString(string lpAppName, string lpKeyName, string lpDefault,
StringBuilder lpReturnedString, int
nSize);
[DllImport("kernel32")] public static extern int
GetQueuedCompletionStatus(int CompletionPort, ref int
lpNumberOfBytesTransferred, ref int lpCompletionKey, ref int lpOverlapped, int
dwMilliseconds);
[DllImport("kernel32")] public static extern int
GetShortPathName(string lpszLongPath, string lpszShortPath, int
cchBuffer);
[DllImport("kernel32")] public static extern int
GetStdHandle(int nStdHandle);
[DllImport("kernel32")] public
static extern int GetStringTypeA(int lcid, int dwInfoType, string lpSrcStr, int
cchSrc, ref int lpCharType);
[DllImport("kernel32")] public
static extern int GetStringTypeEx(int Locale, int dwInfoType, string lpSrcStr,
int cchSrc, short lpCharType);
[DllImport("kernel32")] public
static extern int GetStringTypeW(int dwInfoType, string lpSrcStr, int cchSrc,
short lpCharType);
[DllImport("kernel32")] public static extern
int GetSystemDefaultLCID();
[DllImport("kernel32")] public static
extern int GetSystemDirectory(StringBuilder lpBuffer, int
nSize);
[DllImport("kernel32")] public static extern int
GetSystemPowerStatus(ref SYSTEM_POWER_STATUS
lpSystemPowerStatus);
[DllImport("kernel32")] public static
extern int GetSystemTimeAdjustment(int lpTimeAdjustment, ref int
lpTimeIncrement, ref int
lpTimeAdjustmentDisabled);
[DllImport("kernel32")] public static
extern int GetTapeParameters(HANDLE hDevice, int dwOperation, ref int lpdwSize,
IntPtr lpTapeInformation);
[DllImport("kernel32")] public static
extern int GetTapePosition(HANDLE hDevice, int dwPositionType, ref int
lpdwPartition, ref int lpdwOffsetLow, ref int
lpdwOffsetHigh);
[DllImport("kernel32")] public static extern int
GetTapeStatus(HANDLE hDevice);
[DllImport("kernel32")] public
static extern int GetTempFileName(string lpszPath, string lpPrefixString, int
wUnique, StringBuilder lpTempFileName);
[DllImport("kernel32")]
public static extern int GetTempPath(int nBufferLength, StringBuilder
lpBuffer);
[DllImport("kernel32")] public static extern int
GetThreadContext(HANDLE hThread, ref CONTEXT
lpContext);
[DllImport("kernel32")] public static extern int
GetThreadPriority(HANDLE hThread);
[DllImport("kernel32")] public
static extern int GetThreadSelectorEntry(HANDLE hThread, int dwSelector, ref
LDT_ENTRY lpSelectorEntry);
[DllImport("kernel32")] public static
extern int GetThreadTimes(HANDLE hThread, ref FILETIME lpCreationTime, ref
FILETIME lpExitTime, ref FILETIME lpKernelTime, ref FILETIME
lpUserTime);
[DllImport("kernel32")] public static extern int
GetTickCount();
[DllImport("kernel32")] public static extern int
GetTimeFormat(int Locale, int dwFlags, ref SYSTEMTIME lpTime, string lpFormat,
string lpTimeStr, int cchTime);
[DllImport("kernel32")] public
static extern int GetTimeZoneInformation(ref TIME_ZONE_INFORMATION
lpTimeZoneInformation);
[DllImport("kernel32")] public static
extern int GetUserDefaultLCID();
[DllImport("kernel32")] public
static extern int GetVersion();
[DllImport("kernel32")] public
static extern int GetVersionEx(ref OSVERSIONINFO
lpVersionInformation);
[DllImport("kernel32")] public static
extern int GetVolumeInformation(string lpRootPathName, string
lpVolumeNameBuffer, int nVolumeNameSize, ref int lpVolumeSerialNumber, ref int
lpMaximumComponentLength, ref int lpFileSystemFlags, string
lpFileSystemNameBuffer, int
nFileSystemNameSize);
[DllImport("kernel32")] public static
extern int GetWindowsDirectory(StringBuilder lpBuffer, int
nSize);
[DllImport("kernel32")] public static extern int
GlobalAlloc(int wFlags, int dwBytes);
[DllImport("kernel32")]
public static extern int GlobalCompact(int
dwMinFree);
[DllImport("kernel32")] public static extern int
GlobalFlags(HANDLE hMem);
[DllImport("kernel32")] public static
extern int GlobalFree(HANDLE hMem);
[DllImport("kernel32")]
public static extern int GlobalGetAtomName(short nAtom, string lpBuffer, int
nSize);
[DllImport("kernel32")] public static extern int
GlobalHandle(IntPtr wMem);
[DllImport("kernel32")] public static
extern int GlobalLock(HANDLE hMem);
[DllImport("kernel32")]
public static extern int GlobalReAlloc(HANDLE hMem, int dwBytes, int
wFlags);
[DllImport("kernel32")] public static extern int
GlobalSize(HANDLE hMem);
[DllImport("kernel32")] public static
extern int GlobalUnWire(HANDLE hMem);
[DllImport("kernel32")]
public static extern int GlobalUnlock(HANDLE
hMem);
[DllImport("kernel32")] public static extern int
GlobalWire(HANDLE hMem);
[DllImport("kernel32")] public static
extern int HeapAlloc(HANDLE hHeap, int dwFlags, int
dwBytes);
[DllImport("kernel32")] public static extern int
HeapCompact(HANDLE hHeap, int dwFlags);
[DllImport("kernel32")]
public static extern int HeapCreate(int flOptions, int dwInitialSize, int
dwMaximumSize);
[DllImport("kernel32")] public static extern int
HeapDestroy(HANDLE hHeap);
[DllImport("kernel32")] public static
extern int HeapFree(HANDLE hHeap, int dwFlags, IntPtr
lpMem);
[DllImport("kernel32")] public static extern int
HeapLock(HANDLE hHeap);
[DllImport("kernel32")] public static
extern int HeapReAlloc(HANDLE hHeap, int dwFlags, IntPtr lpMem, int
dwBytes);
[DllImport("kernel32")] public static extern int
HeapSize(HANDLE hHeap, int dwFlags, IntPtr
lpMem);
[DllImport("kernel32")] public static extern int
HeapUnlock(HANDLE hHeap);
[DllImport("kernel32")] public static
extern int HeapValidate(HANDLE hHeap, int dwFlags, IntPtr
lpMem);
[DllImport("kernel32")] public static extern int
InitAtomTable(int nSize);
[DllImport("kernel32")] public static
extern int InterlockedDecrement(int
lpAddend);
[DllImport("kernel32")] public static extern int
InterlockedExchange(int Target, int
Value);
[DllImport("kernel32")] public static extern int
InterlockedIncrement(int lpAddend);
[DllImport("kernel32")]
public static extern int IsBadCodePtr(int
lpfn);
[DllImport("kernel32")] public static extern int
IsBadHugeReadPtr(IntPtr lp, int ucb);
[DllImport("kernel32")]
public static extern int IsBadHugeWritePtr(IntPtr lp, int
ucb);
[DllImport("kernel32")] public static extern int
IsBadReadPtr(IntPtr lp, int ucb);
[DllImport("kernel32")] public
static extern int IsBadStringPtr(string lpsz, int
ucchMax);
[DllImport("kernel32")] public static extern int
IsBadWritePtr(IntPtr lp, int ucb);
[DllImport("kernel32")] public
static extern int IsDBCSLeadByte(Byte
bTestChar);
[DllImport("kernel32")] public static extern int
IsValidCodePage(int CodePage);
[DllImport("kernel32")] public
static extern int LCMapString(int Locale, int dwMapFlags, string lpSrcStr, int
cchSrc, string lpDestStr, int cchDest);
[DllImport("kernel32")]
public static extern int LoadLibrary(string
lpLibFileName);
[DllImport("kernel32")] public static extern int
LoadLibraryEx(string lpLibFileName, HANDLE hFile, int
dwFlags);
[DllImport("kernel32")] public static extern int
LoadModule(string lpModuleName, IntPtr
lpParameterBlock);
[DllImport("kernel32")] public static extern
int LoadResource(HANDLE hInstance, HANDLE
hResInfo);
[DllImport("kernel32")] public static extern int
LocalAlloc(int wFlags, int wBytes);
[DllImport("kernel32")]
public static extern int LocalCompact(int
uMinFree);
[DllImport("kernel32")] public static extern int
LocalFileTimeToFileTime(ref FILETIME lpLocalFileTime, ref FILETIME
lpFileTime);
[DllImport("kernel32")] public static extern int
LocalFlags(HANDLE hMem);
[DllImport("kernel32")] public static
extern int LocalFree(HANDLE hMem);
[DllImport("kernel32")] public
static extern int LocalHandle(HANDLE
hMem);
[DllImport("kernel32")] public static extern int
LocalLock(HANDLE hMem);
[DllImport("kernel32")] public static
extern int LocalReAlloc(HANDLE hMem, int wBytes, int
wFlags);
[DllImport("kernel32")] public static extern int
LocalShrink(HANDLE hMem, int cbNewSize);
[DllImport("kernel32")]
public static extern int LocalSize(HANDLE
hMem);
[DllImport("kernel32")] public static extern int
LocalUnlock(HANDLE hMem);
[DllImport("kernel32")] public static
extern int LockFile(HANDLE hFile, int dwFileOffsetLow, int dwFileOffsetHigh, int
nNumberOfBytesToLockLow, int
nNumberOfBytesToLockHigh);
[DllImport("kernel32")] public static
extern int LockFileEx(HANDLE hFile, int dwFlags, int dwReserved, int
nNumberOfBytesToLockLow, int nNumberOfBytesToLockHigh, ref OVERLAPPED
lpOverlapped);
[DllImport("kernel32")] public static extern int
LockResource(HANDLE hResData);
[DllImport("kernel32")] public
static extern int MapViewOfFile(HANDLE hFileMappingObject, int dwDesiredAccess,
int dwFileOffsetHigh, int dwFileOffsetLow, int
dwNumberOfBytesToMap);
[DllImport("kernel32")] public static
extern int MapViewOfFileEx(HANDLE hFileMappingObject, int dwDesiredAccess, int
dwFileOffsetHigh, int dwFileOffsetLow, int dwNumberOfBytesToMap, IntPtr
lpBaseAddress);
[DllImport("kernel32")] public static extern int
MoveFile(string lpExistingFileName, string
lpNewFileName);
[DllImport("kernel32")] public static extern int
MoveFileEx(string lpExistingFileName, string lpNewFileName, int
dwFlags);
[DllImport("kernel32")] public static extern int
MulDiv(int nNumber, int nNumerator, int
nDenominator);
[DllImport("kernel32")] public static extern int
MultiByteToWideChar(int CodePage, int dwFlags, string lpMultiByteStr, int
cchMultiByte, string lpWideCharStr, int
cchWideChar);
[DllImport("kernel32")] public static extern int
OpenEvent(int dwDesiredAccess, int bInheritHandle, string
lpName);
[DllImport("kernel32")] public static extern int
OpenFile(string lpFileName, ref OFSTRUCT lpReOpenBuff, int
wStyle);
[DllImport("kernel32")] public static extern int
OpenFileMapping(int dwDesiredAccess, int bInheritHandle, string
lpName);
[DllImport("kernel32")] public static extern int
OpenMutex(int dwDesiredAccess, int bInheritHandle, string
lpName);
[DllImport("kernel32")] public static extern int
OpenProcess(int dwDesiredAccess, int bInheritHandle, int
dwProcessId);
[DllImport("kernel32")] public static extern int
OpenSemaphore(int dwDesiredAccess, int bInheritHandle, string
lpName);
[DllImport("kernel32")] public static extern int
PeekNamedPipe(HANDLE hNamedPipe, IntPtr lpBuffer, int nBufferSize, ref int
lpBytesRead, ref int lpTotalBytesAvail, ref int
lpBytesLeftThisMessage);
[DllImport("kernel32")] public static
extern int PrepareTape(HANDLE hDevice, int dwOperation, int
bimmediate);
[DllImport("kernel32")] public static extern int
PulseEvent(HANDLE hEvent);
[DllImport("kernel32")] public static
extern int PurgeComm(HANDLE hFile, int
dwFlags);
[DllImport("kernel32")] public static extern int
QueryDosDevice(string lpDeviceName, string lpTargetPath, int
ucchMax);
[DllImport("kernel32")] public static extern int
QueryPerformanceCounter(ref LARGE_INTEGER
lpPerformanceCount);
[DllImport("kernel32")] public static extern
int QueryPerformanceFrequency(ref LARGE_INTEGER
lpFrequency);
[DllImport("kernel32")] public static extern int
ReadConsole(HANDLE hConsoleInput, IntPtr lpBuffer, int nNumberOfCharsToRead, ref
int lpNumberOfCharsRead, IntPtr
lpReserved);
[DllImport("kernel32")] public static extern int
ReadConsoleOutput(HANDLE hConsoleOutput, ref CHAR_INFO lpBuffer, COORD
dwBufferSize, COORD dwBufferCoord, ref SMALL_RECT
lpReadRegion);
[DllImport("kernel32")] public static extern int
ReadConsoleOutputAttribute(HANDLE hConsoleOutput, ref int lpAttribute, int
nLength, COORD dwReadCoord, ref int
lpNumberOfAttrsRead);
[DllImport("kernel32")] public static
extern int ReadConsoleOutputCharacter(HANDLE hConsoleOutput, string lpCharacter,
int nLength, COORD dwReadCoord, ref int
lpNumberOfCharsRead);
[DllImport("kernel32")] public static
extern int ReadFile(HANDLE hFile, IntPtr lpBuffer, int nNumberOfBytesToRead, ref
int lpNumberOfBytesRead, ref OVERLAPPED
lpOverlapped);
[DllImport("kernel32")] public static extern int
ReadFileEx(HANDLE hFile, IntPtr lpBuffer, int nNumberOfBytesToRead, ref
OVERLAPPED lpOverlapped, ref int
lpCompletionRoutine);
[DllImport("kernel32")] public static
extern int ReadProcessMemory(HANDLE hProcess, IntPtr lpBaseAddress, IntPtr
lpBuffer, int nSize, ref int
lpNumberOfBytesWritten);
[DllImport("kernel32")] public static
extern int ReleaseMutex(HANDLE hMutex);
[DllImport("kernel32")]
public static extern int ReleaseSemaphore(HANDLE hSemaphore, int lReleaseCount,
ref int lpPreviousCount);
[DllImport("kernel32")] public static
extern int RemoveDirectory(string
lpPathName);
[DllImport("kernel32")] public static extern int
ResetEvent(HANDLE hEvent);
[DllImport("kernel32")] public static
extern int ResumeThread(HANDLE hThread);
[DllImport("kernel32")]
public static extern int ScrollConsoleScreenBuffer(HANDLE hConsoleOutput, ref
SMALL_RECT lpScrollRectangle, ref SMALL_RECT lpClipRectangle, COORD
dwDestinationOrigin, ref CHAR_INFO
lpFill);
[DllImport("kernel32")] public static extern int
SearchPath(string lpPath, string lpFileName, string lpExtension, int
nBufferLength, string lpBuffer, string
lpFilePart);
[DllImport("kernel32")] public static extern int
SetCommBreak(int nCid);
[DllImport("kernel32")] public static
extern int SetCommConfig(HANDLE hCommDev, ref COMMCONFIG lpCC, int
dwSize);
[DllImport("kernel32")] public static extern int
SetCommMask(HANDLE hFile, int dwEvtMask);
[DllImport("kernel32")]
public static extern int SetCommState(HANDLE hCommDev, ref DCB
lpDCB);
[DllImport("kernel32")] public static extern int
SetCommTimeouts(HANDLE hFile, ref COMMTIMEOUTS
lpCommTimeouts);
[DllImport("kernel32")] public static extern int
SetComputerName(string lpComputerName);
[DllImport("kernel32")]
public static extern int SetConsoleActiveScreenBuffer(HANDLE
hConsoleOutput);
[DllImport("kernel32")] public static extern int
SetConsoleCP(int wCodePageID);
[DllImport("kernel32")] public
static extern int SetConsoleCtrlHandler(int HandlerRoutine, int
Add);
[DllImport("kernel32")] public static extern int
SetConsoleCursorInfo(HANDLE hConsoleOutput, ref CONSOLE_CURSOR_INFO
lpConsoleCursorInfo);
[DllImport("kernel32")] public static
extern int SetConsoleCursorPosition(HANDLE hConsoleOutput, COORD
dwCursorPosition);
[DllImport("kernel32")] public static extern
int SetConsoleMode(HANDLE hConsoleHandle, int
dwMode);
[DllImport("kernel32")] public static extern int
SetConsoleOutputCP(int wCodePageID);
[DllImport("kernel32")]
public static extern int SetConsoleScreenBufferSize(HANDLE hConsoleOutput, COORD
dwSize);
[DllImport("kernel32")] public static extern int
SetConsoleTextAttribute(HANDLE hConsoleOutput, int
wAttributes);
[DllImport("kernel32")] public static extern int
SetConsoleTitle(string lpConsoleTitle);
[DllImport("kernel32")]
public static extern int SetConsoleWindowInfo(HANDLE hConsoleOutput, int
bAbsolute, ref SMALL_RECT
lpConsoleWindow);
[DllImport("kernel32")] public static extern
int SetCurrentDirectory(string
lpPathName);
[DllImport("kernel32")] public static extern int
SetDefaultCommConfig(string lpszName, ref COMMCONFIG lpCC, int
dwSize);
[DllImport("kernel32")] public static extern int
SetEndOfFile(HANDLE hFile);
[DllImport("kernel32")] public static
extern int SetEnvironmentVariable(string lpName, string
lpValue);
[DllImport("kernel32")] public static extern int
SetErrorMode(int wMode);
[DllImport("kernel32")] public static
extern int SetEvent(HANDLE hEvent);
[DllImport("kernel32")]
public static extern int SetFileAttributes(string lpFileName, int
dwFileAttributes);
[DllImport("kernel32")] public static extern
int SetFilePointer(HANDLE hFile, int lDistanceToMove, ref int
lpDistanceToMoveHigh, int dwMoveMethod);
[DllImport("kernel32")]
public static extern int SetFileTime(HANDLE hFile, ref FILETIME lpCreationTime,
ref FILETIME lpLastAccessTime, ref FILETIME
lpLastWriteTime);
[DllImport("kernel32")] public static extern
int SetHandleCount(int wNumber);
[DllImport("kernel32")] public
static extern int SetHandleInformation(HANDLE hObject, int dwMask, int
dwFlags);
[DllImport("kernel32")] public static extern int
SetLocalTime(ref SYSTEMTIME
lpSystemTime);
[DllImport("kernel32")] public static extern int
SetLocaleInfo(int Locale, int LCType, string
lpLCData);
[DllImport("kernel32")] public static extern int
SetMailslotInfo(HANDLE hMailslot, int
lReadTimeout);
[DllImport("kernel32")] public static extern int
SetNamedPipeHandleState(HANDLE hNamedPipe, ref int lpMode, ref int
lpMaxCollectionCount, ref int
lpCollectDataTimeout);
[DllImport("kernel32")] public static
extern int SetPriorityClass(HANDLE hProcess, int
dwPriorityClass);
[DllImport("kernel32")] public static extern
int SetProcessShutdownParameters(int dwLevel, int
dwFlags);
[DllImport("kernel32")] public static extern int
SetProcessWorkingSetSize(HANDLE hProcess, int dwMinimumWorkingSetSize, int
dwMaximumWorkingSetSize);
[DllImport("kernel32")] public static
extern int SetStdHandle(int nStdHandle, int
nHandle);
[DllImport("kernel32")] public static extern int
SetSystemPowerState(int fSuspend, int
fForce);
[DllImport("kernel32")] public static extern int
SetSystemTime(ref SYSTEMTIME
lpSystemTime);
[DllImport("kernel32")] public static extern int
SetTapeParameters(HANDLE hDevice, int dwOperation, IntPtr
lpTapeInformation);
[DllImport("kernel32")] public static extern
int SetTapePosition(HANDLE hDevice, int dwPositionMethod, int dwPartition, int
dwOffsetLow, int dwOffsetHigh, int
bimmediate);
[DllImport("kernel32")] public static extern int
SetThreadAffinityMask(HANDLE hThread, int
dwThreadAffinityMask);
[DllImport("kernel32")] public static
extern int SetThreadContext(HANDLE hThread, ref CONTEXT
lpContext);
[DllImport("kernel32")] public static extern int
SetThreadLocale(int Locale);
[DllImport("kernel32")] public
static extern int SetThreadPriority(HANDLE hThread, int
nPriority);
[DllImport("kernel32")] public static extern int
SetTimeZoneInformation(ref TIME_ZONE_INFORMATION
lpTimeZoneInformation);
[DllImport("kernel32")] public static
extern int SetUnhandledExceptionFilter(int
lpTopLevelExceptionFilter);
[DllImport("kernel32")] public static
extern int SetVolumeLabel(string lpRootPathName, string
lpVolumeName);
[DllImport("kernel32")] public static extern int
SetupComm(HANDLE hFile, int dwInQueue, int
dwOutQueue);
[DllImport("kernel32")] public static extern int
SizeofResource(HANDLE hInstance, HANDLE
hResInfo);
[DllImport("kernel32")] public static extern int
SleepEx(int dwMilliseconds, int
bAlertable);
[DllImport("kernel32")] public static extern int
SuspendThread(HANDLE hThread);
[DllImport("kernel32")] public
static extern int SystemTimeToFileTime(ref SYSTEMTIME lpSystemTime, ref FILETIME
lpFileTime);
[DllImport("kernel32")] public static extern int
SystemTimeToTzSpecificLocalTime(ref TIME_ZONE_INFORMATION lpTimeZoneInformation,
ref SYSTEMTIME lpUniversalTime, ref SYSTEMTIME
lpLocalTime);
[DllImport("kernel32")] public static extern int
TerminateProcess(HANDLE hProcess, int
uExitCode);
[DllImport("kernel32")] public static extern int
TerminateThread(HANDLE hThread, int
dwExitCode);
[DllImport("kernel32")] public static extern int
TlsAlloc();
[DllImport("kernel32")] public static extern int
TlsFree(int dwTlsIndex);
[DllImport("kernel32")] public static
extern int TlsGetValue(int dwTlsIndex);
[DllImport("kernel32")]
public static extern int TlsSetValue(int dwTlsIndex, IntPtr
lpTlsValue);
[DllImport("kernel32")] public static extern int
TransactNamedPipe(HANDLE hNamedPipe, IntPtr lpInBuffer, int nInBufferSize,
IntPtr lpOutBuffer, int nOutBufferSize, ref int lpBytesRead, ref OVERLAPPED
lpOverlapped);
[DllImport("kernel32")] public static extern int
TransmitCommChar(int nCid, Byte cChar);
[DllImport("kernel32")]
public static extern int UnhandledExceptionFilter(ref EXCEPTION_POINTERS
ExceptionInfo);
[DllImport("kernel32")] public static extern int
UnlockFile(HANDLE hFile, int dwFileOffsetLow, int dwFileOffsetHigh, int
nNumberOfBytesToUnlockLow, int
nNumberOfBytesToUnlockHigh);
[DllImport("kernel32")] public
static extern int UnlockFileEx(HANDLE hFile, int dwReserved, int
nNumberOfBytesToUnlockLow, int nNumberOfBytesToUnlockHigh, ref OVERLAPPED
lpOverlapped);
[DllImport("kernel32")] public static extern int
UnmapViewOfFile(IntPtr lpBaseAddress);
[DllImport("kernel32")]
public static extern int UpdateResource(HANDLE hUpdate, string lpType, string
lpName, int wLanguage, IntPtr lpData, int
cbData);
[DllImport("kernel32")] public static extern int
VerLanguageName(int wLang, string szLang, int
nSize);
[DllImport("kernel32")] public static extern int
VirtualAlloc(IntPtr lpAddress, int dwSize, int flAllocationType, int
flProtect);
[DllImport("kernel32")] public static extern int
VirtualFree(IntPtr lpAddress, int dwSize, int
dwFreeType);
[DllImport("kernel32")] public static extern int
VirtualLock(IntPtr lpAddress, int
dwSize);
[DllImport("kernel32")] public static extern int
VirtualProtect(IntPtr lpAddress, int dwSize, int flNewProtect, ref int
lpflOldProtect);
[DllImport("kernel32")] public static extern int
VirtualProtectEx(HANDLE hProcess, IntPtr lpAddress, int dwSize, int
flNewProtect, ref int lpflOldProtect);
[DllImport("kernel32")]
public static extern int VirtualQuery(IntPtr lpAddress, ref
MEMORY_BASIC_INFORMATION lpBuffer, int
dwLength);
[DllImport("kernel32")] public static extern int
VirtualQueryEx(HANDLE hProcess, IntPtr lpAddress, ref MEMORY_BASIC_INFORMATION
lpBuffer, int dwLength);
[DllImport("kernel32")] public static
extern int VirtualUnlock(IntPtr lpAddress, int
dwSize);
[DllImport("kernel32")] public static extern int
WaitCommEvent(HANDLE hFile, ref int lpEvtMask, ref OVERLAPPED
lpOverlapped);
[DllImport("kernel32")] public static extern int
WaitForMultipleObjects(int nCount, ref int lpHandles, int bWaitAll, int
dwMilliseconds);
[DllImport("kernel32")] public static extern int
WaitForMultipleObjectsEx(int nCount, ref int lpHandles, int bWaitAll, int
dwMilliseconds, int bAlertable);
[DllImport("kernel32")] public
static extern int WaitForSingleObject(HANDLE hHandle, int
dwMilliseconds);
[DllImport("kernel32")] public static extern int
WaitForSingleObjectEx(HANDLE hHandle, int dwMilliseconds, int
bAlertable);
[DllImport("kernel32")] public static extern int
WaitNamedPipe(string lpNamedPipeName, int
nTimeOut);
[DllImport("kernel32")] public static extern int
WideCharToMultiByte(int CodePage, int dwFlags, string lpWideCharStr, int
cchWideChar, string lpMultiByteStr, int cchMultiByte, string lpDefaultChar, ref
int lpUsedDefaultChar);
[DllImport("kernel32")] public static
extern int WinExec(string lpCmdLine, int
nCmdShow);
[DllImport("kernel32")] public static extern int
WriteConsole(HANDLE hConsoleOutput, IntPtr lpBuffer, int nNumberOfCharsToWrite,
ref int lpNumberOfCharsWritten, IntPtr
lpReserved);
[DllImport("kernel32")] public static extern int
WriteConsoleOutput(HANDLE hConsoleOutput, ref CHAR_INFO lpBuffer, COORD
dwBufferSize, COORD dwBufferCoord, ref SMALL_RECT
lpWriteRegion);
[DllImport("kernel32")] public static extern int
WriteConsoleOutputAttribute(HANDLE hConsoleOutput, short lpAttribute, int
nLength, COORD dwWriteCoord, ref int
lpNumberOfAttrsWritten);
[DllImport("kernel32")] public static
extern int WriteConsoleOutputCharacter(HANDLE hConsoleOutput, string
lpCharacter, int nLength, COORD dwWriteCoord, ref int
lpNumberOfCharsWritten);
[DllImport("kernel32")] public static
extern int WriteFile(HANDLE hFile, IntPtr lpBuffer, int nNumberOfBytesToWrite,
ref int lpNumberOfBytesWritten, ref OVERLAPPED
lpOverlapped);
[DllImport("kernel32")] public static extern int
WriteFileEx(HANDLE hFile, IntPtr lpBuffer, int nNumberOfBytesToWrite, ref
OVERLAPPED lpOverlapped, ref int
lpCompletionRoutine);
[DllImport("kernel32")] public static
extern int WritePrivateProfileSection(string lpAppName, string lpString, string
lpFileName);
[DllImport("kernel32")] public static extern int
WritePrivateProfileString(string lpApplicationName, IntPtr lpKeyName, IntPtr
lpString, string lpFileName);
[DllImport("kernel32")] public
static extern int WritePrivateProfileString(string lpApplicationName, string
lpKeyName, IntPtr lpString, string
lpFileName);
[DllImport("kernel32")] public static extern int
WriteProcessMemory(HANDLE hProcess, IntPtr lpBaseAddress, IntPtr lpBuffer, int
nSize, ref int lpNumberOfBytesWritten);
[DllImport("kernel32")]
public static extern int WriteProfileSection(string lpAppName, string
lpString);
[DllImport("kernel32")] public static extern int
WriteProfileString(string lpszSection, string lpszKeyName, string
lpszString);
[DllImport("kernel32")] public static extern int
WriteTapemark(HANDLE hDevice, int dwTapemarkType, int dwTapemarkCount, int
bimmediate);
[DllImport("kernel32")] public static extern int
hread(HANDLE hFile, IntPtr lpBuffer, int
lBytes);
[DllImport("kernel32")] public static extern int
hwrite(HANDLE hFile, string lpBuffer, int
lBytes);
[DllImport("kernel32")] public static extern int
lclose(HANDLE hFile);
[DllImport("kernel32")] public static
extern int lcreat(string lpPathName, int
iAttribute);
[DllImport("kernel32")] public static extern int
llseek(HANDLE hFile, int lOffset, int
iOrigin);
[DllImport("kernel32")] public static extern int
lopen(string lpPathName, int iReadWrite);
[DllImport("kernel32")]
public static extern int lread(HANDLE hFile, IntPtr lpBuffer, int
wBytes);
[DllImport("kernel32")] public static extern int
lstrcat(string lpString1, string
lpString2);
[DllImport("kernel32")] public static extern int
lstrcmp(string lpString1, string
lpString2);
[DllImport("kernel32")] public static extern int
lstrcmpi(string lpString1, string
lpString2);
[DllImport("kernel32")] public static extern int
lstrcpy(string lpString1, string
lpString2);
[DllImport("kernel32")] public static extern int
lstrcpyn(string lpString1, string lpString2, int
iMaxLength);
[DllImport("kernel32")] public static extern int
lstrlen(string lpString);
[DllImport("kernel32")] public static
extern int lwrite(HANDLE hFile, string lpBuffer, int
wBytes);
[DllImport("kernel32")] public static extern short
GetSystemDefaultLangID();
[DllImport("kernel32")] public static
extern short GetUserDefaultLangID();
[DllImport("kernel32")]
public static extern short GlobalAddAtom(string
lpString);
[DllImport("kernel32")] public static extern short
GlobalDeleteAtom(short nAtom);
[DllImport("kernel32")] public
static extern short GlobalFindAtom(string
lpString);
[DllImport("kernel32")] public static extern string
GetEnvironmentStrings();
[DllImport("kernel32")] public static
extern void CopyMemory(IntPtr Destination, IntPtr Source, int
Length);
[DllImport("kernel32")] public static extern void
DebugBreak();
[DllImport("kernel32")] public static extern void
DeleteCriticalSection(ref CRITICAL_SECTION
lpCriticalSection);
[DllImport("kernel32")] public static extern
void EnterCriticalSection(ref CRITICAL_SECTION
lpCriticalSection);
[DllImport("kernel32")] public static extern
void ExitProcess(int uExitCode);
[DllImport("kernel32")] public
static extern void ExitThread(int
dwExitCode);
[DllImport("kernel32")] public static extern void
FatalAppExit(int uAction, string
lpMessageText);
[DllImport("kernel32")] public static extern void
FatalExit(int code);
[DllImport("kernel32")] public static extern
void FreeLibraryAndExitThread(HANDLE hLibModule, int
dwExitCode);
[DllImport("kernel32")] public static extern void
GetLocalTime(ref SYSTEMTIME
lpSystemTime);
[DllImport("kernel32")] public static extern void
GetStartupInfo(ref STARTUPINFO
lpStartupInfo);
[DllImport("kernel32")] public static extern void
GetSystemInfo(ref SYSTEM_INFO
lpSystemInfo);
[DllImport("kernel32")] public static extern void
GetSystemTime(ref SYSTEMTIME
lpSystemTime);
[DllImport("kernel32")] public static extern void
GlobalFix(HANDLE hMem);
[DllImport("kernel32")] public static
extern void GlobalMemoryStatus(ref MEMORYSTATUS
lpBuffer);
[DllImport("kernel32")] public static extern void
GlobalUnfix(HANDLE hMem);
[DllImport("kernel32")] public static
extern void InitializeCriticalSection(ref CRITICAL_SECTION
lpCriticalSection);
[DllImport("kernel32")] public static extern
void LeaveCriticalSection(ref CRITICAL_SECTION
lpCriticalSection);
[DllImport("kernel32")] public static extern
void RaiseException(int dwExceptionCode, int dwExceptionFlags, int
nNumberOfArguments, ref int lpArguments);
[DllImport("kernel32")]
public static extern void
SetFileApisToANSI();
[DllImport("kernel32")] public static extern
void SetFileApisToOEM();
[DllImport("kernel32")] public static
extern void SetLastError(int dwErrCode);
[DllImport("kernel32")]
public static extern void Sleep(int
dwMilliseconds);
[DllImport("kernel32")] public static extern int
GetComputerNameW(IntPtr lpBuffer, int
nSize);
[DllImport("kernel32")] public static extern int
GetProcAddress(HANDLE hModule, string lpProcName);
public const int ACCESS_ALLOWED_ACE_TYPE = 0x0;
public const int ACCESS_DENIED_ACE_TYPE = 0x1;
public const int ACCESS_SYSTEM_SECURITY = 0x1000000;
public const int ACL_REVISION = (2);
public const int ACL_REVISION1 = (1);
public const int ACL_REVISION2 = (2);
public const int AC_LINE_BACKUP_POWER = 0x2;
public const int AC_LINE_OFFLINE = 0x0;
public const int AC_LINE_ONLINE = 0x1;
public const int AC_LINE_UNKNOWN = 0xFF;
public const int APPLICATION_ERROR_MASK = 0x20000000;
public const int AclRevisionInformation = 1;
public const int AclSizeInformation = 2;
public const int BACKGROUND_BLUE = 0x10;
public const int BACKGROUND_GREEN = 0x20;
public const int BACKGROUND_INTENSITY = 0x80;
public const int BACKGROUND_RED = 0x40;
public const int BACKUP_ALTERNATE_DATA = 0x4;
public const int BACKUP_DATA = 0x1;
public const int BACKUP_EA_DATA = 0x2;
public const int BACKUP_LINK = 0x5;
public const int BACKUP_SECURITY_DATA = 0x3;
public const int BATTERY_FLAG_CHARGING = 0x8;
public const int BATTERY_FLAG_CRITICAL = 0x4;
public const int BATTERY_FLAG_HIGH = 0x1;
public const int BATTERY_FLAG_LOW = 0x2;
public const int BATTERY_FLAG_NO_BATTERY = 0x80;
public const int BATTERY_FLAG_UNKNOWN = 0xFF;
public const int BATTERY_LIFE_UNKNOWN = 0xFFFF;
public const int BATTERY_PERCENTAGE_UNKNOWN = 0xFF;
public const int BAUD_075 = 0x1;
public const int BAUD_110 = 0x2;
public const int BAUD_115200 = 0x20000;
public const int BAUD_1200 = 0x40;
public const int BAUD_128K = 0x10000;
public const int BAUD_134_5 = 0x4;
public const int BAUD_14400 = 0x1000;
public const int BAUD_150 = 0x8;
public const int BAUD_1800 = 0x80;
public const int BAUD_19200 = 0x2000;
public const int BAUD_2400 = 0x100;
public const int BAUD_300 = 0x10;
public const int BAUD_38400 = 0x4000;
public const int BAUD_4800 = 0x200;
public const int BAUD_56K = 0x8000;
public const int BAUD_57600 = 0x40000;
public const int BAUD_600 = 0x20;
public const int BAUD_7200 = 0x400;
public const int BAUD_9600 = 0x800;
public const int BAUD_USER = 0x10000000;
public const int C1_ALPHA = 0x100;
public const int C1_BLANK = 0x40;
public const int C1_CNTRL = 0x20;
public const int C1_DIGIT = 0x4;
public const int C1_LOWER = 0x2;
public const int C1_PUNCT = 0x10;
public const int C1_SPACE = 0x8;
public const int C1_UPPER = 0x1;
public const int C1_XDIGIT = 0x80;
public const int C2_ARABICNUMBER = 0x6;
public const int C2_BLOCKSEPARATOR = 0x8;
public const int C2_COMMONSEPARATOR = 0x7;
public const int C2_EUROPENUMBER = 0x3;
public const int C2_EUROPESEPARATOR = 0x4;
public const int C2_EUROPETERMINATOR = 0x5;
public const int C2_LEFTTORIGHT = 0x1;
public const int C2_NOTAPPLICABLE = 0x0;
public const int C2_OTHERNEUTRAL = 0xB;
public const int C2_RIGHTTOLEFT = 0x2;
public const int C2_SEGMENTSEPARATOR = 0x9;
public const int C2_WHITESPACE = 0xA;
public const int C3_DIACRITIC = 0x2;
public const int C3_NONSPACING = 0x1;
public const int C3_NOTAPPLICABLE = 0x0;
public const int C3_SYMBOL = 0x8;
public const int C3_VOWELMARK = 0x4;
public const int CAL_GREGORIAN = 1;
public const int CAL_GREGORIAN_US = 2;
public const int CAL_ICALINTVALUE = 0x1;
public const int CAL_IYEAROFFSETRANGE = 0x3;
public const int CAL_JAPAN = 3;
public const int CAL_KOREA = 5;
public const int CAL_SABBREVDAYNAME1 = 0xE;
public const int CAL_SABBREVDAYNAME2 = 0xF;
public const int CAL_SABBREVDAYNAME3 = 0x10;
public const int CAL_SABBREVDAYNAME4 = 0x11;
public const int CAL_SABBREVDAYNAME5 = 0x12;
public const int CAL_SABBREVDAYNAME6 = 0x13;
public const int CAL_SABBREVDAYNAME7 = 0x14;
public const int CAL_SABBREVMONTHNAME1 = 0x22;
public const int CAL_SABBREVMONTHNAME10 = 0x2B;
public const int CAL_SABBREVMONTHNAME11 = 0x2C;
public const int CAL_SABBREVMONTHNAME12 = 0x2D;
public const int CAL_SABBREVMONTHNAME13 = 0x2E;
public const int CAL_SABBREVMONTHNAME2 = 0x23;
public const int CAL_SABBREVMONTHNAME3 = 0x24;
public const int CAL_SABBREVMONTHNAME4 = 0x25;
public const int CAL_SABBREVMONTHNAME5 = 0x26;
public const int CAL_SABBREVMONTHNAME6 = 0x27;
public const int CAL_SABBREVMONTHNAME7 = 0x28;
public const int CAL_SABBREVMONTHNAME8 = 0x29;
public const int CAL_SABBREVMONTHNAME9 = 0x2A;
public const int CAL_SCALNAME = 0x2;
public const int CAL_SDAYNAME1 = 0x7;
public const int CAL_SDAYNAME2 = 0x8;
public const int CAL_SDAYNAME3 = 0x9;
public const int CAL_SDAYNAME4 = 0xA;
public const int CAL_SDAYNAME5 = 0xB;
public const int CAL_SDAYNAME6 = 0xC;
public const int CAL_SDAYNAME7 = 0xD;
public const int CAL_SERASTRING = 0x4;
public const int CAL_SLONGDATE = 0x6;
public const int CAL_SMONTHNAME1 = 0x15;
public const int CAL_SMONTHNAME10 = 0x1E;
public const int CAL_SMONTHNAME11 = 0x1F;
public const int CAL_SMONTHNAME12 = 0x20;
public const int CAL_SMONTHNAME13 = 0x21;
public const int CAL_SMONTHNAME2 = 0x16;
public const int CAL_SMONTHNAME3 = 0x17;
public const int CAL_SMONTHNAME4 = 0x18;
public const int CAL_SMONTHNAME5 = 0x19;
public const int CAL_SMONTHNAME6 = 0x1A;
public const int CAL_SMONTHNAME7 = 0x1B;
public const int CAL_SMONTHNAME8 = 0x1C;
public const int CAL_SMONTHNAME9 = 0x1D;
public const int CAL_SSHORTDATE = 0x5;
public const int CAL_TAIWAN = 4;
public const int CAPSLOCK_ON = 0x80;
public const int CBR_110 = 110;
public const int CBR_115200 = 115200;
public const int CBR_1200 = 1200;
public const int CBR_128000 = 128000;
public const int CBR_14400 = 14400;
public const int CBR_19200 = 19200;
public const int CBR_2400 = 2400;
public const int CBR_256000 = 256000;
public const int CBR_300 = 300;
public const int CBR_38400 = 38400;
public const int CBR_4800 = 4800;
public const int CBR_56000 = 56000;
public const int CBR_57600 = 57600;
public const int CBR_600 = 600;
public const int CBR_9600 = 9600;
public const int CE_BREAK = 0x10;
public const int CE_DNS = 0x800;
public const int CE_FRAME = 0x8;
public const int CE_IOE = 0x400;
public const int CE_MODE = 0x8000;
public const int CE_OOP = 0x1000;
public const int CE_OVERRUN = 0x2;
public const int CE_PTO = 0x200;
public const int CE_RXOVER = 0x1;
public const int CE_RXPARITY = 0x4;
public const int CE_TXFULL = 0x100;
public const int CLRBREAK = 9;
public const int CLRDTR = 6;
public const int CLRRTS = 4;
public const int CONSOLE_TEXTMODE_BUFFER = 1;
public const int CONTAINER_INHERIT_ACE = 0x2;
public const int CP_ACP = 0;
public const int CP_OEMCP = 1;
public const int CREATE_ALWAYS = 2;
public const int CREATE_NEW = 1;
public const int CREATE_NEW_CONSOLE = 0x10;
public const int CREATE_NEW_PROCESS_GROUP = 0x200;
public const int CREATE_NO_WINDOW = 0x8000000;
public const int CREATE_PROCESS_DEBUG_EVENT = 3;
public const int CREATE_SUSPENDED = 0x4;
public const int CREATE_THREAD_DEBUG_EVENT = 2;
public const int CTRL_BREAK_EVENT = 1;
public const int CTRL_CLOSE_EVENT = 2;
public const int CTRL_C_EVENT = 0;
public const int CTRL_LOGOFF_EVENT = 5;
public const int CTRL_SHUTDOWN_EVENT = 6;
public const int CTRY_AUSTRALIA = 61;
public const int CTRY_AUSTRIA = 43;
public const int CTRY_BELGIUM = 32;
public const int CTRY_BRAZIL = 55;
public const int CTRY_CANADA = 2;
public const int CTRY_DEFAULT = 0;
public const int CTRY_DENMARK = 45;
public const int CTRY_FINLAND = 358;
public const int CTRY_FRANCE = 33;
public const int CTRY_GERMANY = 49;
public const int CTRY_ICELAND = 354;
public const int CTRY_IRELAND = 353;
public const int CTRY_ITALY = 39;
public const int CTRY_JAPAN = 81;
public const int CTRY_MEXICO = 52;
public const int CTRY_NETHERLANDS = 31;
public const int CTRY_NEW_ZEALAND = 64;
public const int CTRY_NORWAY = 47;
public const int CTRY_PORTUGAL = 351;
public const int CTRY_PRCHINA = 86;
public const int CTRY_SOUTH_KOREA = 82;
public const int CTRY_SPAIN = 34;
public const int CTRY_SWEDEN = 46;
public const int CTRY_SWITZERLAND = 41;
public const int CTRY_TAIWAN = 886;
public const int CTRY_UNITED_KINGDOM = 44;
public const int CTRY_UNITED_STATES = 1;
public const int CT_CTYPE1 = 0x1;
public const int CT_CTYPE2 = 0x2;
public const int CT_CTYPE3 = 0x4;
public const int DATABITS_16 = 0x10;
public const int DATABITS_16X = 0x20;
public const int DATABITS_5 = 0x1;
public const int DATABITS_6 = 0x2;
public const int DATABITS_7 = 0x4;
public const int DATABITS_8 = 0x8;
public const int DATE_LONGDATE = 0x2;
public const int DATE_SHORTDATE = 0x1;
public const int DDD_EXACT_MATCH_ON_REMOVE = 0x4;
public const int DDD_RAW_TARGET_PATH = 0x1;
public const int DDD_REMOVE_DEFINITION = 0x2;
public const int DEBUG_ONLY_THIS_PROCESS = 0x2;
public const int DEBUG_PROCESS = 0x1;
public const int DELETE = 0x10000;
public const int DETACHED_PROCESS = 0x8;
public const int DFCS_ADJUSTRECT = 0x2000;
public const int DFCS_BUTTON3STATE = 0x8;
public const int DFCS_BUTTONCHECK = 0x0;
public const int DFCS_BUTTONPUSH = 0x10;
public const int DFCS_BUTTONRADIO = 0x4;
public const int DFCS_BUTTONRADIOIMAGE = 0x1;
public const int DFCS_BUTTONRADIOMASK = 0x2;
public const int DFCS_CAPTIONCLOSE = 0x0;
public const int DFCS_CAPTIONHELP = 0x4;
public const int DFCS_CAPTIONMAX = 0x2;
public const int DFCS_CAPTIONMIN = 0x1;
public const int DFCS_CAPTIONRESTORE = 0x3;
public const int DFCS_CHECKED = 0x400;
public const int DFCS_FLAT = 0x4000;
public const int DFCS_INACTIVE = 0x100;
public const int DFCS_MENUARROW = 0x0;
public const int DFCS_MENUARROWRIGHT = 0x4;
public const int DFCS_MENUBULLET = 0x2;
public const int DFCS_MENUCHECK = 0x1;
public const int DFCS_MONO = 0x8000;
public const int DFCS_PUSHED = 0x200;
public const int DFCS_SCROLLCOMBOBOX = 0x5;
public const int DFCS_SCROLLDOWN = 0x1;
public const int DFCS_SCROLLLEFT = 0x2;
public const int DFCS_SCROLLRIGHT = 0x3;
public const int DFCS_SCROLLSIZEGRIP = 0x8;
public const int DFCS_SCROLLSIZEGRIPRIGHT = 0x10;
public const int DFCS_SCROLLUP = 0x0;
public const int DFC_BUTTON = 4;
public const int DFC_CAPTION = 1;
public const int DFC_MENU = 2;
public const int DFC_SCROLL = 3;
public const int DOMAIN_ALIAS_RID_ACCOUNT_OPS = 0x224;
public const int DOMAIN_ALIAS_RID_ADMINS = 0x220;
public const int DOMAIN_ALIAS_RID_BACKUP_OPS = 0x227;
public const int DOMAIN_ALIAS_RID_GUESTS = 0x222;
public const int DOMAIN_ALIAS_RID_POWER_USERS = 0x223;
public const int DOMAIN_ALIAS_RID_PRINT_OPS = 0x226;
public const int DOMAIN_ALIAS_RID_REPLICATOR = 0x228;
public const int DOMAIN_ALIAS_RID_SYSTEM_OPS = 0x225;
public const int DOMAIN_ALIAS_RID_USERS = 0x221;
public const int DOMAIN_GROUP_RID_ADMINS = 0x200;
public const int DOMAIN_GROUP_RID_GUESTS = 0x202;
public const int DOMAIN_GROUP_RID_USERS = 0x201;
public const int DOMAIN_USER_RID_ADMIN = 0x1F4;
public const int DOMAIN_USER_RID_GUEST = 0x1F5;
public const int DONT_RESOLVE_DLL_REFERENCES = 0x1;
public const int DOUBLE_CLICK = 0x2;
public const int DRIVE_CDROM = 5;
public const int DRIVE_FIXED = 3;
public const int DRIVE_RAMDISK = 6;
public const int DRIVE_REMOTE = 4;
public const int DRIVE_REMOVABLE = 2;
public const int DTR_CONTROL_DISABLE = 0x0;
public const int DTR_CONTROL_ENABLE = 0x1;
public const int DTR_CONTROL_HANDSHAKE = 0x2;
public const int DUPLICATE_CLOSE_SOURCE = 0x1;
public const int DUPLICATE_SAME_ACCESS = 0x2;
public const int ENABLE_ECHO_INPUT = 0x4;
public const int ENABLE_LINE_INPUT = 0x2;
public const int ENABLE_MOUSE_INPUT = 0x10;
public const int ENABLE_PROCESSED_INPUT = 0x1;
public const int ENABLE_PROCESSED_OUTPUT = 0x1;
public const int ENABLE_WINDOW_INPUT = 0x8;
public const int ENABLE_WRAP_AT_EOL_OUTPUT = 0x2;
public const int ENHANCED_KEY = 0x100;
public const int ENUM_ALL_CALENDARS = 0xFFFF;
public const int ERROR_SEVERITY_ERROR = unchecked((int)0xC0000000);
public const int ERROR_SEVERITY_INFORMATIONAL = 0x40000000;
public const int ERROR_SEVERITY_SUCCESS = 0x0;
public const int ERROR_SEVERITY_WARNING = unchecked((int)0x80000000);
public const int EVENPARITY = 2;
public const int EV_BREAK = 0x40;
public const int EV_CTS = 0x8;
public const int EV_DSR = 0x10;
public const int EV_ERR = 0x80;
public const int EV_EVENT1 = 0x800;
public const int EV_EVENT2 = 0x1000;
public const int EV_PERR = 0x200;
public const int EV_RING = 0x100;
public const int EV_RLSD = 0x20;
public const int EV_RX80FULL = 0x400;
public const int EV_RXCHAR = 0x1;
public const int EV_RXFLAG = 0x2;
public const int EV_TXEMPTY = 0x4;
public const int EXCEPTION_CONTINUE_EXECUTION = -1;
public const int EXCEPTION_CONTINUE_SEARCH = 0;
public const int EXCEPTION_DEBUG_EVENT = 1;
public const int EXCEPTION_EXECUTE_HANDLER = 1;
public const int EXCEPTION_MAXIMUM_PARAMETERS = 15;
public const int EXIT_PROCESS_DEBUG_EVENT = 5;
public const int EXIT_THREAD_DEBUG_EVENT = 4;
public const int FAILED_ACCESS_ACE_FLAG = 0x80;
public const int FILE_ADD_FILE = (0x2);
public const int FILE_ADD_SUBDIRECTORY = (0x4);
public const int FILE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF);
public const int FILE_APPEND_DATA = (0x4);
public const int FILE_ATTRIBUTE_ARCHIVE = 0x20;
public const int FILE_ATTRIBUTE_COMPRESSED = 0x800;
public const int FILE_ATTRIBUTE_DIRECTORY = 0x10;
public const int FILE_ATTRIBUTE_HIDDEN = 0x2;
public const int FILE_ATTRIBUTE_NORMAL = 0x80;
public const int FILE_ATTRIBUTE_READONLY = 0x1;
public const int FILE_ATTRIBUTE_SYSTEM = 0x4;
public const int FILE_ATTRIBUTE_TEMPORARY = 0x100;
public const int FILE_BEGIN = 0;
public const int FILE_CASE_PRESERVED_NAMES = 0x2;
public const int FILE_CASE_SENSITIVE_SEARCH = 0x1;
public const int FILE_CREATE_PIPE_INSTANCE = (0x4);
public const int FILE_CURRENT = 1;
public const int FILE_DELETE_CHILD = (0x40);
public const int FILE_END = 2;
public const int FILE_EXECUTE = (0x20);
public const int FILE_FILE_COMPRESSION = 0x10;
public const int FILE_FLAG_BACKUP_SEMANTICS = 0x2000000;
public const int FILE_FLAG_DELETE_ON_CLOSE = 0x4000000;
public const int FILE_FLAG_NO_BUFFERING = 0x20000000;
public const int FILE_FLAG_OVERLAPPED = 0x40000000;
public const int FILE_FLAG_POSIX_SEMANTICS = 0x1000000;
public const int FILE_FLAG_RANDOM_ACCESS = 0x10000000;
public const int FILE_FLAG_SEQUENTIAL_SCAN = 0x8000000;
public const int FILE_FLAG_WRITE_THROUGH = unchecked((int)0x80000000);
public const int FILE_GENERIC_EXECUTE = (STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES | FILE_EXECUTE | SYNCHRONIZE);
public const int FILE_GENERIC_READ = (STANDARD_RIGHTS_READ | FILE_READ_DATA | FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE);
public const int FILE_GENERIC_WRITE = (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA | SYNCHRONIZE);
public const int FILE_LIST_DIRECTORY = (0x1);
public const int FILE_MAP_ALL_ACCESS = SECTION_ALL_ACCESS;
public const int FILE_MAP_COPY = SECTION_QUERY;
public const int FILE_MAP_READ = SECTION_MAP_READ;
public const int FILE_MAP_WRITE = SECTION_MAP_WRITE;
public const int FILE_NOTIFY_CHANGE_ATTRIBUTES = 0x4;
public const int FILE_NOTIFY_CHANGE_DIR_NAME = 0x2;
public const int FILE_NOTIFY_CHANGE_FILE_NAME = 0x1;
public const int FILE_NOTIFY_CHANGE_LAST_WRITE = 0x10;
public const int FILE_NOTIFY_CHANGE_SECURITY = 0x100;
public const int FILE_NOTIFY_CHANGE_SIZE = 0x8;
public const int FILE_PERSISTENT_ACLS = 0x8;
public const int FILE_READ_ATTRIBUTES = (0x80);
public const int FILE_READ_DATA = (0x1);
public const int FILE_READ_EA = (0x8);
public const int FILE_READ_PROPERTIES = FILE_READ_EA;
public const int FILE_SHARE_READ = 0x1;
public const int FILE_SHARE_WRITE = 0x2;
public const int FILE_TRAVERSE = (0x20);
public const int FILE_TYPE_CHAR = 0x2;
public const int FILE_TYPE_DISK = 0x1;
public const int FILE_TYPE_PIPE = 0x3;
public const int FILE_TYPE_REMOTE = 0x8000;
public const int FILE_TYPE_UNKNOWN = 0x0;
public const int FILE_UNICODE_ON_DISK = 0x4;
public const int FILE_VOLUME_IS_COMPRESSED = 0x8000;
public const int FILE_WRITE_ATTRIBUTES = (0x100);
public const int FILE_WRITE_DATA = (0x2);
public const int FILE_WRITE_EA = (0x10);
public const int FILE_WRITE_PROPERTIES = FILE_WRITE_EA;
public const int FOCUS_EVENT = 0x10;
public const int FOREGROUND_BLUE = 0x1;
public const int FOREGROUND_GREEN = 0x2;
public const int FOREGROUND_INTENSITY = 0x8;
public const int FOREGROUND_RED = 0x4;
public const int FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x100;
public const int FORMAT_MESSAGE_ARGUMENT_ARRAY = 0x2000;
public const int FORMAT_MESSAGE_FROM_HMODULE = 0x800;
public const int FORMAT_MESSAGE_FROM_STRING = 0x400;
public const int FORMAT_MESSAGE_FROM_SYSTEM = 0x1000;
public const int FORMAT_MESSAGE_IGNORE_INSERTS = 0x200;
public const int FORMAT_MESSAGE_MAX_WIDTH_MASK = 0xFF;
public const int FROM_LEFT_1ST_BUTTON_PRESSED = 0x1;
public const int FROM_LEFT_2ND_BUTTON_PRESSED = 0x4;
public const int FROM_LEFT_3RD_BUTTON_PRESSED = 0x8;
public const int FROM_LEFT_4TH_BUTTON_PRESSED = 0x10;
public const int FS_CASE_IS_PRESERVED = FILE_CASE_PRESERVED_NAMES;
public const int FS_CASE_SENSITIVE = FILE_CASE_SENSITIVE_SEARCH;
public const int FS_PERSISTENT_ACLS = FILE_PERSISTENT_ACLS;
public const int FS_UNICODE_STORED_ON_DISK = FILE_UNICODE_ON_DISK;
public const int GENERIC_ALL = 0x10000000;
public const int GENERIC_EXECUTE = 0x20000000;
public const int GENERIC_READ = unchecked((int)0x80000000);
public const int GENERIC_WRITE = 0x40000000;
public const int GET_TAPE_DRIVE_INFORMATION = 1;
public const int GET_TAPE_MEDIA_INFORMATION = 0;
public const int GHND = (GMEM_MOVEABLE | GMEM_ZEROINIT);
public const int GMEM_DDESHARE = 0x2000;
public const int GMEM_DISCARDABLE = 0x100;
public const int GMEM_DISCARDED = 0x4000;
public const int GMEM_FIXED = 0x0;
public const int GMEM_INVALID_HANDLE = 0x8000;
public const int GMEM_LOCKCOUNT = 0xFF;
public const int GMEM_LOWER = GMEM_NOT_BANKED;
public const int GMEM_MODIFY = 0x80;
public const int GMEM_MOVEABLE = 0x2;
public const int GMEM_NOCOMPACT = 0x10;
public const int GMEM_NODISCARD = 0x20;
public const int GMEM_NOTIFY = 0x4000;
public const int GMEM_NOT_BANKED = 0x1000;
public const int GMEM_SHARE = 0x2000;
public const int GMEM_VALID_FLAGS = 0x7F72;
public const int GMEM_ZEROINIT = 0x40;
public const int GPTR = (GMEM_FIXED | GMEM_ZEROINIT);
public const int HIGH_PRIORITY_CLASS = 0x80;
public const int HKEY_CLASSES_ROOT = unchecked((int)0x80000000);
public const int HKEY_CURRENT_CONFIG = unchecked((int)0x80000005);
public const int HKEY_CURRENT_USER = unchecked((int)0x80000001);
public const int HKEY_DYN_DATA = unchecked((int)0x80000006);
public const int HKEY_LOCAL_MACHINE = unchecked((int)0x80000002);
public const int HKEY_PERFORMANCE_DATA = unchecked((int)0x80000004);
public const int HKEY_USERS = unchecked((int)0x80000003);
public const int IDLE_PRIORITY_CLASS = 0x40;
public const int IE_BADID = (-1);
public const int IE_BAUDRATE = (-12);
public const int IE_BYTESIZE = (-11);
public const int IE_DEFAULT = (-5);
public const int IE_HARDWARE = (-10);
public const int IE_MEMORY = (-4);
public const int IE_NOPEN = (-3);
public const int IE_OPEN = (-2);
public const int IGNORE = 0;
public const int INFINITE = 0xFFFF;
public const int INHERIT_ONLY_ACE = 0x8;
public const int IO_COMPLETION_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3);
public const int IO_COMPLETION_MODIFY_STATE = 0x2;
public const int KEY_ALL_ACCESS = ((STANDARD_RIGHTS_ALL | KEY_QUERY_VALUE | KEY_SET_VALUE | KEY_CREATE_SUB_KEY | KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY | KEY_CREATE_LINK) & (~ SYNCHRONIZE));
public const int KEY_CREATE_LINK = 0x20;
public const int KEY_CREATE_SUB_KEY = 0x4;
public const int KEY_ENUMERATE_SUB_KEYS = 0x8;
public const int KEY_EVENT = 0x1;
public const int KEY_EXECUTE = ((KEY_READ) & (~ SYNCHRONIZE));
public const int KEY_NOTIFY = 0x10;
public const int KEY_QUERY_VALUE = 0x1;
public const int KEY_READ = ((STANDARD_RIGHTS_READ | KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY) & (~ SYNCHRONIZE));
public const int KEY_SET_VALUE = 0x2;
public const int KEY_WRITE = ((STANDARD_RIGHTS_WRITE | KEY_SET_VALUE | KEY_CREATE_SUB_KEY) & (~ SYNCHRONIZE));
public const int LANG_BULGARIAN = 0x2;
public const int LANG_CHINESE = 0x4;
public const int LANG_CROATIAN = 0x1A;
public const int LANG_CZECH = 0x5;
public const int LANG_DANISH = 0x6;
public const int LANG_DUTCH = 0x13;
public const int LANG_ENGLISH = 0x9;
public const int LANG_FINNISH = 0xB;
public const int LANG_FRENCH = 0xC;
public const int LANG_GERMAN = 0x7;
public const int LANG_GREEK = 0x8;
public const int LANG_HUNGARIAN = 0xE;
public const int LANG_ICELANDIC = 0xF;
public const int LANG_ITALIAN = 0x10;
public const int LANG_JAPANESE = 0x11;
public const int LANG_KOREAN = 0x12;
public const int LANG_NEUTRAL = 0x0;
public const int LANG_NORWEGIAN = 0x14;
public const int LANG_POLISH = 0x15;
public const int LANG_PORTUGUESE = 0x16;
public const int LANG_ROMANIAN = 0x18;
public const int LANG_RUSSIAN = 0x19;
public const int LANG_SLOVAK = 0x1B;
public const int LANG_SLOVENIAN = 0x24;
public const int LANG_SPANISH = 0xA;
public const int LANG_SWEDISH = 0x1D;
public const int LANG_TURKISH = 0x1F;
public const int LCMAP_BYTEREV = 0x800;
public const int LCMAP_LOWERCASE = 0x100;
public const int LCMAP_SORTKEY = 0x400;
public const int LCMAP_UPPERCASE = 0x200;
public const int LEFT_ALT_PRESSED = 0x2;
public const int LEFT_CTRL_PRESSED = 0x8;
public const int LHND = (LMEM_MOVEABLE + LMEM_ZEROINIT);
public const int LMEM_DISCARDABLE = 0xF00;
public const int LMEM_DISCARDED = 0x4000;
public const int LMEM_FIXED = 0x0;
public const int LMEM_INVALID_HANDLE = 0x8000;
public const int LMEM_LOCKCOUNT = 0xFF;
public const int LMEM_MODIFY = 0x80;
public const int LMEM_MOVEABLE = 0x2;
public const int LMEM_NOCOMPACT = 0x10;
public const int LMEM_NODISCARD = 0x20;
public const int LMEM_VALID_FLAGS = 0xF72;
public const int LMEM_ZEROINIT = 0x40;
public const int LNOTIFY_DISCARD = 2;
public const int LNOTIFY_MOVE = 1;
public const int LNOTIFY_OUTOFMEM = 0;
public const int LOAD_DLL_DEBUG_EVENT = 6;
public const int LOCALE_ICENTURY = 0x24;
public const int LOCALE_ICOUNTRY = 0x5;
public const int LOCALE_ICURRDIGITS = 0x19;
public const int LOCALE_ICURRENCY = 0x1B;
public const int LOCALE_IDATE = 0x21;
public const int LOCALE_IDAYLZERO = 0x26;
public const int LOCALE_IDEFAULTCODEPAGE = 0xB;
public const int LOCALE_IDEFAULTCOUNTRY = 0xA;
public const int LOCALE_IDEFAULTLANGUAGE = 0x9;
public const int LOCALE_IDIGITS = 0x11;
public const int LOCALE_IINTLCURRDIGITS = 0x1A;
public const int LOCALE_ILANGUAGE = 0x1;
public const int LOCALE_ILDATE = 0x22;
public const int LOCALE_ILZERO = 0x12;
public const int LOCALE_IMEASURE = 0xD;
public const int LOCALE_IMONLZERO = 0x27;
public const int LOCALE_INEGCURR = 0x1C;
public const int LOCALE_INEGSEPBYSPACE = 0x57;
public const int LOCALE_INEGSIGNPOSN = 0x53;
public const int LOCALE_INEGSYMPRECEDES = 0x56;
public const int LOCALE_IPOSSEPBYSPACE = 0x55;
public const int LOCALE_IPOSSIGNPOSN = 0x52;
public const int LOCALE_IPOSSYMPRECEDES = 0x54;
public const int LOCALE_ITIME = 0x23;
public const int LOCALE_ITLZERO = 0x25;
public const int LOCALE_NOUSEROVERRIDE = unchecked((int) 0x80000000);
public const int LOCALE_S1159 = 0x28;
public const int LOCALE_S2359 = 0x29;
public const int LOCALE_SABBREVCTRYNAME = 0x7;
public const int LOCALE_SABBREVDAYNAME1 = 0x31;
public const int LOCALE_SABBREVDAYNAME2 = 0x32;
public const int LOCALE_SABBREVDAYNAME3 = 0x33;
public const int LOCALE_SABBREVDAYNAME4 = 0x34;
public const int LOCALE_SABBREVDAYNAME5 = 0x35;
public const int LOCALE_SABBREVDAYNAME6 = 0x36;
public const int LOCALE_SABBREVDAYNAME7 = 0x37;
public const int LOCALE_SABBREVLANGNAME = 0x3;
public const int LOCALE_SABBREVMONTHNAME1 = 0x44;
public const int LOCALE_SABBREVMONTHNAME10 = 0x4D;
public const int LOCALE_SABBREVMONTHNAME11 = 0x4E;
public const int LOCALE_SABBREVMONTHNAME12 = 0x4F;
public const int LOCALE_SABBREVMONTHNAME13 = 0x100F;
public const int LOCALE_SABBREVMONTHNAME2 = 0x45;
public const int LOCALE_SABBREVMONTHNAME3 = 0x46;
public const int LOCALE_SABBREVMONTHNAME4 = 0x47;
public const int LOCALE_SABBREVMONTHNAME5 = 0x48;
public const int LOCALE_SABBREVMONTHNAME6 = 0x49;
public const int LOCALE_SABBREVMONTHNAME7 = 0x4A;
public const int LOCALE_SABBREVMONTHNAME8 = 0x4B;
public const int LOCALE_SABBREVMONTHNAME9 = 0x4C;
public const int LOCALE_SCOUNTRY = 0x6;
public const int LOCALE_SCURRENCY = 0x14;
public const int LOCALE_SDATE = 0x1D;
public const int LOCALE_SDAYNAME1 = 0x2A;
public const int LOCALE_SDAYNAME2 = 0x2B;
public const int LOCALE_SDAYNAME3 = 0x2C;
public const int LOCALE_SDAYNAME4 = 0x2D;
public const int LOCALE_SDAYNAME5 = 0x2E;
public const int LOCALE_SDAYNAME6 = 0x2F;
public const int LOCALE_SDAYNAME7 = 0x30;
public const int LOCALE_SDECIMAL = 0xE;
public const int LOCALE_SENGCOUNTRY = 0x1002;
public const int LOCALE_SENGLANGUAGE = 0x1001;
public const int LOCALE_SGROUPING = 0x10;
public const int LOCALE_SINTLSYMBOL = 0x15;
public const int LOCALE_SLANGUAGE = 0x2;
public const int LOCALE_SLIST = 0xC;
public const int LOCALE_SLONGDATE = 0x20;
public const int LOCALE_SMONDECIMALSEP = 0x16;
public const int LOCALE_SMONGROUPING = 0x18;
public const int LOCALE_SMONTHNAME1 = 0x38;
public const int LOCALE_SMONTHNAME10 = 0x41;
public const int LOCALE_SMONTHNAME11 = 0x42;
public const int LOCALE_SMONTHNAME12 = 0x43;
public const int LOCALE_SMONTHNAME2 = 0x39;
public const int LOCALE_SMONTHNAME3 = 0x3A;
public const int LOCALE_SMONTHNAME4 = 0x3B;
public const int LOCALE_SMONTHNAME5 = 0x3C;
public const int LOCALE_SMONTHNAME6 = 0x3D;
public const int LOCALE_SMONTHNAME7 = 0x3E;
public const int LOCALE_SMONTHNAME8 = 0x3F;
public const int LOCALE_SMONTHNAME9 = 0x40;
public const int LOCALE_SMONTHOUSANDSEP = 0x17;
public const int LOCALE_SNATIVECTRYNAME = 0x8;
public const int LOCALE_SNATIVEDIGITS = 0x13;
public const int LOCALE_SNATIVELANGNAME = 0x4;
public const int LOCALE_SNEGATIVESIGN = 0x51;
public const int LOCALE_SPOSITIVESIGN = 0x50;
public const int LOCALE_SSHORTDATE = 0x1F;
public const int LOCALE_STHOUSAND = 0xF;
public const int LOCALE_STIME = 0x1E;
public const int LOCALE_STIMEFORMAT = 0x1003;
public const int LOCKFILE_EXCLUSIVE_LOCK = 0x2;
public const int LOCKFILE_FAIL_IMMEDIATELY = 0x1;
public const int LOGON32_LOGON_BATCH = 4;
public const int LOGON32_LOGON_INTERACTIVE = 2;
public const int LOGON32_LOGON_SERVICE = 5;
public const int LOGON32_PROVIDER_DEFAULT = 0;
public const int LOGON32_PROVIDER_WINNT35 = 1;
public const int LPTR = (LMEM_FIXED + LMEM_ZEROINIT);
public const int LPTx = 0x80;
public const int MAILSLOT_NO_MESSAGE = (-1);
public const int MAILSLOT_WAIT_FOREVER = (-1);
public const int MAP_COMPOSITE = 0x40;
public const int MAP_FOLDCZONE = 0x10;
public const int MAP_FOLDDIGITS = 0x80;
public const int MAP_PRECOMPOSED = 0x20;
public const int MARKPARITY = 3;
public const int MAXByte = 0xFF;
public const int MAXCHAR = 0x7F;
public const int MAXDWORD = unchecked((int)0xFFFFFFFF);
public const int MAXIMUM_ALLOWED = 0x2000000;
public const int MAXLONG = 0x7FFFFFFF;
public const int MAXSHORT = 0x7FFF;
public const int MAXWORD = 0xFFFF;
public const int MAX_DEFAULTCHAR = 2;
public const int MAX_LEADBYTES = 12;
public const int MAX_PATH = 260;
public const int MB_COMPOSITE = 0x2;
public const int MB_PRECOMPOSED = 0x1;
public const int MB_USEGLYPHCHARS = 0x4;
public const int MENU_EVENT = 0x8;
public const int MINCHAR = 0x80;
public const int MINLONG = unchecked((int)0x80000000);
public const int MINSHORT = 0x8000;
public const int MOUSE_MOVED = 0x1;
public const int MOVEFILE_COPY_ALLOWED = 0x2;
public const int MOVEFILE_DELAY_UNTIL_REBOOT = 0x4;
public const int MOVEFILE_REPLACE_EXISTING = 0x1;
public const int MS_CTS_ON = 0x10;
public const int MS_DSR_ON = 0x20;
public const int MS_RING_ON = 0x40;
public const int MS_RLSD_ON = 0x80;
public const int NMPWAIT_NOWAIT = 0x1;
public const int NMPWAIT_USE_DEFAULT_WAIT = 0x0;
public const int NMPWAIT_WAIT_FOREVER = 0xFFFF;
public const int NONZEROLHND = (LMEM_MOVEABLE);
public const int NONZEROLPTR = (LMEM_FIXED);
public const int NOPARITY = 0;
public const int NORMAL_PRIORITY_CLASS = 0x20;
public const int NORM_IGNORECASE = 0x1;
public const int NORM_IGNORENONSPACE = 0x2;
public const int NORM_IGNORESYMBOLS = 0x4;
public const int NO_PROPAGATE_INHERIT_ACE = 0x4;
public const int NUMLOCK_ON = 0x20;
public const int OBJECT_INHERIT_ACE = 0x1;
public const int ODDPARITY = 1;
public const int OFS_MAXPATHNAME = 128;
public const int OF_CANCEL = 0x800;
public const int OF_CREATE = 0x1000;
public const int OF_DELETE = 0x200;
public const int OF_EXIST = 0x4000;
public const int OF_PARSE = 0x100;
public const int OF_PROMPT = 0x2000;
public const int OF_READ = 0x0;
public const int OF_READWRITE = 0x2;
public const int OF_REOPEN = 0x8000;
public const int OF_SHARE_COMPAT = 0x0;
public const int OF_SHARE_DENY_NONE = 0x40;
public const int OF_SHARE_DENY_READ = 0x30;
public const int OF_SHARE_DENY_WRITE = 0x20;
public const int OF_SHARE_EXCLUSIVE = 0x10;
public const int OF_VERIFY = 0x400;
public const int OF_WRITE = 0x1;
public const int ONE5STOPBITS = 1;
public const int ONESTOPBIT = 0;
public const int OPEN_ALWAYS = 4;
public const int OPEN_EXISTING = 3;
public const int OUTPUT_DEBUG_STRING_EVENT = 8;
public const int PARITY_EVEN = 0x400;
public const int PARITY_MARK = 0x800;
public const int PARITY_NONE = 0x100;
public const int PARITY_ODD = 0x200;
public const int PARITY_SPACE = 0x1000;
public const int PCF_16BITMODE = 0x200;
public const int PCF_DTRDSR = 0x1;
public const int PCF_INTTIMEOUTS = 0x80;
public const int PCF_PARITY_CHECK = 0x8;
public const int PCF_RLSD = 0x4;
public const int PCF_RTSCTS = 0x2;
public const int PCF_SETXCHAR = 0x20;
public const int PCF_SPECIALCHARS = 0x100;
public const int PCF_TOTALTIMEOUTS = 0x40;
public const int PCF_XONXOFF = 0x10;
public const int PERF_100NSEC_MULTI_TIMER = (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_DELTA_COUNTER | PERF_COUNTER_RATE | PERF_TIMER_100NS | PERF_MULTI_COUNTER | PERF_DISPLAY_PERCENT);
public const int PERF_100NSEC_MULTI_TIMER_INV = (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_DELTA_COUNTER | PERF_COUNTER_RATE | PERF_TIMER_100NS | PERF_MULTI_COUNTER | PERF_INVERSE_COUNTER | PERF_DISPLAY_PERCENT);
public const int PERF_100NSEC_TIMER = (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | PERF_TIMER_100NS | PERF_DELTA_COUNTER | PERF_DISPLAY_PERCENT);
public const int PERF_100NSEC_TIMER_INV = (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | PERF_TIMER_100NS | PERF_DELTA_COUNTER | PERF_INVERSE_COUNTER | PERF_DISPLAY_PERCENT);
public const int PERF_AVERAGE_BASE = (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_BASE | PERF_DISPLAY_NOSHOW | 0x2);
public const int PERF_AVERAGE_BULK = (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_FRACTION | PERF_DISPLAY_NOSHOW);
public const int PERF_AVERAGE_TIMER = (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_FRACTION | PERF_DISPLAY_SECONDS);
public const int PERF_COUNTER_BASE = 0x30000;
public const int PERF_COUNTER_BULK_COUNT = (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | PERF_TIMER_TICK | PERF_DELTA_COUNTER | PERF_DISPLAY_PER_SEC);
public const int PERF_COUNTER_COUNTER = (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | PERF_TIMER_TICK | PERF_DELTA_COUNTER | PERF_DISPLAY_PER_SEC);
public const int PERF_COUNTER_ELAPSED = 0x40000;
public const int PERF_COUNTER_FRACTION = 0x20000;
public const int PERF_COUNTER_HISTOGRAM = 0x60000;
public const int PERF_COUNTER_HISTOGRAM_TYPE = unchecked((int)0x80000000);
public const int PERF_COUNTER_MULTI_BASE = (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_BASE | PERF_MULTI_COUNTER | PERF_DISPLAY_NOSHOW);
public const int PERF_COUNTER_MULTI_TIMER = (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | PERF_DELTA_COUNTER | PERF_TIMER_TICK | PERF_MULTI_COUNTER | PERF_DISPLAY_PERCENT);
public const int PERF_COUNTER_MULTI_TIMER_INV = (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | PERF_DELTA_COUNTER | PERF_MULTI_COUNTER | PERF_TIMER_TICK | PERF_INVERSE_COUNTER | PERF_DISPLAY_PERCENT);
public const int PERF_COUNTER_NODATA = (PERF_SIZE_ZERO | PERF_DISPLAY_NOSHOW);
public const int PERF_COUNTER_QUEUELEN = 0x50000;
public const int PERF_COUNTER_QUEUELEN_TYPE = (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_QUEUELEN | PERF_TIMER_TICK | PERF_DELTA_COUNTER | PERF_DISPLAY_NO_SUFFIX);
public const int PERF_COUNTER_RATE = 0x10000;
public const int PERF_COUNTER_RAWCOUNT = (PERF_SIZE_DWORD | PERF_TYPE_NUMBER | PERF_NUMBER_DECIMAL | PERF_DISPLAY_NO_SUFFIX);
public const int PERF_COUNTER_TEXT = (PERF_SIZE_VARIABLE_LEN | PERF_TYPE_TEXT | PERF_TEXT_UNICODE | PERF_DISPLAY_NO_SUFFIX);
public const int PERF_COUNTER_TIMER = (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | PERF_TIMER_TICK | PERF_DELTA_COUNTER | PERF_DISPLAY_PERCENT);
public const int PERF_COUNTER_TIMER_INV = (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | PERF_TIMER_TICK | PERF_DELTA_COUNTER | PERF_INVERSE_COUNTER | PERF_DISPLAY_PERCENT);
public const int PERF_COUNTER_VALUE = 0x0;
public const int PERF_DATA_REVISION = 1;
public const int PERF_DATA_VERSION = 1;
public const int PERF_DELTA_BASE = 0x800000;
public const int PERF_DELTA_COUNTER = 0x400000;
public const int PERF_DETAIL_ADVANCED = 200;
public const int PERF_DETAIL_EXPERT = 300;
public const int PERF_DETAIL_NOVICE = 100;
public const int PERF_DETAIL_WIZARD = 400;
public const int PERF_DISPLAY_NOSHOW = 0x40000000;
public const int PERF_DISPLAY_NO_SUFFIX = 0x0;
public const int PERF_DISPLAY_PERCENT = 0x20000000;
public const int PERF_DISPLAY_PER_SEC = 0x10000000;
public const int PERF_DISPLAY_SECONDS = 0x30000000;
public const int PERF_ELAPSED_TIME = (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_ELAPSED | PERF_OBJECT_TIMER | PERF_DISPLAY_SECONDS);
public const int PERF_INVERSE_COUNTER = 0x1000000;
public const int PERF_MULTI_COUNTER = 0x2000000;
public const int PERF_NO_INSTANCES = -1;
public const int PERF_NO_UNIQUE_ID = -1;
public const int PERF_NUMBER_DECIMAL = 0x10000;
public const int PERF_NUMBER_DEC_1000 = 0x20000;
public const int PERF_NUMBER_HEX = 0x0;
public const int PERF_OBJECT_TIMER = 0x200000;
public const int PERF_RAW_BASE = (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_BASE | PERF_DISPLAY_NOSHOW | 0x3);
public const int PERF_RAW_FRACTION = (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_FRACTION | PERF_DISPLAY_PERCENT);
public const int PERF_SAMPLE_BASE = (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_BASE | PERF_DISPLAY_NOSHOW | 0x1);
public const int PERF_SAMPLE_COUNTER = (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | PERF_TIMER_TICK | PERF_DELTA_COUNTER | PERF_DISPLAY_NO_SUFFIX);
public const int PERF_SAMPLE_FRACTION = (PERF_SIZE_DWORD | PERF_TYPE_COUNTER | PERF_COUNTER_FRACTION | PERF_DELTA_COUNTER | PERF_DELTA_BASE | PERF_DISPLAY_PERCENT);
public const int PERF_SIZE_DWORD = 0x0;
public const int PERF_SIZE_LARGE = 0x100;
public const int PERF_SIZE_VARIABLE_LEN = 0x300;
public const int PERF_SIZE_ZERO = 0x200;
public const int PERF_TEXT_ASCII = 0x10000;
public const int PERF_TEXT_UNICODE = 0x0;
public const int PERF_TIMER_100NS = 0x100000;
public const int PERF_TIMER_TICK = 0x0;
public const int PERF_TYPE_COUNTER = 0x400;
public const int PERF_TYPE_NUMBER = 0x0;
public const int PERF_TYPE_TEXT = 0x800;
public const int PERF_TYPE_ZERO = 0xC00;
public const int PIPE_ACCESS_DUPLEX = 0x3;
public const int PIPE_ACCESS_INBOUND = 0x1;
public const int PIPE_ACCESS_OUTBOUND = 0x2;
public const int PIPE_CLIENT_END = 0x0;
public const int PIPE_NOWAIT = 0x1;
public const int PIPE_READMODE_BYTE = 0x0;
public const int PIPE_READMODE_MESSAGE = 0x2;
public const int PIPE_SERVER_END = 0x1;
public const int PIPE_TYPE_BYTE = 0x0;
public const int PIPE_TYPE_MESSAGE = 0x4;
public const int PIPE_UNLIMITED_INSTANCES = 255;
public const int PIPE_WAIT = 0x0;
public const int PRIVILEGE_SET_ALL_NECESSARY = (1);
public const int PROCESSOR_ALPHA_21064 = 21064;
public const int PROCESSOR_ARCHITECTURE_ALPHA = 2;
public const int PROCESSOR_ARCHITECTURE_INTEL = 0;
public const int PROCESSOR_ARCHITECTURE_MIPS = 1;
public const int PROCESSOR_ARCHITECTURE_PPC = 3;
public const int PROCESSOR_ARCHITECTURE_UNKNOWN = 0xFFFF;
public const int PROCESSOR_INTEL_386 = 386;
public const int PROCESSOR_INTEL_486 = 486;
public const int PROCESSOR_INTEL_PENTIUM = 586;
public const int PROCESSOR_MIPS_R4000 = 4000;
public const int PROCESS_HEAP_ENTRY_BUSY = 0x4;
public const int PROCESS_HEAP_ENTRY_DDESHARE = 0x20;
public const int PROCESS_HEAP_ENTRY_MOVEABLE = 0x10;
public const int PROCESS_HEAP_REGION = 0x1;
public const int PROCESS_HEAP_UNCOMMITTED_RANGE = 0x2;
public const int PROFILE_KERNEL = 0x20000000;
public const int PROFILE_SERVER = 0x40000000;
public const int PROFILE_USER = 0x10000000;
public const int PST_FAX = 0x21;
public const int PST_LAT = 0x101;
public const int PST_NETWORK_BRIDGE = 0x100;
public const int PST_PARALLELPORT = 0x2;
public const int PST_RS232 = 0x1;
public const int PST_RS422 = 0x3;
public const int PST_RS423 = 0x4;
public const int PST_RS449 = 0x5;
public const int PST_SCANNER = 0x22;
public const int PST_TCPIP_TELNET = 0x102;
public const int PST_UNSPECIFIED = 0x0;
public const int PST_X25 = 0x103;
public const int PURGE_RXABORT = 0x2;
public const int PURGE_RXCLEAR = 0x8;
public const int PURGE_TXABORT = 0x1;
public const int PURGE_TXCLEAR = 0x4;
public const int READ_CONTROL = 0x20000;
public const int REALTIME_PRIORITY_CLASS = 0x100;
public const int REG_BINARY = 3;
public const int REG_CREATED_NEW_KEY = 0x1;
public const int REG_DWORD = 4;
public const int REG_DWORD_BIG_ENDIAN = 5;
public const int REG_DWORD_LITTLE_ENDIAN = 4;
public const int REG_EXPAND_SZ = 2;
public const int REG_FULL_RESOURCE_DESCRIPTOR = 9;
public const int REG_LEGAL_CHANGE_FILTER = (REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_CHANGE_ATTRIBUTES | REG_NOTIFY_CHANGE_LAST_SET | REG_NOTIFY_CHANGE_SECURITY);
public const int REG_LEGAL_OPTION = (REG_OPTION_RESERVED | REG_OPTION_NON_VOLATILE | REG_OPTION_VOLATILE | REG_OPTION_CREATE_LINK | REG_OPTION_BACKUP_RESTORE);
public const int REG_LINK = 6;
public const int REG_MULTI_SZ = 7;
public const int REG_NONE = 0;
public const int REG_NOTIFY_CHANGE_ATTRIBUTES = 0x2;
public const int REG_NOTIFY_CHANGE_LAST_SET = 0x4;
public const int REG_NOTIFY_CHANGE_NAME = 0x1;
public const int REG_NOTIFY_CHANGE_SECURITY = 0x8;
public const int REG_OPENED_EXISTING_KEY = 0x2;
public const int REG_OPTION_BACKUP_RESTORE = 4;
public const int REG_OPTION_CREATE_LINK = 2;
public const int REG_OPTION_NON_VOLATILE = 0;
public const int REG_OPTION_RESERVED = 0;
public const int REG_OPTION_VOLATILE = 1;
public const int REG_REFRESH_HIVE = 0x2;
public const int REG_RESOURCE_LIST = 8;
public const int REG_RESOURCE_REQUIREMENTS_LIST = 10;
public const int REG_SZ = 1;
public const int REG_WHOLE_HIVE_VOLATILE = 0x1;
public const int RESETDEV = 7;
public const int RIGHTMOST_BUTTON_PRESSED = 0x2;
public const int RIGHT_ALT_PRESSED = 0x1;
public const int RIGHT_CTRL_PRESSED = 0x4;
public const int RIP_EVENT = 9;
public const int RTS_CONTROL_DISABLE = 0x0;
public const int RTS_CONTROL_ENABLE = 0x1;
public const int RTS_CONTROL_HANDSHAKE = 0x2;
public const int RTS_CONTROL_TOGGLE = 0x3;
public const int RT_ACCELERATOR = 9;
public const int RT_BITMAP = 2;
public const int RT_CURSOR = 1;
public const int RT_DIALOG = 5;
public const int RT_FONT = 8;
public const int RT_FONTDIR = 7;
public const int RT_ICON = 3;
public const int RT_MENU = 4;
public const int RT_RCDATA = 10;
public const int RT_STRING = 6;
public const int SCROLLLOCK_ON = 0x40;
public const int SCS_32BIT_BINARY = 0;
public const int SCS_DOS_BINARY = 1;
public const int SCS_OS216_BINARY = 5;
public const int SCS_PIF_BINARY = 3;
public const int SCS_POSIX_BINARY = 4;
public const int SCS_WOW_BINARY = 2;
public const int SC_MANAGER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED | SC_MANAGER_CONNECT | SC_MANAGER_CREATE_SERVICE | SC_MANAGER_ENUMERATE_SERVICE | SC_MANAGER_LOCK | SC_MANAGER_QUERY_LOCK_STATUS | SC_MANAGER_MODIFY_BOOT_CONFIG);
public const int SC_MANAGER_CONNECT = 0x1;
public const int SC_MANAGER_CREATE_SERVICE = 0x2;
public const int SC_MANAGER_ENUMERATE_SERVICE = 0x4;
public const int SC_MANAGER_LOCK = 0x8;
public const int SC_MANAGER_MODIFY_BOOT_CONFIG = 0x20;
public const int SC_MANAGER_QUERY_LOCK_STATUS = 0x10;
public const int SECTION_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_WRITE | SECTION_MAP_READ | SECTION_MAP_EXECUTE | SECTION_EXTEND_SIZE;
public const int SECTION_EXTEND_SIZE = 0x10;
public const int SECTION_MAP_EXECUTE = 0x8;
public const int SECTION_MAP_READ = 0x4;
public const int SECTION_MAP_WRITE = 0x2;
public const int SECTION_QUERY = 0x1;
public const int SECURITY_ANONYMOUS_LOGON_RID = 0x7;
public const int SECURITY_BATCH_RID = 0x3;
public const int SECURITY_BUILTIN_DOMAIN_RID = 0x20;
public const int SECURITY_CONTEXT_TRACKING = 0x40000;
public const int SECURITY_CREATOR_GROUP_RID = 0x1;
public const int SECURITY_CREATOR_OWNER_RID = 0x0;
public const int SECURITY_DESCRIPTOR_MIN_LENGTH = (20);
public const int SECURITY_DESCRIPTOR_REVISION = (1);
public const int SECURITY_DESCRIPTOR_REVISION1 = (1);
public const int SECURITY_DIALUP_RID = 0x1;
public const int SECURITY_EFFECTIVE_ONLY = 0x80000;
public const int SECURITY_INTERACTIVE_RID = 0x4;
public const int SECURITY_LOCAL_RID = 0x0;
public const int SECURITY_LOCAL_SYSTEM_RID = 0x12;
public const int SECURITY_LOGON_IDS_RID = 0x5;
public const int SECURITY_NETWORK_RID = 0x2;
public const int SECURITY_NT_NON_UNIQUE = 0x15;
public const int SECURITY_NULL_RID = 0x0;
public const int SECURITY_SERVICE_RID = 0x6;
public const int SECURITY_SQOS_PRESENT = 0x100000;
public const int SECURITY_VALID_SQOS_FLAGS = 0x1F0000;
public const int SECURITY_WORLD_RID = 0x0;
public const int SEM_FAILCRITICALERRORS = 0x1;
public const int SEM_NOGPFAULTERRORBOX = 0x2;
public const int SEM_NOOPENFILEERRORBOX = 0x8000;
public const int SERVICE_ACCEPT_PAUSE_CONTINUE = 0x2;
public const int SERVICE_ACCEPT_SHUTDOWN = 0x4;
public const int SERVICE_ACCEPT_STOP = 0x1;
public const int SERVICE_ACTIVE = 0x1;
public const int SERVICE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED | SERVICE_QUERY_CONFIG | SERVICE_CHANGE_CONFIG | SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_START | SERVICE_STOP | SERVICE_PAUSE_CONTINUE | SERVICE_INTERROGATE | SERVICE_USER_DEFINED_CONTROL);
public const int SERVICE_CHANGE_CONFIG = 0x2;
public const int SERVICE_CONTINUE_PENDING = 0x5;
public const int SERVICE_CONTROL_CONTINUE = 0x3;
public const int SERVICE_CONTROL_INTERROGATE = 0x4;
public const int SERVICE_CONTROL_PAUSE = 0x2;
public const int SERVICE_CONTROL_SHUTDOWN = 0x5;
public const int SERVICE_CONTROL_STOP = 0x1;
public const int SERVICE_ENUMERATE_DEPENDENTS = 0x8;
public const int SERVICE_INACTIVE = 0x2;
public const int SERVICE_INTERROGATE = 0x80;
public const int SERVICE_NO_CHANGE = 0xFFFF;
public const int SERVICE_PAUSED = 0x7;
public const int SERVICE_PAUSE_CONTINUE = 0x40;
public const int SERVICE_PAUSE_PENDING = 0x6;
public const int SERVICE_QUERY_CONFIG = 0x1;
public const int SERVICE_QUERY_STATUS = 0x4;
public const int SERVICE_RUNNING = 0x4;
public const int SERVICE_START = 0x10;
public const int SERVICE_START_PENDING = 0x2;
public const int SERVICE_STATE_ALL = (SERVICE_ACTIVE | SERVICE_INACTIVE);
public const int SERVICE_STOP = 0x20;
public const int SERVICE_STOPPED = 0x1;
public const int SERVICE_STOP_PENDING = 0x3;
public const int SERVICE_USER_DEFINED_CONTROL = 0x100;
public const int SETBREAK = 8;
public const int SETDTR = 5;
public const int SETRTS = 3;
public const int SETXOFF = 1;
public const int SETXON = 2;
public const int SET_TAPE_DRIVE_INFORMATION = 1;
public const int SET_TAPE_MEDIA_INFORMATION = 0;
public const int SE_DACL_DEFAULTED = 0x8;
public const int SE_DACL_PRESENT = 0x4;
public const int SE_GROUP_DEFAULTED = 0x2;
public const int SE_GROUP_ENABLED = 0x4;
public const int SE_GROUP_ENABLED_BY_DEFAULT = 0x2;
public const int SE_GROUP_LOGON_ID = unchecked((int)0xC0000000);
public const int SE_GROUP_MANDATORY = 0x1;
public const int SE_GROUP_OWNER = 0x8;
public const int SE_OWNER_DEFAULTED = 0x1;
public const int SE_PRIVILEGE_ENABLED = 0x2;
public const int SE_PRIVILEGE_ENABLED_BY_DEFAULT = 0x1;
public const int SE_PRIVILEGE_USED_FOR_ACCESS = unchecked((int)0x80000000);
public const int SE_SACL_DEFAULTED = 0x20;
public const int SE_SACL_PRESENT = 0x10;
public const int SE_SELF_RELATIVE = 0x8000;
public const int SHIFT_PRESSED = 0x10;
public const int SHUTDOWN_NORETRY = 0x1;
public const int SID_MAX_SUB_AUTHORITIES = (15);
public const int SID_RECOMMENDED_SUB_AUTHORITIES = (1);
public const int SID_REVISION = (1);
public const int SLE_ERROR = 0x1;
public const int SLE_MINORERROR = 0x2;
public const int SLE_WARNING = 0x3;
public const int SORT_CHINESE_BIG5 = 0x0;
public const int SORT_CHINESE_UNICODE = 0x1;
public const int SORT_DEFAULT = 0x0;
public const int SORT_JAPANESE_UNICODE = 0x1;
public const int SORT_JAPANESE_XJIS = 0x0;
public const int SORT_KOREAN_KSC = 0x0;
public const int SORT_KOREAN_UNICODE = 0x1;
public const int SORT_STRINGSORT = 0x1000;
public const int SPACEPARITY = 4;
public const int SPECIFIC_RIGHTS_ALL = 0xFFFF;
public const int SP_BAUD = 0x2;
public const int SP_DATABITS = 0x4;
public const int SP_HANDSHAKING = 0x10;
public const int SP_PARITY = 0x1;
public const int SP_PARITY_CHECK = 0x20;
public const int SP_RLSD = 0x40;
public const int SP_SERIALCOMM = 0x1;
public const int SP_STOPBITS = 0x8;
public const int STANDARD_RIGHTS_ALL = 0x1F0000;
public const int STANDARD_RIGHTS_EXECUTE = (READ_CONTROL);
public const int STANDARD_RIGHTS_READ = (READ_CONTROL);
public const int STANDARD_RIGHTS_REQUIRED = 0xF0000;
public const int STANDARD_RIGHTS_WRITE = (READ_CONTROL);
public const int STARTF_FORCEOFFFEEDBACK = 0x80;
public const int STARTF_FORCEONFEEDBACK = 0x40;
public const int STARTF_RUNFULLSCREEN = 0x20;
public const int STARTF_USECOUNTCHARS = 0x8;
public const int STARTF_USEFILLATTRIBUTE = 0x10;
public const int STARTF_USEPOSITION = 0x4;
public const int STARTF_USESHOWWINDOW = 0x1;
public const int STARTF_USESIZE = 0x2;
public const int STARTF_USESTDHANDLES = 0x100;
public const int STD_ERROR_HANDLE = -12;
public const int STD_INPUT_HANDLE = -10;
public const int STD_OUTPUT_HANDLE = -11;
public const int STOPBITS_10 = 0x1;
public const int STOPBITS_15 = 0x2;
public const int STOPBITS_20 = 0x4;
public const int STREAM_CONTAINS_SECURITY = 0x2;
public const int STREAM_MODIFIED_WHEN_READ = 0x1;
public const int SUBLANG_CHINESE_HONGKONG = 0x3;
public const int SUBLANG_CHINESE_SIMPLIFIED = 0x2;
public const int SUBLANG_CHINESE_SINGAPORE = 0x4;
public const int SUBLANG_CHINESE_TRADITIONAL = 0x1;
public const int SUBLANG_DEFAULT = 0x1;
public const int SUBLANG_DUTCH = 0x1;
public const int SUBLANG_DUTCH_BELGIAN = 0x2;
public const int SUBLANG_ENGLISH_AUS = 0x3;
public const int SUBLANG_ENGLISH_CAN = 0x4;
public const int SUBLANG_ENGLISH_EIRE = 0x6;
public const int SUBLANG_ENGLISH_NZ = 0x5;
public const int SUBLANG_ENGLISH_UK = 0x2;
public const int SUBLANG_ENGLISH_US = 0x1;
public const int SUBLANG_FRENCH = 0x1;
public const int SUBLANG_FRENCH_BELGIAN = 0x2;
public const int SUBLANG_FRENCH_CANADIAN = 0x3;
public const int SUBLANG_FRENCH_SWISS = 0x4;
public const int SUBLANG_GERMAN = 0x1;
public const int SUBLANG_GERMAN_AUSTRIAN = 0x3;
public const int SUBLANG_GERMAN_SWISS = 0x2;
public const int SUBLANG_ITALIAN = 0x1;
public const int SUBLANG_ITALIAN_SWISS = 0x2;
public const int SUBLANG_NEUTRAL = 0x0;
public const int SUBLANG_NORWEGIAN_BOKMAL = 0x1;
public const int SUBLANG_NORWEGIAN_NYNORSK = 0x2;
public const int SUBLANG_PORTUGUESE = 0x2;
public const int SUBLANG_PORTUGUESE_BRAZILIAN = 0x1;
public const int SUBLANG_SPANISH = 0x1;
public const int SUBLANG_SPANISH_MEXICAN = 0x2;
public const int SUBLANG_SPANISH_MODERN = 0x3;
public const int SUBLANG_SYS_DEFAULT = 0x2;
public const int SUCCESSFUL_ACCESS_ACE_FLAG = 0x40;
public const int SYNCHRONIZE = 0x100000;
public const int SYSTEM_ALARM_ACE_TYPE = 0x3;
public const int SYSTEM_AUDIT_ACE_TYPE = 0x2;
public const int S_ALLTHRESHOLD = 2;
public const int S_LEGATO = 1;
public const int S_NORMAL = 0;
public const int S_PERIOD1024 = 1;
public const int S_PERIOD2048 = 2;
public const int S_PERIOD512 = 0;
public const int S_PERIODVOICE = 3;
public const int S_QUEUEEMPTY = 0;
public const int S_SERBDNT = (-5);
public const int S_SERDCC = (-7);
public const int S_SERDDR = (-14);
public const int S_SERDFQ = (-13);
public const int S_SERDLN = (-6);
public const int S_SERDMD = (-10);
public const int S_SERDPT = (-12);
public const int S_SERDSH = (-11);
public const int S_SERDSR = (-15);
public const int S_SERDST = (-16);
public const int S_SERDTP = (-8);
public const int S_SERDVL = (-9);
public const int S_SERDVNA = (-1);
public const int S_SERMACT = (-3);
public const int S_SEROFM = (-2);
public const int S_SERQFUL = (-4);
public const int S_STACCATO = 2;
public const int S_THRESHOLD = 1;
public const int S_WHITE1024 = 5;
public const int S_WHITE2048 = 6;
public const int S_WHITE512 = 4;
public const int S_WHITEVOICE = 7;
public const int SecurityAnonymous = 1;
public const int SecurityIdentification = 2;
public const int SidTypeAlias = 4;
public const int SidTypeDeletedAccount = 6;
public const int SidTypeDomain = 3;
public const int SidTypeGroup = 2;
public const int SidTypeInvalid = 7;
public const int SidTypeUnknown = 8;
public const int SidTypeUser = 1;
public const int SidTypeWellKnownGroup = 5;
public const int TC_GP_TRAP = 2;
public const int TC_HARDERR = 1;
public const int TC_NORMAL = 0;
public const int TC_SIGNAL = 3;
public const int TF_FORCEDRIVE = 0x80;
public const int THREAD_BASE_PRIORITY_IDLE = -15;
public const int THREAD_BASE_PRIORITY_LOWRT = 15;
public const int THREAD_BASE_PRIORITY_MAX = 2;
public const int THREAD_BASE_PRIORITY_MIN = -2;
public const int THREAD_PRIORITY_ABOVE_NORMAL = (THREAD_PRIORITY_HIGHEST - 1);
public const int THREAD_PRIORITY_BELOW_NORMAL = (THREAD_PRIORITY_LOWEST + 1);
public const int THREAD_PRIORITY_ERROR_RETURN = (MAXLONG);
public const int THREAD_PRIORITY_HIGHEST = THREAD_BASE_PRIORITY_MAX;
public const int THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE;
public const int THREAD_PRIORITY_LOWEST = THREAD_BASE_PRIORITY_MIN;
public const int THREAD_PRIORITY_NORMAL = 0;
public const int THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT;
public const int TIME_FORCE24HOURFORMAT = 0x8;
public const int TIME_NOMINUTESORSECONDS = 0x1;
public const int TIME_NOSECONDS = 0x2;
public const int TIME_NOTIMEMARKER = 0x4;
public const int TLS_OUT_OF_INDEXES = 0xFFFF;
public const int TRUNCATE_EXISTING = 5;
public const int TWOSTOPBITS = 2;
public const int TokenDefaultDacl = 6;
public const int TokenGroups = 2;
public const int TokenImpersonationLevel = 9;
public const int TokenOwner = 4;
public const int TokenPrimaryGroup = 5;
public const int TokenPrivileges = 3;
public const int TokenSource = 7;
public const int TokenStatistics = 10;
public const int TokenType = 8;
public const int TokenUser = 1;
public const int UNLOAD_DLL_DEBUG_EVENT = 7;
public const int VALID_INHERIT_FLAGS = 0xF;
public const int VER_PLATFORM_WIN32_NT = 2;
public const int VER_PLATFORM_WIN32_WINDOWS = 1;
public const int VER_PLATFORM_WIN32s = 0;
public const int WC_COMPOSITECHECK = 0x200;
public const int WC_DEFAULTCHAR = 0x40;
public const int WC_DEFAULTCHECK = 0x100;
public const int WC_DISCARDNS = 0x10;
public const int WC_SEPCHARS = 0x20;
public const int WINDOW_BUFFER_SIZE_EVENT = 0x4;
public const int WRITE_DAC = 0x40000;
public const int WRITE_OWNER = 0x80000;
public const int mouse_eventC = 0x2;
public const string SC_GROUP_IDENTIFIER = "+";
public const string SERVICES_ACTIVE_DATABASE = "ServicesActive";
public const string SERVICES_FAILED_DATABASE = "ServicesFailed";
public const string SE_ASSIGNPRIMARYTOKEN_NAME = "SeAssignPrimaryTokenPrivilege";
public const string SE_AUDIT_NAME = "SeAuditPrivilege";
public const string SE_BACKUP_NAME = "SeBackupPrivilege";
public const string SE_CHANGE_NOTIFY_NAME = "SeChangeNotifyPrivilege";
public const string SE_CREATE_PAGEFILE_NAME = "SeCreatePagefilePrivilege";
public const string SE_CREATE_PERMANENT_NAME = "SeCreatePermanentPrivilege";
public const string SE_CREATE_TOKEN_NAME = "SeCreateTokenPrivilege";
public const string SE_DEBUG_NAME = "SeDebugPrivilege";
public const string SE_INCREASE_QUOTA_NAME = "SeIncreaseQuotaPrivilege";
public const string SE_INC_BASE_PRIORITY_NAME = "SeIncreaseBasePriorityPrivilege";
public const string SE_LOAD_DRIVER_NAME = "SeLoadDriverPrivilege";
public const string SE_LOCK_MEMORY_NAME = "SeLockMemoryPrivilege";
public const string SE_MACHINE_ACCOUNT_NAME = "SeMachineAccountPrivilege";
public const string SE_PROF_SINGLE_PROCESS_NAME = "SeProfileSingleProcessPrivilege";
public const string SE_REMOTE_SHUTDOWN_NAME = "SeRemoteShutdownPrivilege";
public const string SE_RESTORE_NAME = "SeRestorePrivilege";
public const string SE_SECURITY_NAME = "SeSecurityPrivilege";
public const string SE_SHUTDOWN_NAME = "SeShutdownPrivilege";
public const string SE_SYSTEMTIME_NAME = "SeSystemtimePrivilege";
public const string SE_SYSTEM_ENVIRONMENT_NAME = "SeSystemEnvironmentPrivilege";
public const string SE_SYSTEM_PROFILE_NAME = "SeSystemProfilePrivilege";
public const string SE_TAKE_OWNERSHIP_NAME = "SeTakeOwnershipPrivilege";
public const string SE_TCB_NAME = "SeTcbPrivilege";
public const string SE_UNSOLICITED_INPUT_NAME = "SeUnsolicitedInputPrivilege";
}
}


using System;
using System.Runtime.InteropServices;
using System.Text;
using HANDLE = System.IntPtr;
using HWND = System.IntPtr;
using HDC = System.IntPtr;
namespace Win32
{
public struct CBTACTIVATESTRUCT
{
public int fMouse;
public HWND
hwndActive;
}
public struct EVENTMSG
{
public int message;
public int
paramL;
public int paramH;
public int
time;
public HWND hwnd;
}
public struct
CWPSTRUCT
{
public int lParam;
public
int wParam;
public int message;
public HWND
hwnd;
}
public struct DEBUGHOOKINFO
{
public HANDLE hModuleHook;
public int
Reserved;
public int lParam;
public int
wParam;
public int code;
}
public struct
MOUSEHOOKSTRUCT
{
public POINT
pt;
public HWND hwnd;
public int
wHitTestCode;
public int dwExtraInfo;
}
public
struct MINMAXINFO
{
public POINT
ptReserved;
public POINT ptMaxSize;
public POINT
ptMaxPosition;
public POINT ptMinTrackSize;
public
POINT ptMaxTrackSize;
}
public struct COPYDATASTRUCT
{
public int dwData;
public int
cbData;
public int lpData;
}
public struct
WINDOWPOS
{
public HWND hwnd;
public
HWND hwndInsertAfter;
public int x;
public int
y;
public int cx;
public int
cy;
public int flags;
}
public struct ACCEL
{
public byte fVirt;
public short
key;
public short cmd;
}
public struct
PAINTSTRUCT
{
public HDC hdc;
public int
fErase;
public RECT rcPaint;
public int
fRestore;
public int
fIncUpdate;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=32)]
public byte rgbReserved;
}
public struct CREATESTRUCT
{
public int lpCreateParams;
public
HANDLE hInstance;
public HANDLE hMenu;
public HWND
hwndParent;
public int cy;
public int
cx;
public int y;
public int
x;
public int style;
public string
lpszName;
public string lpszClass;
public int
ExStyle;
}
public struct CBT_CREATEWND
{
public CREATESTRUCT lpcs;
public HWND
hwndInsertAfter;
}
public struct WINDOWPLACEMENT
{
public int Length;
public int
flags;
public int showCmd;
public POINT
ptMinPosition;
public POINT ptMaxPosition;
public
RECT rcNormalPosition;
}
public struct MEASUREITEMSTRUCT
{
public int CtlType;
public int
CtlID;
public int itemID;
public int
itemWidth;
public int itemHeight;
public int
itemData;
}
public struct DRAWITEMSTRUCT
{
public int CtlType;
public int
CtlID;
public int itemID;
public int
itemAction;
public int itemState;
public HWND
hwndItem;
public HDC hdc;
public RECT
rcItem;
public int itemData;
}
public struct
DELETEITEMSTRUCT
{
public int
CtlType;
public int CtlID;
public int
itemID;
public HWND hwndItem;
public int
itemData;
}
public struct COMPAREITEMSTRUCT
{
public int CtlType;
public int
CtlID;
public HWND hwndItem;
public int
itemID1;
public int itemData1;
public int
itemID2;
public int itemData2;
}
public struct
MSG
{
public HWND hwnd;
public int
message;
public int wParam;
public int
lParam;
public int time;
public POINT
pt;
}
public struct WNDCLASS
{
public
int style;
public int lpfnwndproc;
public int
cbClsextra;
public int cbWndExtra2;
public HANDLE
hInstance;
public HANDLE hIcon;
public HANDLE
hCursor;
public HANDLE hbrBackground;
public
string lpszMenuName;
public string
lpszClassName;
}
public struct DLGTEMPLATE
{
public int style;
public int
dwExtendedStyle;
public short cdit;
public short
x;
public short y;
public short
cx;
public short cy;
}
public struct
DLGITEMTEMPLATE
{
public int
style;
public int dwExtendedStyle;
public short
x;
public short y;
public short
cx;
public short cy;
public short
id;
}
public struct MENUITEMTEMPLATEHEADER
{
public short versionNumber;
public
short offset;
}
public struct MENUITEMTEMPLATE
{
public short mtOption;
public short
mtID;
public byte mtString;
}
public struct
ICONINFO
{
public int fIcon;
public int
xHotspot;
public int yHotspot;
public HANDLE
hbmMask;
public HANDLE hbmColor;
}
public
struct MDICREATESTRUCT
{
public string
szClass;
public string szTitle;
public HWND
hOwner;
public int x;
public int
y;
public int cx;
public int
cy;
public int style;
public int
lParam;
}
public struct CLIENTCREATESTRUCT
{
public HANDLE hWindowMenu;
public int
idFirstChild;
}
public struct MULTIKEYHELP
{
public int mkSize;
public byte
mkKeylist;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=253)]
public string szKeyphrase;
}
public struct HELPWININFO
{
public int wStructSize;
public int
x;
public int y;
public int
dx;
public int dy;
public int
wMax;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=2)] public
string rgchMember;
}
public struct DDEACK
{
public short bAppReturnCode;
public
short Reserved;
public short fbusy;
public short
fack;
}
public struct DDEADVISE
{
public short Reserved;
public short
fDeferUpd;
public short fAckReq;
public short
cfFormat;
}
public struct DDEDATA
{
public short unused;
public short
fresponse;
public short fRelease;
public short
Reserved;
public short fAckReq;
public short
cfFormat;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=1)]
public byte Value;
}
public struct DDEPOKE
{
public short unused;
public short
fRelease;
public short fReserved;
public short
cfFormat;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=1)]
public byte Value;
}
public struct DDELN
{
public short unused;
public short
fRelease;
public short fDeferUpd;
public short
fAckReq;
public short cfFormat;
}
public struct
DDEUP
{
public short unused;
public
short fAck;
public short fRelease;
public short
fReserved;
public short fAckReq;
public short
cfFormat;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=1)]
public byte rgb;
}
public struct HSZPAIR
{
public HANDLE hszSvc;
public HANDLE
hszTopic;
}
public struct SECURITY_QUALITY_OF_SERVICE
{
public int Length;
public short
Impersonationlevel;
public short
ContextTrackingMode;
public int
EffectiveOnly;
}
public struct CONVCONTEXT
{
public int cb;
public int
wFlags;
public int wCountryID;
public int
iCodePage;
public int dwLangID;
public int
dwSecurity;
public SECURITY_QUALITY_OF_SERVICE
qos;
}
public struct CONVINFO
{
public int cb;
public HANDLE
hUser;
public HANDLE hConvPartner;
public HANDLE
hszSvcPartner;
public HANDLE hszServiceReq;
public
HANDLE hszTopic;
public HANDLE hszItem;
public int
wFmt;
public int wType;
public int
wStatus;
public int wConvst;
public int
wLastError;
public HANDLE hConvList;
public
CONVCONTEXT ConvCtxt;
public HWND hwnd;
public
HWND hwndPartner;
}
public struct DDEML_MSG_HOOK_DATA
{
public int uiLo;
public int
uiHi;
public int cbData;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=8)] public int
Data;
}
public struct MONMSGSTRUCT
{
public int cb;
public HWND
hwndTo;
public int dwTime;
public HANDLE
htask;
public int wMsg;
public int
wParam;
public int lParam;
public
DDEML_MSG_HOOK_DATA dmhd;
}
public struct MONCBSTRUCT
{
public int cb;
public int
dwTime;
public HANDLE htask;
public int
dwRet;
public int wType;
public int
wFmt;
public HANDLE hConv;
public HANDLE
hsz1;
public HANDLE hsz2;
public HANDLE
hData;
public int dwData1;
public int
dwData2;
public CONVCONTEXT cc;
public int
cbData;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=8)]
public int Data;
}
public struct MONHSZSTRUCT
{
public int cb;
public int fsAction;
public int dwTime;
public HANDLE
hsz;
public HANDLE htask;
public byte
str;
}
public struct MONERRSTRUCT
{
public int cb;
public int
wLastError;
public int dwTime;
public HANDLE
htask;
}
public struct MONLINKSTRUCT
{
public int cb;
public int
dwTime;
public HANDLE htask;
public int
fEstablished;
public int fNoData;
public HANDLE
hszSvc;
public HANDLE hszTopic;
public HANDLE
hszItem;
public int wFmt;
public int
fServer;
public HANDLE hConvServer;
public HANDLE
hConvClient;
}
public struct MONCONVSTRUCT
{
public int cb;
public int
fConnect;
public int dwTime;
public HANDLE
htask;
public HANDLE hszSvc;
public HANDLE
hszTopic;
public HANDLE hConvClient;
public
HANDLE hConvServer;
}
public struct DRAWTEXTPARAMS
{
public int cbSize;
public int
iTabLength;
public int iLeftMargin;
public int
iRightMargin;
public int
uiLengthDrawn;
}
public struct MENUITEMINFO
{
public int cbSize;
public int
fMask;
public int fType;
public int
fState;
public int wID;
public HANDLE
hSubMenu;
public HANDLE hbmpChecked;
public HANDLE
hbmpUnchecked;
public int dwItemData;
public
string dwTypeData;
public int cch;
}
public
struct SCROLLINFO
{
public int
cbSize;
public int fMask;
public int
nMin;
public int nMax;
public int
nPage;
public int nPos;
public int
nTrackPos;
}
public struct MSGBOXPARAMS
{
public int cbSize;
public HWND
hwndOwner;
public HANDLE hInstance;
public string
lpszText;
public string lpszCaption;
public int
dwStyle;
public string lpszIcon;
public int
dwContextHelpId;
public int
lpfnMsgBoxCallback;
public int
dwLanguageId;
}
public struct WNDCLASSEX
{
public int cbSize;
public int
style;
public int lpfnWndProc;
public int
cbClsExtra;
public int cbWndExtra;
public HANDLE
hInstance;
public HANDLE hIcon;
public HANDLE
hCursor;
public HANDLE hbrBackground;
public
string lpszMenuName;
public string
lpszClassName;
public HANDLE hIconSm;
}
public
struct TPMPARAMS
{
public int
cbSize;
public RECT rcExclude;
}
public struct
BROWSEINFO
{
public HWND
hwndOwner;
public int pIDLRoot;
public int
pszDisplayName;
public int lpszTitle;
public int
ulFlags;
public int lpfnCallback;
public int
lParam;
public int iImage;
}
 public abstract class
ComCtl
{
[DllImport("COMCTL32")] public static extern
int ImageList_AddIcon(HANDLE himl, HANDLE
hIcon);
[DllImport("COMCTL32")] public static extern int
ImageList_Create(int MinCx, int MinCy, int flags, int cInitial, int
cGrow);
[DllImport("COMCTL32")] public static extern int
ImageList_Draw(HANDLE hIMAGELIST, int ImgIndex, HWND hdcDest, int xDest, int
yDest, int lStyle);
[DllImport("COMCTL32")] public static extern
int ImageList_GetIcon(HANDLE hIMAGELIST, int ImgIndex, HANDLE
hbmMask);
[DllImport("COMCTL32")] public static extern int
InitCommonControls();
}
 public abstract class
Ole
{
[DllImport("ole32")] public static extern int
OleInitialize(IntPtr vbNullString);
[DllImport("ole32")] public
static extern void CoTaskMemFree(HANDLE
hMem);
[DllImport("ole32")] public static extern void
OleUninitialize();
}

public class
User
{
[DllImport("advapi32")] public static extern int
SetServiceBits(HANDLE hServiceStatus, int dwServiceBits, int bSetBitsOn, int
bUpdateImmediately);
[DllImport("kernel32")] public static extern
int SetSystemTimeAdjustment(int dwTimeAdjustment, int
bTimeAdjustmentDisabled);
[DllImport("mpr")] public static extern
int WNetGetUniversalName(string lpLocalPath, int dwInfoLevel, StringBuilder
lpBuffer, ref int lpBufferSize);
[DllImport("user32")] public
static extern int ActivateKeyboardLayout(HANDLE hKL, int
flags);
[DllImport("user32")] public static extern int
AdjustWindowRect(ref RECT lpRect, int dwStyle, int
bMenu);
[DllImport("user32")] public static extern int
AdjustWindowRectEx(ref RECT lpRect, int dsStyle, int bMenu, int
dwEsStyle);
[DllImport("user32")] public static extern int
AnyPopup();
[DllImport("user32")] public static extern int
AppendMenu(HANDLE hMenu, int wFlags, int wIDNewItem, IntPtr
lpNewItem);
[DllImport("user32")] public static extern int
ArrangeIconicWindows(HWND hwnd);
[DllImport("user32")] public
static extern int AttachThreadInput(int idAttach, int idAttachTo, int
fAttach);
[DllImport("user32")] public static extern int
BeginDeferWindowPos(int nNumWindows);
[DllImport("user32")]
public static extern int BeginPaint(HWND hwnd, ref PAINTSTRUCT
lpPaint);
[DllImport("user32")] public static extern int
BringWindowToTop(HWND hwnd);
[DllImport("user32")] public static
extern int BroadcastSystemMessage(int dw, ref int pdw, int un, int wParam, int
lParam);
[DllImport("user32")] public static extern int
CallMsgFilter(ref MSG lpMsg, int ncode);
[DllImport("user32")]
public static extern int CallNextHookEx(HANDLE hHook, int ncode, int wParam,
IntPtr lParam);
[DllImport("user32")] public static extern int
CallWindowProc(int lpPrevWndFunc, HWND hwnd, int Msg, int wParam, int
lParam);
[DllImport("user32")] public static extern int
ChangeClipboardChain(HWND hwnd, HWND
hwndNext);
[DllImport("user32")] public static extern int
ChangeMenu(HANDLE hMenu, int cmd, string lpszNewItem, int cmdInsert, int
flags);
[DllImport("user32")] public static extern int
CharLowerBuff(string lpsz, int cchLength);
[DllImport("user32")]
public static extern int CharToOem(string lpszSrc, string
lpszDst);
[DllImport("user32")] public static extern int
CharToOemBuff(string lpszSrc, string lpszDst, int
cchDstLength);
[DllImport("user32")] public static extern int
CharUpperBuff(string lpsz, int cchLength);
[DllImport("user32")]
public static extern int CheckDlgButton(HANDLE hDlg, int nIDButton, int
wCheck);
[DllImport("user32")] public static extern int
CheckMenuItem(HANDLE hMenu, int wIDCheckItem, int
wCheck);
[DllImport("user32")] public static extern int
CheckMenuRadioItem(HANDLE hMenu, int un1, int un2, int un3, int
un4);
[DllImport("user32")] public static extern int
CheckRadioButton(HANDLE hDlg, int nIDFirstButton, int nIDLastButton, int
nIDCheckButton);
[DllImport("user32")] public static extern int
ChildWindowFromPoint(HWND hwnd, int xPoint, int
yPoint);
[DllImport("user32")] public static extern int
ChildWindowFromPointEx(HWND hwnd, int xPoint, int yPoint, int
un);
[DllImport("user32")] public static extern int
ClientToScreen(HWND hwnd, ref POINT
lpPoint);
[DllImport("user32")] public static extern int
ClipCursor(ref RECT lpRect);
[DllImport("user32")] public static
extern int CloseClipboard();
[DllImport("user32")] public static
extern int CloseDesktop(HANDLE hDesktop);
[DllImport("user32")]
public static extern int CloseWindow(HWND
hwnd);
[DllImport("user32")] public static extern int
CloseWindowStation(HANDLE hWinSta);
[DllImport("user32")] public
static extern int CopyAcceleratorTable(HANDLE hAccelSrc, ACCEL[] lpAccelDst, int
cAccelEntries);
[DllImport("user32")] public static extern int
CopyCursor(HANDLE hcur);
[DllImport("user32")] public static
extern int CopyIcon(HANDLE hIcon);
[DllImport("user32")] public
static extern int CopyImage(HANDLE handle, int un1, int n1, int n2, int
un2);
[DllImport("user32")] public static extern int CopyRect(ref
RECT lpDestRect, ref RECT lpSourceRect);
[DllImport("user32")]
public static extern int
CountClipboardFormats();
[DllImport("user32")] public static
extern int CreateAcceleratorTable(ref ACCEL lpaccl, int
cEntries);
[DllImport("user32")] public static extern int
CreateCaret(HWND hwnd, HANDLE hBitmap, int nWidth, int
nHeight);
[DllImport("user32")] public static extern int
CreateCursor(HANDLE hInstance, int nXhotspot, int nYhotspot, int nWidth, int
nHeight, IntPtr lpANDbitPlane, IntPtr
lpXORbitPlane);
[DllImport("user32")] public static extern int
CreateDesktop(string lpszDesktop, string lpszDevice, ref DEVMODE pDevmode, int
dwFlags, int dwDesiredAccess, ref SECURITY_ATTRIBUTES
lpsa);
[DllImport("user32")] public static extern int
CreateDialogIndirectParam(HANDLE hInstance, ref DLGTEMPLATE lpTemplate, HWND
hwndParent, ref int lpDialogFunc, int
dwInitParam);
[DllImport("user32")] public static extern int
CreateDialogParam(HANDLE hInstance, string lpName, HWND hwndParent, ref int
lpDialogFunc, int lParamInit);
[DllImport("user32")] public
static extern int CreateIcon(HANDLE hInstance, int nWidth, int nHeight, Byte
nPlanes, Byte nBitsPixel, Byte lpANDbits, Byte
lpXORbits);
[DllImport("user32")] public static extern int
CreateIconFromResource(Byte presbits, int dwResSize, int fIcon, int
dwVer);
[DllImport("user32")] public static extern int
CreateIconIndirect(ref ICONINFO piconinfo);
[DllImport("user32")]
public static extern int CreateMDIWindow(string lpClassName, string
lpWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, HWND
hwndParent, HANDLE hInstance, int lParam);
[DllImport("user32")]
public static extern int CreateMenu();
[DllImport("user32")]
public static extern int CreatePopupMenu();
[DllImport("user32")]
public static extern int CreateWindowEx(int dwExStyle, string lpClassName,
string lpWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, HWND
hwndParent, HANDLE hMenu, HANDLE hInstance, IntPtr
lpParam);
[DllImport("user32")] public static extern int
DdeAbandonTransaction(int idInst, HANDLE hConv, int
idTransaction);
[DllImport("user32")] public static extern int
DdeAccessData(HANDLE hData, ref int
pcbDataSize);
[DllImport("user32")] public static extern int
DdeAddData(HANDLE hData, Byte pSrc, int cb, int
cbOff);
[DllImport("user32")] public static extern int
DdeClientTransaction(Byte pData, int cbData, HANDLE hConv, HANDLE hszItem, int
wFmt, int wType, int dwTimeout, ref int
pdwResult);
[DllImport("user32")] public static extern int
DdeCmpStringHandles(HANDLE hsz1, HANDLE
hsz2);
[DllImport("user32")] public static extern int
DdeConnect(int idInst, HANDLE hszService, HANDLE hszTopic, ref CONVCONTEXT
pCC);
[DllImport("user32")] public static extern int
DdeConnectList(int idInst, HANDLE hszService, HANDLE hszTopic, HANDLE hConvList,
ref CONVCONTEXT pCC);
[DllImport("user32")] public static extern
int DdeCreateDataHandle(int idInst, Byte pSrc, int cb, int cbOff, HANDLE
hszItem, int wFmt, int afCmd);
[DllImport("user32")] public
static extern int DdeCreateStringHandle(int idInst, string psz, int
iCodePage);
[DllImport("user32")] public static extern int
DdeDisconnect(HANDLE hConv);
[DllImport("user32")] public static
extern int DdeDisconnectList(HANDLE
hConvList);
[DllImport("user32")] public static extern int
DdeEnableCallback(int idInst, HANDLE hConv, int
wCmd);
[DllImport("user32")] public static extern int
DdeFreeDataHandle(HANDLE hData);
[DllImport("user32")] public
static extern int DdeFreeStringHandle(int idInst, HANDLE
hsz);
[DllImport("user32")] public static extern int
DdeGetData(HANDLE hData, Byte pDst, int cbMax, int
cbOff);
[DllImport("user32")] public static extern int
DdeGetLastError(int idInst);
[DllImport("user32")] public static
extern int DdeImpersonateClient(HANDLE
hConv);
[DllImport("user32")] public static extern int
DdeKeepStringHandle(int idInst, HANDLE
hsz);
[DllImport("user32")] public static extern int
DdeNameService(int idInst, HANDLE hsz1, HANDLE hsz2, int
afCmd);
[DllImport("user32")] public static extern int
DdePostAdvise(int idInst, HANDLE hszTopic, HANDLE
hszItem);
[DllImport("user32")] public static extern int
DdeQueryConvInfo(HANDLE hConv, int idTransaction, ref CONVINFO
pConvInfo);
[DllImport("user32")] public static extern int
DdeQueryNextServer(HANDLE hConvList, HANDLE
hConvPrev);
[DllImport("user32")] public static extern int
DdeQueryString(int idInst, HANDLE hsz, string psz, int cchMax, int
iCodePage);
[DllImport("user32")] public static extern int
DdeReconnect(HANDLE hConv);
[DllImport("user32")] public static
extern int DdeSetQualityOfService(HWND hwndClient, ref
SECURITY_QUALITY_OF_SERVICE pqosNew, ref SECURITY_QUALITY_OF_SERVICE
pqosPrev);
[DllImport("user32")] public static extern int
DdeSetUserHandle(HANDLE hConv, int id, HANDLE
hUser);
[DllImport("user32")] public static extern int
DdeUnaccessData(HANDLE hData);
[DllImport("user32")] public
static extern int DdeUninitialize(int
idInst);
[DllImport("user32")] public static extern int
DefDlgProc(HANDLE hDlg, int wMsg, int wParam, int
lParam);
[DllImport("user32")] public static extern int
DefFrameProc(HWND hwnd, HWND hwndMDIClient, int wMsg, int wParam, int
lParam);
[DllImport("user32")] public static extern int
DefMDIChildProc(HWND hwnd, int wMsg, int wParam, int
lParam);
[DllImport("user32")] public static extern int
DefWindowProc(HWND hwnd, int wMsg, int wParam, int
lParam);
[DllImport("user32")] public static extern int
DeferWindowPos(HANDLE hWinPosInfo, HWND hwnd, HWND hwndInsertAfter, int x, int
y, int cx, int cy, int wFlags);
[DllImport("user32")] public
static extern int DeleteMenu(HANDLE hMenu, int nPosition, int
wFlags);
[DllImport("user32")] public static extern int
DestroyAcceleratorTable(HANDLE haccel);
[DllImport("user32")]
public static extern int DestroyCaret();
[DllImport("user32")]
public static extern int DestroyCursor(HANDLE
hCursor);
[DllImport("user32")] public static extern int
DestroyIcon(HANDLE hIcon);
[DllImport("user32")] public static
extern int DestroyMenu(HANDLE hMenu);
[DllImport("user32")]
public static extern int DestroyWindow(HWND
hwnd);
[DllImport("user32")] public static extern int
DialogBoxIndirectParam(HANDLE hInstance, DLGTEMPLATE hDialogTemplate, HWND
hwndParent, ref int lpDialogFunc, int
dwInitParam);
[DllImport("user32")] public static extern int
DispatchMessage(ref MSG lpMsg);
[DllImport("user32")] public
static extern int DlgDirList(HANDLE hDlg, string lpPathSpec, int nIDListBox, int
nIDStaticPath, int wFileType);
[DllImport("user32")] public
static extern int DlgDirListComboBox(HANDLE hDlg, string lpPathSpec, int
nIDComboBox, int nIDStaticPath, int
wFileType);
[DllImport("user32")] public static extern int
DlgDirSelectComboBoxEx(HWND hwndDlg, string lpszPath, int cbPath, int
idComboBox);
[DllImport("user32")] public static extern int
DlgDirSelectEx(HWND hwndDlg, string lpszPath, int cbPath, int
idListBox);
[DllImport("user32")] public static extern int
DragDetect(HWND hwnd, POINT pt);
[DllImport("user32")] public
static extern int DragObject(HWND hwnd1, HWND hwnd2, int un, int dw, HANDLE
hCursor);
[DllImport("user32")] public static extern int
DrawAnimatedRects(HWND hwnd, int idAni, ref RECT lprcFrom, ref RECT
lprcTo);
[DllImport("user32")] public static extern int
DrawCaption(HWND hwnd, HWND hdc, ref RECT pcRect, int
un);
[DllImport("user32")] public static extern int DrawEdge(HDC
hdc, ref RECT qrc, int edge, int grfFlags);
[DllImport("user32")]
public static extern int DrawFocusRect(HDC hdc, ref RECT
lpRect);
[DllImport("user32")] public static extern int
DrawFrameControl(HWND hdc, ref RECT lpRect, int un1, int
un2);
[DllImport("user32")] public static extern int DrawIcon(HDC
hdc, int x, int y, HANDLE hIcon);
[DllImport("user32")] public
static extern int DrawIconEx(HDC hdc, int xLeft, int yTop, HANDLE hIcon, int
cxWidth, int cyWidth, int istepIfAniCur, HANDLE hbrFlickerFreeDraw, int
diFlags);
[DllImport("user32")] public static extern int
DrawMenuBar(HWND hwnd);
[DllImport("user32")] public static
extern int DrawState(HWND hdc, HANDLE hBrush, ref int lpDrawStateProc, int
lParam, int wParam, int n1, int n2, int n3, int n4, int
un);
[DllImport("user32")] public static extern int DrawText(HDC
hdc, string lpStr, int nCount, ref RECT lpRect, int
wFormat);
[DllImport("user32")] public static extern int
DrawTextEx(HWND hdc, string lpsz, int n, ref RECT lpRect, int un, ref
DRAWTEXTPARAMS lpDrawTextParams);
[DllImport("user32")] public
static extern int EmptyClipboard();
[DllImport("user32")] public
static extern int EnableMenuItem(HANDLE hMenu, int wIDEnableItem, int
wEnable);
[DllImport("user32")] public static extern int
EnableScrollBar(HWND hwnd, int wSBflags, int
wArrows);
[DllImport("user32")] public static extern int
EnableWindow(HWND hwnd, int fEnable);
[DllImport("user32")]
public static extern int EndDeferWindowPos(HANDLE
hWinPosInfo);
[DllImport("user32")] public static extern int
EndDialog(HANDLE hDlg, int nResult);
[DllImport("user32")] public
static extern int EndPaint(HWND hwnd, ref PAINTSTRUCT
lpPaint);
[DllImport("user32")] public static extern int
EnumChildWindows(HWND hwndParent, ref int lpEnumFunc, int
lParam);
[DllImport("user32")] public static extern int
EnumClipboardFormats(int wFormat);
[DllImport("user32")] public
static extern int EnumDesktopWindows(HANDLE hDesktop, ref int lpfn, int
lParam);
[DllImport("user32")] public static extern int
EnumDesktops(HANDLE hwinsta, ref int lpEnumFunc, int
lParam);
[DllImport("user32")] public static extern int
EnumProps(HWND hwnd, ref int lpEnumFunc);
[DllImport("user32")]
public static extern int EnumPropsEx(HWND hwnd, ref int lpEnumFunc, int
lParam);
[DllImport("user32")] public static extern int
EnumThreadWindows(int dwThreadId, ref int lpfn, int
lParam);
[DllImport("user32")] public static extern int
EnumWindowStations(int lpEnumFunc, int
lParam);
[DllImport("user32")] public static extern int
EnumWindows(int lpEnumFunc, int lParam);
[DllImport("user32")]
public static extern int EqualRect(ref RECT lpRect1, ref RECT
lpRect2);
[DllImport("user32")] public static extern int
ExcludeUpdateRgn(HDC hdc, HWND hwnd);
[DllImport("user32")]
public static extern int ExitWindows(int dwReserved, int
uReturnCode);
[DllImport("user32")] public static extern int
ExitWindowsEx(int uFlags, int dwReserved);
[DllImport("user32")]
public static extern int FillRect(HDC hdc, ref RECT lpRect, HANDLE
hBrush);
[DllImport("user32")] public static extern int
FindWindow(string lpClassName, string
lpWindowName);
[DllImport("user32")] public static extern int
FindWindowEx(HWND hwnd1, HWND hwnd2, string lpsz1, string
lpsz2);
[DllImport("user32")] public static extern int
FlashWindow(HWND hwnd, int bInvert);
[DllImport("user32")] public
static extern int FrameRect(HDC hdc, ref RECT lpRect, HANDLE
hBrush);
[DllImport("user32")] public static extern int
FreeDDElParam(int msg, int lParam);
[DllImport("user32")] public
static extern int GetActiveWindow();
[DllImport("user32")] public
static extern int GetCapture();
[DllImport("user32")] public
static extern int GetCaretBlinkTime();
[DllImport("user32")]
public static extern int GetCaretPos(ref POINT
lpPoint);
[DllImport("user32")] public static extern int
GetClassInfo(HANDLE hInstance, string lpClassName, out WNDCLASS
lpWndClass);
[DllImport("user32")] public static extern int
GetClassLong(HWND hwnd, int nIndex);
[DllImport("user32")] public
static extern int GetClassName(HWND hwnd, string lpClassName, int
nMaxCount);
[DllImport("user32")] public static extern int
GetClassWord(HWND hwnd, int nIndex);
[DllImport("user32")] public
static extern int GetClientRect(HWND hwnd, ref RECT
lpRect);
[DllImport("user32")] public static extern int
GetClipCursor(out RECT lprc);
[DllImport("user32")] public static
extern int GetClipboardData(int wFormat);
[DllImport("user32")]
public static extern int GetClipboardFormatName(int wFormat, string lpString,
int nMaxCount);
[DllImport("user32")] public static extern int
GetClipboardOwner();
[DllImport("user32")] public static extern
int GetClipboardViewer();
[DllImport("user32")] public static
extern int GetCursor();
[DllImport("user32")] public static
extern int GetCursorPos(out POINT lpPoint);
[DllImport("user32")]
public static extern int GetDC(HWND hwnd);
[DllImport("user32")]
public static extern int GetDCEx(HWND hwnd, HANDLE hrgnclip, int
fdwOptions);
[DllImport("user32")] public static extern int
GetDesktopWindow();
[DllImport("user32")] public static extern
int GetDialogBaseUnits();
[DllImport("user32")] public static
extern int GetDlgCtrlID(HWND hwnd);
[DllImport("user32")] public
static extern int GetDlgItem(HANDLE hDlg, int
nIDDlgItem);
[DllImport("user32")] public static extern int
GetDlgItemInt(HANDLE hDlg, int nIDDlgItem, ref int lpTranslated, int
bSigned);
[DllImport("user32")] public static extern int
GetDlgItemText(HANDLE hDlg, int nIDDlgItem, StringBuilder lpString, int
nMaxCount);
[DllImport("user32")] public static extern int
GetDoubleClickTime();
[DllImport("user32")] public static extern
int GetFocus();
[DllImport("user32")] public static extern int
GetForegroundWindow();
[DllImport("user32")] public static extern
int GetIconInfo(HANDLE hIcon, out ICONINFO
piconinfo);
[DllImport("user32")] public static extern int
GetInputState();
[DllImport("user32")] public static extern int
GetKBCodePage();
[DllImport("user32")] public static extern int
GetKeyNameText(int lParam, StringBuilder lpBuffer, int
nSize);
[DllImport("user32")] public static extern int
GetKeyboardLayout(int dwLayout);
[DllImport("user32")] public
static extern int GetKeyboardLayoutList(int nBuff, ref int
lpList);
[DllImport("user32")] public static extern int
GetKeyboardLayoutName(string pwszKLID);
[DllImport("user32")]
public static extern int GetKeyboardState(Byte
pbKeyState);
[DllImport("user32")] public static extern int
GetKeyboardType(int nTypeFlag);
[DllImport("user32")] public
static extern int GetLastActivePopup(HWND
hwndOwnder);
[DllImport("user32")] public static extern int
GetMenu(HWND hwnd);
[DllImport("user32")] public static extern
int GetMenuCheckMarkDimensions();
[DllImport("user32")] public
static extern int GetMenuContextHelpId(HANDLE
hMenu);
[DllImport("user32")] public static extern int
GetMenuDefaultItem(HANDLE hMenu, int fByPos, int
gmdiFlags);
[DllImport("user32")] public static extern int
GetMenuItemCount(HANDLE hMenu);
[DllImport("user32")] public
static extern int GetMenuItemID(HANDLE hMenu, int
nPos);
[DllImport("user32")] public static extern int
GetMenuItemInfo(HANDLE hMenu, int un, int b, ref MENUITEMINFO
lpMenuItemInfo);
[DllImport("user32")] public static extern int
GetMenuItemRect(HWND hwnd, HANDLE hMenu, int uItem, ref RECT
lprcItem);
[DllImport("user32")] public static extern int
GetMenuState(HANDLE hMenu, int wID, int
wFlags);
[DllImport("user32")] public static extern int
GetMenuString(HANDLE hMenu, int wIDItem, StringBuilder lpString, int nMaxCount,
int wFlag);
[DllImport("user32")] public static extern int
GetMessage(ref MSG lpMsg, HWND hwnd, int wMsgFilterMin, int
wMsgFilterMax);
[DllImport("user32")] public static extern int
GetMessageExtraInfo();
[DllImport("user32")] public static extern
int GetMessagePos();
[DllImport("user32")] public static extern
int GetMessageTime();
[DllImport("user32")] public static extern
int GetNextDlgGroupItem(HANDLE hDlg, HANDLE hCtl, int
bPrevious);
[DllImport("user32")] public static extern int
GetNextDlgTabItem(HANDLE hDlg, HANDLE hCtl, int
bPrevious);
[DllImport("user32")] public static extern int
GetNextWindow(HWND hwnd, int wFlag);
[DllImport("user32")] public
static extern int GetOpenClipboardWindow();
[DllImport("user32")]
public static extern int GetParent(HWND
hwnd);
[DllImport("user32")] public static extern int
GetPriorityClipboardFormat(int lpPriorityList, int
nCount);
[DllImport("user32")] public static extern int
GetProcessWindowStation();
[DllImport("user32")] public static
extern int GetProp(HWND hwnd, string
lpString);
[DllImport("user32")] public static extern int
GetQueueStatus(int fuFlags);
[DllImport("user32")] public static
extern int GetScrollInfo(HWND hwnd, int n, ref SCROLLINFO
lpScrollInfo);
[DllImport("user32")] public static extern int
GetScrollPos(HWND hwnd, int nBar);
[DllImport("user32")] public
static extern int GetScrollRange(HWND hwnd, int nBar, ref int lpMinPos, ref int
lpMaxPos);
[DllImport("user32")] public static extern int
GetSubMenu(HANDLE hMenu, int nPos);
[DllImport("user32")] public
static extern int GetSysColor(int nIndex);
[DllImport("user32")]
public static extern int GetSysColorBrush(int
nIndex);
[DllImport("user32")] public static extern int
GetSystemMenu(HWND hwnd, int bRevert);
[DllImport("user32")]
public static extern int GetSystemMetrics(int
nIndex);
[DllImport("user32")] public static extern int
GetTabbedTextExtent(HDC hdc, string lpString, int nCount, int nTabPositions, ref
int lpnTabStopPositions);
[DllImport("user32")] public static
extern int GetThreadDesktop(int dwThread);
[DllImport("user32")]
public static extern int GetTopWindow(HWND
hwnd);
[DllImport("user32")] public static extern int
GetUpdateRect(HWND hwnd, ref RECT lpRect, int
bErase);
[DllImport("user32")] public static extern int
GetUpdateRgn(HWND hwnd, HANDLE hRgn, int
fErase);
[DllImport("user32")] public static extern int
GetUserObjectInformation(HANDLE hObj, int nIndex, IntPtr pvInfo, int nLength,
ref int lpnLengthNeeded);
[DllImport("user32")] public static
extern int GetUserObjectSecurity(HANDLE hObj, ref int pSIRequested, ref
SECURITY_DESCRIPTOR pSd, int nLength, ref int
lpnLengthNeeded);
[DllImport("user32")] public static extern int
GetWindow(HWND hwnd, int wCmd);
[DllImport("user32")] public
static extern int GetWindowContextHelpId(HWND
hwnd);
[DllImport("user32")] public static extern int
GetWindowDC(HWND hwnd);
[DllImport("user32")] public static
extern int GetWindowLong(HWND hwnd, int
nIndex);
[DllImport("user32")] public static extern int
GetWindowPlacement(HWND hwnd, ref WINDOWPLACEMENT
lpwndpl);
[DllImport("user32")] public static extern int
GetWindowRect(HWND hwnd, ref RECT lpRect);
[DllImport("user32")]
public static extern int GetWindowRgn(HWND hwnd, HANDLE
hRgn);
[DllImport("user32")] public static extern int
GetWindowText(HWND hwnd, StringBuilder lpString, int
cch);
[DllImport("user32")] public static extern int
GetWindowTextLength(HWND hwnd);
[DllImport("user32")] public
static extern int GetWindowThreadProcessId(HWND hwnd, ref int
lpdwProcessId);
[DllImport("user32")] public static extern int
GrayString(HWND hdc, HANDLE hBrush, ref int lpOutputFunc, ref int lpData, int
nCount, int X, int Y, int nWidth, int
nHeight);
[DllImport("user32")] public static extern int
HideCaret(HWND hwnd);
[DllImport("user32")] public static extern
int HiliteMenuItem(HWND hwnd, HANDLE hMenu, int wIDHiliteItem, int
wHilite);
[DllImport("user32")] public static extern int
ImpersonateDdeClientWindow(HWND hwndClient, HWND
hwndServer);
[DllImport("user32")] public static extern int
InSendMessage();
[DllImport("user32")] public static extern int
InflateRect(ref RECT lpRect, int x, int y);
[DllImport("user32")]
public static extern int InsertMenu(HANDLE hMenu, int nPosition, int wFlags, int
wIDNewItem, IntPtr lpNewItem);
[DllImport("user32")] public
static extern int InsertMenuItem(HANDLE hMenu, int un, bool b, ref MENUITEMINFO
lpcMenuItemInfo);
[DllImport("user32")] public static extern int
IntersectRect(ref RECT lpDestRect, ref RECT lpSrc1Rect, ref RECT
lpSrc2Rect);
[DllImport("user32")] public static extern int
InvalidateRect(HWND hwnd, ref RECT lpRect, int
bErase);
[DllImport("user32")] public static extern int
InvalidateRgn(HWND hwnd, HANDLE hRgn, int
bErase);
[DllImport("user32")] public static extern int
InvertRect(HDC hdc, ref RECT lpRect);
[DllImport("user32")]
public static extern int IsCharAlpha(Byte
cChar);
[DllImport("user32")] public static extern int
IsCharAlphaNumeric(Byte cChar);
[DllImport("user32")] public
static extern int IsCharLower(Byte cChar);
[DllImport("user32")]
public static extern int IsCharUpper(Byte
cChar);
[DllImport("user32")] public static extern int
IsChild(HWND hwndParent, HWND hwnd);
[DllImport("user32")] public
static extern int IsClipboardFormatAvailable(int
wFormat);
[DllImport("user32")] public static extern int
IsDialogMessage(HANDLE hDlg, ref MSG
lpMsg);
[DllImport("user32")] public static extern int
IsDlgButtonChecked(HANDLE hDlg, int
nIDButton);
[DllImport("user32")] public static extern int
IsIconic(HWND hwnd);
[DllImport("user32")] public static extern
int IsMenu(HANDLE hMenu);
[DllImport("user32")] public static
extern int IsRectEmpty(ref RECT lpRect);
[DllImport("user32")]
public static extern int IsWindow(HWND
hwnd);
[DllImport("user32")] public static extern int
IsWindowEnabled(HWND hwnd);
[DllImport("user32")] public static
extern int IsWindowUnicode(HWND hwnd);
[DllImport("user32")]
public static extern int IsWindowVisible(HWND
hwnd);
[DllImport("user32")] public static extern int
IsZoomed(HWND hwnd);
[DllImport("user32")] public static extern
int KillTimer(HWND hwnd, int nIDEvent);
[DllImport("user32")]
public static extern int LoadAccelerators(HANDLE hInstance, string
lpTableName);
[DllImport("user32")] public static extern int
LoadBitmap(HANDLE hInstance, string
lpBitmapName);
[DllImport("user32")] public static extern int
LoadCursor(HANDLE hInstance, string
lpCursorName);
[DllImport("user32")] public static extern int
LoadCursorFromFile(string lpFileName);
[DllImport("user32")]
public static extern int LoadIcon(HANDLE hInstance, string
lpIconName);
[DllImport("user32")] public static extern int
LoadImage(HANDLE hInst, string lpsz, int un1, int n1, int n2, int
un2);
[DllImport("user32")] public static extern int
LoadKeyboardLayout(string pwszKLID, int
flags);
[DllImport("user32")] public static extern int
LoadMenu(HANDLE hInstance, string
lpString);
[DllImport("user32")] public static extern int
LoadMenuIndirect(int lpMenuTemplate);
[DllImport("user32")]
public static extern int LoadString(HANDLE hInstance, int wID, string lpBuffer,
int nBufferMax);
[DllImport("user32")] public static extern int
LockWindowUpdate(HWND hwndLock);
[DllImport("user32")] public
static extern int LookupIconIdFromDirectory(Byte presbits, int
fIcon);
[DllImport("user32")] public static extern int
LookupIconIdFromDirectoryEx(Byte presbits, int fIcon, int cxDesired, int
cyDesired, int Flags);
[DllImport("user32")] public static extern
int MapDialogRect(HANDLE hDlg, ref RECT
lpRect);
[DllImport("user32")] public static extern int
MapVirtualKey(int wCode, int wMapType);
[DllImport("user32")]
public static extern int MapVirtualKeyEx(int uCode, int uMapType, int
dwhkl);
[DllImport("user32")] public static extern int
MapWindowPoints(HWND hwndFrom, HWND hwndTo, POINT [] lppt, int
cPoints);
[DllImport("user32")] public static extern int
MenuItemFromPoint(HWND hwnd, HANDLE hMenu, POINT
ptScreen);
[DllImport("user32")] public static extern int
MessageBeep(int wType);
[DllImport("user32")] public static
extern int MessageBox(HWND hwnd, string lpText, string lpCaption, int
wType);
[DllImport("user32")] public static extern int
MessageBoxEx(HWND hwnd, string lpText, string lpCaption, int uType, int
wLanguageId);
[DllImport("user32")] public static extern int
MessageBoxIndirect(ref MSGBOXPARAMS
lpMsgBoxParams);
[DllImport("user32")] public static extern int
ModifyMenu(HANDLE hMenu, int nPosition, int wFlags, int wIDNewItem, IntPtr
lpString);
[DllImport("user32")] public static extern int
MoveWindow(HWND hwnd, int x, int y, int nWidth, int nHeight, int
bRepaint);
[DllImport("user32")] public static extern int
MsgWaitForMultipleObjects(int nCount, ref int pHandles, int fWaitAll, int
dwMilliseconds, int dwWakeMask);
[DllImport("user32")] public
static extern int OemKeyScan(int wOemChar);
[DllImport("user32")]
public static extern int OemToChar(string lpszSrc, string
lpszDst);
[DllImport("user32")] public static extern int
OemToCharBuff(string lpszSrc, string lpszDst, int
cchDstLength);
[DllImport("user32")] public static extern int
OffsetRect(ref RECT lpRect, int x, int y);
[DllImport("user32")]
public static extern int OpenClipboard(HWND
hwnd);
[DllImport("user32")] public static extern int
OpenDesktop(string lpszDesktop, int dwFlags, int fInherit, int
dwDesiredAccess);
[DllImport("user32")] public static extern int
OpenIcon(HWND hwnd);
[DllImport("user32")] public static extern
int OpenInputDesktop(int dwFlags, int fInherit, int
dwDesiredAccess);
[DllImport("user32")] public static extern int
OpenWindowStation(string lpszWinSta, int fInherit, int
dwDesiredAccess);
[DllImport("user32")] public static extern int
PackDDElParam(int msg, int uiLo, int uiHi);
[DllImport("user32")]
public static extern int PaintDesktop(HDC
hdc);
[DllImport("user32")] public static extern int
PeekMessage(ref MSG lpMsg, HWND hwnd, int wMsgFilterMin, int wMsgFilterMax, int
wRemoveMsg);
[DllImport("user32")] public static extern int
PostMessage(HWND hwnd, int wMsg, int wParam, int
lParam);
[DllImport("user32")] public static extern int
PostThreadMessage(int idThread, int msg, int wParam, int
lParam);
[DllImport("user32")] public static extern int
PtInRect(ref RECT lpRect, int ptX, int
ptY);
[DllImport("user32")] public static extern int
RedrawWindow(HWND hwnd, ref RECT lprcUpdate, HANDLE hrgnUpdate, int
fuRedraw);
[DllImport("user32")] public static extern int
RegisterClass(ref WNDCLASS Class);
[DllImport("user32")] public
static extern int RegisterClipboardFormat(string
lpString);
[DllImport("user32")] public static extern int
RegisterHotKey(HWND hwnd, int id, int fsModifiers, int
vk);
[DllImport("user32")] public static extern int
RegisterWindowMessage(string lpString);
[DllImport("user32")]
public static extern int ReleaseCapture();
[DllImport("user32")]
public static extern int ReleaseDC(HWND hwnd, HDC
hdc);
[DllImport("user32")] public static extern int
RemoveMenu(HANDLE hMenu, int nPosition, int
wFlags);
[DllImport("user32")] public static extern int
RemoveProp(HWND hwnd, string lpString);
[DllImport("user32")]
public static extern int ReplyMessage(int
lReply);
[DllImport("user32")] public static extern int
ReuseDDElParam(int lParam, int msgIn, int msgOut, int uiLo, int
uiHi);
[DllImport("user32")] public static extern int
ScreenToClient(HWND hwnd, ref POINT
lpPoint);
[DllImport("user32")] public static extern int
ScrollDC(HDC hdc, int dx, int dy, ref RECT lprcScroll, ref RECT lprcClip, HANDLE
hrgnUpdate, ref RECT lprcUpdate);
[DllImport("user32")] public
static extern int ScrollWindow(HWND hwnd, int XAmount, int YAmount, ref RECT
lpRect, ref RECT lpClipRect);
[DllImport("user32")] public static
extern int ScrollWindowEx(HWND hwnd, int dx, int dy, ref RECT lprcScroll, ref
RECT lprcClip, HANDLE hrgnUpdate, ref RECT lprcUpdate, int
fuScroll);
[DllImport("user32")] public static extern int
SendDlgItemMessage(HANDLE hDlg, int nIDDlgItem, int wMsg, int wParam, int
lParam);
[DllImport("user32")] public static extern int
SendMessage(HWND hwnd, int wMsg, int wParam, IntPtr
lParam);
[DllImport("user32")] public static extern int
SendMessageCallback(HWND hwnd, int msg, int wParam, int lParam, ref int
lpResultCallBack, int dwData);
[DllImport("user32")] public
static extern int SendMessageTimeout(HWND hwnd, int msg, int wParam, int lParam,
int fuFlags, int uTimeout, ref int
lpdwResult);
[DllImport("user32")] public static extern int
SendNotifyMessage(HWND hwnd, int msg, int wParam, int
lParam);
[DllImport("user32")] public static extern int
SetActiveWindow(HWND hwnd);
[DllImport("user32")] public static
extern int SetCapture(HWND hwnd);
[DllImport("user32")] public
static extern int SetCaretBlinkTime(int
wMSeconds);
[DllImport("user32")] public static extern int
SetCaretPos(int x, int y);
[DllImport("user32")] public static
extern int SetClassLong(HWND hwnd, int nIndex, int
dwNewLong);
[DllImport("user32")] public static extern int
SetClassWord(HWND hwnd, int nIndex, int
wNewWord);
[DllImport("user32")] public static extern int
SetClipboardData(int wFormat, HANDLE hMem);
[DllImport("user32")]
public static extern int SetClipboardViewer(HWND
hwnd);
[DllImport("user32")] public static extern int
SetCursor(HANDLE hCursor);
[DllImport("user32")] public static
extern int SetCursorPos(int x, int y);
[DllImport("user32")]
public static extern int SetDlgItemInt(HANDLE hDlg, int nIDDlgItem, int wValue,
int bSigned);
[DllImport("user32")] public static extern int
SetDlgItemText(HANDLE hDlg, int nIDDlgItem, string
lpString);
[DllImport("user32")] public static extern int
SetDoubleClickTime(int wCount);
[DllImport("user32")] public
static extern int SetFocus(HWND hwnd);
[DllImport("user32")]
public static extern int SetForegroundWindow(HWND
hwnd);
[DllImport("user32")] public static extern int
SetKeyboardState(Byte lppbKeyState);
[DllImport("user32")] public
static extern int SetMenu(HWND hwnd, HANDLE
hMenu);
[DllImport("user32")] public static extern int
SetMenuContextHelpId(HANDLE hMenu, int dw);
[DllImport("user32")]
public static extern int SetMenuDefaultItem(HANDLE hMenu, int uItem, int
fByPos);
[DllImport("user32")] public static extern int
SetMenuItemBitmaps(HANDLE hMenu, int nPosition, int wFlags, HANDLE
hBitmapUnchecked, HANDLE hBitmapChecked);
[DllImport("user32")]
public static extern int SetMenuItemInfo(HANDLE hMenu, int un, bool b, ref
MENUITEMINFO lpcMenuItemInfo);
[DllImport("user32")] public
static extern int SetMessageExtraInfo(int
lParam);
[DllImport("user32")] public static extern int
SetMessageQueue(int cMessagesMax);
[DllImport("user32")] public
static extern int SetParent(HWND hwndChild, HWND
hwndNewParent);
[DllImport("user32")] public static extern int
SetProcessWindowStation(HANDLE hWinSta);
[DllImport("user32")]
public static extern int SetProp(HWND hwnd, string lpString, HANDLE
hData);
[DllImport("user32")] public static extern int
SetRect(ref RECT lpRect, int X1, int Y1, int X2, int
Y2);
[DllImport("user32")] public static extern int
SetRectEmpty(ref RECT lpRect);
[DllImport("user32")] public
static extern int SetScrollInfo(HWND hwnd, int n, ref SCROLLINFO lpcScrollInfo,
bool redraw);
[DllImport("user32")] public static extern int
SetScrollPos(HWND hwnd, int nBar, int nPos, int
bRedraw);
[DllImport("user32")] public static extern int
SetScrollRange(HWND hwnd, int nBar, int nMinPos, int nMaxPos, int
bRedraw);
[DllImport("user32")] public static extern int
SetSysColors(int nChanges, ref int lpSysColor, ref int
lpColorValues);
[DllImport("user32")] public static extern int
SetSystemCursor(HANDLE hcur, int id);
[DllImport("user32")]
public static extern int SetThreadDesktop(HANDLE
hDesktop);
[DllImport("user32")] public static extern int
SetTimer(HWND hwnd, int nIDEvent, int uElapse, ref int
lpTimerFunc);
[DllImport("user32")] public static extern int
SetUserObjectInformation(HANDLE hObj, int nIndex, IntPtr pvInfo, int
nLength);
[DllImport("user32")] public static extern int
SetUserObjectSecurity(HANDLE hObj, ref int pSIRequested, ref SECURITY_DESCRIPTOR
pSd);
[DllImport("user32")] public static extern int
SetWindowContextHelpId(HWND hwnd, int dw);
[DllImport("user32")]
public static extern int SetWindowLong(HWND hwnd, int nIndex, int
dwNewLong);
[DllImport("user32")] public static extern int
SetWindowPlacement(HWND hwnd, ref WINDOWPLACEMENT
lpwndpl);
[DllImport("user32")] public static extern int
SetWindowPos(HWND hwnd, HWND hwndInsertAfter, int x, int y, int cx, int cy, int
wFlags);
[DllImport("user32")] public static extern int
SetWindowRgn(HWND hwnd, HANDLE hRgn, int
bRedraw);
[DllImport("user32")] public static extern int
SetWindowText(HWND hwnd, string lpString);
[DllImport("user32")]
public static extern int SetWindowWord(HWND hwnd, int nIndex, int
wNewWord);
[DllImport("user32")] public static extern int
SetWindowsHook(int nFilterType, ref int
pfnFilterProc);
[DllImport("user32")] public static extern int
SetWindowsHookEx(int idHook, ref int lpfn, HANDLE hmod, int
dwThreadId);
[DllImport("user32")] public static extern int
ShowCaret(HWND hwnd);
[DllImport("user32")] public static extern
int ShowCursor(int bShow);
[DllImport("user32")] public static
extern int ShowOwnedPopups(HWND hwnd, int
fShow);
[DllImport("user32")] public static extern int
ShowScrollBar(HWND hwnd, int wBar, int
bShow);
[DllImport("user32")] public static extern int
ShowWindow(HWND hwnd, int nCmdShow);
[DllImport("user32")] public
static extern int ShowWindowAsync(HWND hwnd, int
nCmdShow);
[DllImport("user32")] public static extern int
SubtractRect(ref RECT lprcDst, ref RECT lprcSrc1, ref RECT
lprcSrc2);
[DllImport("user32")] public static extern int
SwapMouseButton(int bSwap);
[DllImport("user32")] public static
extern int SwitchDesktop(HANDLE hDesktop);
[DllImport("user32")]
public static extern int SystemParametersInfo(int uAction, int uParam, ref
IntPtr lpvParam, int fuWinIni);
[DllImport("user32")] public
static extern int TabbedTextOut(HDC hdc, int x, int y, string lpString, int
nCount, int nTabPositions, ref int lpnTabStopPositions, int
nTabOrigin);
[DllImport("user32")] public static extern int
ToAscii(int uVirtKey, int uScanCode, Byte lpbKeyState, ref int lpwTransKey, int
fuState);
[DllImport("user32")] public static extern int
ToAsciiEx(int uVirtKey, int uScanCode, Byte lpKeyState, short lpChar, int
uFlags, int dwhkl);
[DllImport("user32")] public static extern
int ToUnicode(int wVirtKey, int wScanCode, Byte lpKeyState, string pwszBuff, int
cchBuff, int wFlags);
[DllImport("user32")] public static extern
int TrackPopupMenu(HANDLE hMenu, int wFlags, int x, int y, int nReserved, HWND
hwnd, ref RECT lprc);
[DllImport("user32")] public static extern
int TrackPopupMenuEx(HANDLE hMenu, int un, int n1, int n2, HWND hwnd, ref
TPMPARAMS lpTPMParams);
[DllImport("user32")] public static
extern int TranslateAccelerator(HWND hwnd, HANDLE hAccTable, ref MSG
lpMsg);
[DllImport("user32")] public static extern int
TranslateMDISysAccel(HWND hwndClient, ref MSG
lpMsg);
[DllImport("user32")] public static extern int
TranslateMessage(ref MSG lpMsg);
[DllImport("user32")] public
static extern int UnhookWindowsHook(int nCode, ref int
pfnFilterProc);
[DllImport("user32")] public static extern int
UnhookWindowsHookEx(HANDLE hHook);
[DllImport("user32")] public
static extern int UnionRect(ref RECT lpDestRect, ref RECT lpSrc1Rect, ref RECT
lpSrc2Rect);
[DllImport("user32")] public static extern int
UnloadKeyboardLayout(HANDLE hKL);
[DllImport("user32")] public
static extern int UnpackDDElParam(int msg, int lParam, ref int puiLo, ref int
puiHi);
[DllImport("user32")] public static extern int
UnregisterClass(string lpClassName, HANDLE
hInstance);
[DllImport("user32")] public static extern int
UnregisterHotKey(HWND hwnd, int id);
[DllImport("user32")] public
static extern int UpdateWindow(HWND hwnd);
[DllImport("user32")]
public static extern int ValidateRect(HWND hwnd, ref RECT
lpRect);
[DllImport("user32")] public static extern int
ValidateRgn(HWND hwnd, HANDLE hRgn);
[DllImport("user32")] public
static extern int WaitForInputIdle(HANDLE hProcess, int
dwMilliseconds);
[DllImport("user32")] public static extern int
WaitMessage();
[DllImport("user32")] public static extern int
WinHelp(HWND hwnd, string lpHelpFile, int wCommand, int
dwData);
[DllImport("user32")] public static extern int
WindowFromDC(HDC hdc);
[DllImport("user32")] public static extern
int WindowFromPoint(int xPoint, int
yPoint);
[DllImport("user32")] public static extern short
CascadeWindows(HWND hwndParent, int wHow, ref RECT lpRect, int cKids, ref int
lpkids);
[DllImport("user32")] public static extern short
GetAsyncKeyState(int vKey);
[DllImport("user32")] public static
extern short GetKeyState(int nVirtKey);
[DllImport("user32")]
public static extern short GetWindowWord(HWND hwnd, int
nIndex);
[DllImport("user32")] public static extern short
RegisterClassEx(ref WNDCLASSEX
pcWndClassEx);
[DllImport("user32")] public static extern short
TileWindows(HWND hwndParent, int wHow, ref RECT lpRect, int cKids, ref int
lpKids);
[DllImport("user32")] public static extern short
VkKeyScan(Byte cChar);
[DllImport("user32")] public static extern
short VkKeyScanEx(Byte ch, int dwhkl);
[DllImport("user32")]
public static extern string CharLower(string
lpsz);
[DllImport("user32")] public static extern string
CharNext(string lpsz);
[DllImport("user32")] public static extern
string CharPrev(string lpszStart, string
lpszCurrent);
[DllImport("user32")] public static extern string
CharUpper(string lpsz);
[DllImport("user32")] public static
extern void PostQuitMessage(int nExitCode);
[DllImport("user32")]
public static extern void keybd_event(Byte bVk, Byte bScan, int dwFlags, int
dwExtraInfo);
[DllImport("user32")] public static extern void
mouse_event(int dwFlags, int dx, int dy, int cButtons, int
dwExtraInfo);
[DllImport("user32")] public static extern void
SetDebugErrorLevel(int dwLevel);
[DllImport("user32")] public
static extern void SetLastErrorEx(int dwErrCode, int dwType);
public const int APPCLASS_MASK = 0xF;
public const int APPCLASS_MONITOR = 0x1;
public const int APPCLASS_STANDARD = 0x0;
public const int APPCMD_CLIENTONLY = 0x10;
public const int APPCMD_FILTERINITS = 0x20;
public const int APPCMD_MASK = 0xFF0;
public const int BDR_INNER = 0xC;
public const int BDR_OUTER = 0x3;
public const int BDR_RAISED = 0x5;
public const int BDR_RAISEDINNER = 0x4;
public const int BDR_RAISEDOUTER = 0x1;
public const int BDR_SUNKEN = 0xA;
public const int BDR_SUNKENINNER = 0x8;
public const int BDR_SUNKENOUTER = 0x2;
public const int BF_ADJUST = 0x2000;
public const int BF_BOTTOM = 0x8;
public const int BF_BOTTOMLEFT = (BF_BOTTOM | BF_LEFT);
public const int BF_BOTTOMRIGHT = (BF_BOTTOM | BF_RIGHT);
public const int BF_DIAGONAL = 0x10;
public const int BF_DIAGONAL_ENDBOTTOMLEFT = (BF_DIAGONAL | BF_BOTTOM | BF_LEFT);
public const int BF_DIAGONAL_ENDBOTTOMRIGHT = (BF_DIAGONAL | BF_BOTTOM | BF_RIGHT);
public const int BF_DIAGONAL_ENDTOPLEFT = (BF_DIAGONAL | BF_TOP | BF_LEFT);
public const int BF_DIAGONAL_ENDTOPRIGHT = (BF_DIAGONAL | BF_TOP | BF_RIGHT);
public const int BF_FLAT = 0x4000;
public const int BF_LEFT = 0x1;
public const int BF_MIDDLE = 0x800;
public const int BF_MONO = 0x8000;
public const int BF_RECT = (BF_LEFT | BF_TOP | BF_RIGHT | BF_BOTTOM);
public const int BF_RIGHT = 0x4;
public const int BF_SOFT = 0x1000;
public const int BF_TOP = 0x2;
public const int BF_TOPLEFT = (BF_TOP | BF_LEFT);
public const int BF_TOPRIGHT = (BF_TOP | BF_RIGHT);
public const int BIF_BROWSEFORCOMPUTER = 4096;
public const int BIF_BROWSEFORPRINTER = 8192;
public const int BIF_BROWSEINCLUDEFILES = 16384;
public const int BIF_BROWSEINCLUDEURLS = 128;
public const int BIF_DONTGOBELOWDOMAIN = 2;
public const int BIF_EDITBOX = 16;
public const int BIF_RETURNFSANCESTORS = 8;
public const int BIF_RETURNONLYFSDIRS = 1;
public const int BIF_SHAREABLE = 32768;
public const int BIF_STATUSTEXT = 4;
public const int BIF_USENEWUI = 64;
public const int BIF_VALIDATE = 32;
public const int BM_GETCHECK = 0xF0;
public const int BM_GETSTATE = 0xF2;
public const int BM_SETCHECK = 0xF1;
public const int BM_SETSTATE = 0xF3;
public const int BM_SETSTYLE = 0xF4;
public const int BN_CLICKED = 0;
public const int BN_DISABLE = 4;
public const int BN_DOUBLECLICKED = 5;
public const int BN_HILITE = 2;
public const int BN_PAINT = 1;
public const int BN_UNHILITE = 3;
public const int BS_3STATE = 0x5;
public const int BS_AUTO3STATE = 0x6;
public const int BS_AUTOCHECKBOX = 0x3;
public const int BS_AUTORADIOBUTTON = 0x9;
public const int BS_CHECKBOX = 0x2;
public const int BS_DEFPUSHBUTTON = 0x1;
public const int BS_GROUPBOX = 0x7;
public const int BS_LEFTTEXT = 0x20;
public const int BS_OWNERDRAW = 0xB;
public const int BS_PUSHBUTTON = 0x0;
public const int BS_RADIOBUTTON = 0x4;
public const int BS_USERBUTTON = 0x8;
public const int CADV_LATEACK = 0xFFFF;
public const int CBF_FAIL_ADVISES = 0x4000;
public const int CBF_FAIL_ALLSVRXACTIONS = 0x3F000;
public const int CBF_FAIL_CONNECTIONS = 0x2000;
public const int CBF_FAIL_EXECUTES = 0x8000;
public const int CBF_FAIL_POKES = 0x10000;
public const int CBF_FAIL_REQUESTS = 0x20000;
public const int CBF_FAIL_SELFCONNECTIONS = 0x1000;
public const int CBF_SKIP_ALLNOTIFICATIONS = 0x3C0000;
public const int CBF_SKIP_CONNECT_CONFIRMS = 0x40000;
public const int CBF_SKIP_DISCONNECTS = 0x200000;
public const int CBF_SKIP_REGISTRATIONS = 0x80000;
public const int CBF_SKIP_UNREGISTRATIONS = 0x100000;
public const int CBN_CLOSEUP = 8;
public const int CBN_DBLCLK = 2;
public const int CBN_DROPDOWN = 7;
public const int CBN_EDITCHANGE = 5;
public const int CBN_EDITUPDATE = 6;
public const int CBN_ERRSPACE = (-1);
public const int CBN_KILLFOCUS = 4;
public const int CBN_SELCHANGE = 1;
public const int CBN_SELENDCANCEL = 10;
public const int CBN_SELENDOK = 9;
public const int CBN_SETFOCUS = 3;
public const int CBR_BLOCK = 0xFFFF;
public const int CBS_AUTOHSCROLL = 0x40;
public const int CBS_DISABLENOSCROLL = 0x800;
public const int CBS_DROPDOWN = 0x2;
public const int CBS_DROPDOWNLIST = 0x3;
public const int CBS_HASSTRINGS = 0x200;
public const int CBS_NOINTEGRALHEIGHT = 0x400;
public const int CBS_OEMCONVERT = 0x80;
public const int CBS_OWNERDRAWFIXED = 0x10;
public const int CBS_OWNERDRAWVARIABLE = 0x20;
public const int CBS_SIMPLE = 0x1;
public const int CBS_SORT = 0x100;
public const int CB_ADDSTRING = 0x143;
public const int CB_DELETESTRING = 0x144;
public const int CB_DIR = 0x145;
public const int CB_ERR = (-1);
public const int CB_ERRSPACE = (-2);
public const int CB_FINDSTRING = 0x14C;
public const int CB_FINDSTRINGEXACT = 0x158;
public const int CB_GETCOUNT = 0x146;
public const int CB_GETCURSEL = 0x147;
public const int CB_GETDROPPEDCONTROLRECT = 0x152;
public const int CB_GETDROPPEDSTATE = 0x157;
public const int CB_GETEDITSEL = 0x140;
public const int CB_GETEXTENDEDUI = 0x156;
public const int CB_GETITEMDATA = 0x150;
public const int CB_GETITEMHEIGHT = 0x154;
public const int CB_GETLBTEXT = 0x148;
public const int CB_GETLBTEXTLEN = 0x149;
public const int CB_GETLOCALE = 0x15A;
public const int CB_INSERTSTRING = 0x14A;
public const int CB_LIMITTEXT = 0x141;
public const int CB_MSGMAX = 0x15B;
public const int CB_OKAY = 0;
public const int CB_RESETCONTENT = 0x14B;
public const int CB_SELECTSTRING = 0x14D;
public const int CB_SETCURSEL = 0x14E;
public const int CB_SETEDITSEL = 0x142;
public const int CB_SETEXTENDEDUI = 0x155;
public const int CB_SETITEMDATA = 0x151;
public const int CB_SETITEMHEIGHT = 0x153;
public const int CB_SETLOCALE = 0x159;
public const int CB_SHOWDROPDOWN = 0x14F;
public const int CF_BITMAP = 2;
public const int CF_DIB = 8;
public const int CF_DIF = 5;
public const int CF_DSPBITMAP = 0x82;
public const int CF_DSPENHMETAFILE = 0x8E;
public const int CF_DSPMETAFILEPICT = 0x83;
public const int CF_DSPTEXT = 0x81;
public const int CF_ENHMETAFILE = 14;
public const int CF_GDIOBJFIRST = 0x300;
public const int CF_GDIOBJLAST = 0x3FF;
public const int CF_METAFILEPICT = 3;
public const int CF_OEMTEXT = 7;
public const int CF_OWNERDISPLAY = 0x80;
public const int CF_PALETTE = 9;
public const int CF_PENDATA = 10;
public const int CF_PRIVATEFIRST = 0x200;
public const int CF_PRIVATELAST = 0x2FF;
public const int CF_RIFF = 11;
public const int CF_SYLK = 4;
public const int CF_TEXT = 1;
public const int CF_TIFF = 6;
public const int CF_UNICODETEXT = 13;
public const int CF_WAVE = 12;
public const int CN_EVENT = 0x4;
public const int CN_RECEIVE = 0x1;
public const int CN_TRANSMIT = 0x2;
public const int COLOR_ACTIVEBORDER = 10;
public const int COLOR_ACTIVECAPTION = 2;
public const int COLOR_APPWORKSPACE = 12;
public const int COLOR_BACKGROUND = 1;
public const int COLOR_BTNFACE = 15;
public const int COLOR_BTNHIGHLIGHT = 20;
public const int COLOR_BTNSHADOW = 16;
public const int COLOR_BTNTEXT = 18;
public const int COLOR_CAPTIONTEXT = 9;
public const int COLOR_GRAYTEXT = 17;
public const int COLOR_HIGHLIGHT = 13;
public const int COLOR_HIGHLIGHTTEXT = 14;
public const int COLOR_INACTIVEBORDER = 11;
public const int COLOR_INACTIVECAPTION = 3;
public const int COLOR_INACTIVECAPTIONTEXT = 19;
public const int COLOR_MENU = 4;
public const int COLOR_MENUTEXT = 7;
public const int COLOR_SCROLLBAR = 0;
public const int COLOR_WINDOW = 5;
public const int COLOR_WINDOWFRAME = 6;
public const int COLOR_WINDOWTEXT = 8;
public const int CP_WINANSI = 1004;
public const int CP_WINUNICODE = 1200;
public const int CS_BYTEALIGNCLIENT = 0x1000;
public const int CS_BYTEALIGNWINDOW = 0x2000;
public const int CS_CLASSDC = 0x40;
public const int CS_DBLCLKS = 0x8;
public const int CS_HREDRAW = 0x2;
public const int CS_KEYCVTWINDOW = 0x4;
public const int CS_NOCLOSE = 0x200;
public const int CS_NOKEYCVT = 0x100;
public const int CS_OWNDC = 0x20;
public const int CS_PARENTDC = 0x80;
public const int CS_PUBLICCLASS = 0x4000;
public const int CS_SAVEBITS = 0x800;
public const int CS_VREDRAW = 0x1;
public const int CTLCOLOR_BTN = 3;
public const int CTLCOLOR_DLG = 4;
public const int CTLCOLOR_EDIT = 1;
public const int CTLCOLOR_LISTBOX = 2;
public const int CTLCOLOR_MAX = 8;
public const int CTLCOLOR_MSGBOX = 0;
public const int CTLCOLOR_SCROLLBAR = 5;
public const int CTLCOLOR_STATIC = 6;
public const int CW_USEDEFAULT = unchecked((int)0x80000000);
public const int DCX_CACHE = 0x2;
public const int DCX_CLIPCHILDREN = 0x8;
public const int DCX_CLIPSIBLINGS = 0x10;
public const int DCX_EXCLUDERGN = 0x40;
public const int DCX_EXCLUDEUPDATE = 0x100;
public const int DCX_INTERSECTRGN = 0x80;
public const int DCX_INTERSECTUPDATE = 0x200;
public const int DCX_LOCKWINDOWUPDATE = 0x400;
public const int DCX_NORECOMPUTE = 0x100000;
public const int DCX_NORESETATTRS = 0x4;
public const int DCX_PARENTCLIP = 0x20;
public const int DCX_VALIDATE = 0x200000;
public const int DCX_WINDOW = 0x1;
public const int DC_HASDEFID = 0x534;
public const int DDE_FACK = 0x8000;
public const int DDE_FACKREQ = 0x8000;
public const int DDE_FACKRESERVED = (~ (DDE_FACK | DDE_FBUSY | DDE_FAPPSTATUS));
public const int DDE_FADVRESERVED = (~ (DDE_FACKREQ | DDE_FDEFERUPD));
public const int DDE_FAPPSTATUS = 0xFF;
public const int DDE_FBUSY = 0x4000;
public const int DDE_FDATRESERVED = (~ (DDE_FACKREQ | DDE_FRELEASE | DDE_FREQUESTED));
public const int DDE_FDEFERUPD = 0x4000;
public const int DDE_FNOTPROCESSED = 0x0;
public const int DDE_FPOKRESERVED = (~ (DDE_FRELEASE));
public const int DDE_FRELEASE = 0x2000;
public const int DDE_FREQUESTED = 0x1000;
public const int DDL_ARCHIVE = 0x20;
public const int DDL_DIRECTORY = 0x10;
public const int DDL_DRIVES = 0x4000;
public const int DDL_EXCLUSIVE = 0x8000;
public const int DDL_HIDDEN = 0x2;
public const int DDL_POSTMSGS = 0x2000;
public const int DDL_READONLY = 0x1;
public const int DDL_READWRITE = 0x0;
public const int DDL_SYSTEM = 0x4;
public const int DESKTOP_CREATEMENU = 0x4;
public const int DESKTOP_CREATEWINDOW = 0x2;
public const int DESKTOP_ENUMERATE = 0x40;
public const int DESKTOP_HOOKCONTROL = 0x8;
public const int DESKTOP_JOURNALPLAYBACK = 0x20;
public const int DESKTOP_JOURNALRECORD = 0x10;
public const int DESKTOP_READOBJECTS = 0x1;
public const int DESKTOP_WRITEOBJECTS = 0x80;
public const int DLGC_BUTTON = 0x2000;
public const int DLGC_DEFPUSHBUTTON = 0x10;
public const int DLGC_HASSETSEL = 0x8;
public const int DLGC_RADIOBUTTON = 0x40;
public const int DLGC_STATIC = 0x100;
public const int DLGC_UNDEFPUSHBUTTON = 0x20;
public const int DLGC_WANTALLKEYS = 0x4;
public const int DLGC_WANTARROWS = 0x1;
public const int DLGC_WANTCHARS = 0x80;
public const int DLGC_WANTMESSAGE = 0x4;
public const int DLGC_WANTTAB = 0x2;
public const int DLGWINDOWEXTRA = 30;
public const int DMLERR_ADVACKTIMEOUT = 0x4000;
public const int DMLERR_BUSY = 0x4001;
public const int DMLERR_DATAACKTIMEOUT = 0x4002;
public const int DMLERR_DLL_NOT_INITIALIZED = 0x4003;
public const int DMLERR_DLL_USAGE = 0x4004;
public const int DMLERR_EXECACKTIMEOUT = 0x4005;
public const int DMLERR_FIRST = 0x4000;
public const int DMLERR_INVALIDPARAMETER = 0x4006;
public const int DMLERR_LAST = 0x4011;
public const int DMLERR_LOW_MEMORY = 0x4007;
public const int DMLERR_MEMORY_ERROR = 0x4008;
public const int DMLERR_NOTPROCESSED = 0x4009;
public const int DMLERR_NO_CONV_ESTABLISHED = 0x400A;
public const int DMLERR_NO_ERROR = 0;
public const int DMLERR_POKEACKTIMEOUT = 0x400B;
public const int DMLERR_POSTMSG_FAILED = 0x400C;
public const int DMLERR_REENTRANCY = 0x400D;
public const int DMLERR_SERVER_DIED = 0x400E;
public const int DMLERR_SYS_ERROR = 0x400F;
public const int DMLERR_UNADVACKTIMEOUT = 0x4010;
public const int DMLERR_UNFOUND_QUEUE_ID = 0x4011;
public const int DM_GETDEFID = WM_USER + 0;
public const int DM_SETDEFID = WM_USER + 1;
public const int DNS_FILTEROFF = 0x8;
public const int DNS_FILTERON = 0x4;
public const int DNS_REGISTER = 0x1;
public const int DNS_UNREGISTER = 0x2;
public const int DS_ABSALIGN = 0x1;
public const int DS_LOCALEDIT = 0x20;
public const int DS_MODALFRAME = 0x80;
public const int DS_NOIDLEMSG = 0x100;
public const int DS_SETFONT = 0x40;
public const int DS_SETFOREGROUND = 0x200;
public const int DS_SYSMODAL = 0x2;
public const int DT_BOTTOM = 0x8;
public const int DT_CALCRECT = 0x400;
public const int DT_CENTER = 0x1;
public const int DT_EDITCONTROL = 0x2000;
public const int DT_END_ELLIPSIS = 0x8000;
public const int DT_EXPANDTABS = 0x40;
public const int DT_EXTERNALLEADING = 0x200;
public const int DT_INTERNAL = 0x1000;
public const int DT_LEFT = 0x0;
public const int DT_MODIFYSTRING = 0x10000;
public const int DT_NOCLIP = 0x100;
public const int DT_NOPREFIX = 0x800;
public const int DT_PATH_ELLIPSIS = 0x4000;
public const int DT_RIGHT = 0x2;
public const int DT_RTLREADING = 0x20000;
public const int DT_SINGLELINE = 0x20;
public const int DT_TABSTOP = 0x80;
public const int DT_TOP = 0x0;
public const int DT_VCENTER = 0x4;
public const int DT_WORDBREAK = 0x10;
public const int DT_WORD_ELLIPSIS = 0x40000;
public const int DWL_DLGPROC = 4;
public const int DWL_MSGRESULT = 0;
public const int DWL_USER = 8;
public const int EC_DISABLE = ST_BLOCKED;
public const int EC_ENABLEALL = 0;
public const int EC_ENABLEONE = ST_BLOCKNEXT;
public const int EC_QUERYWAITING = 2;
public const int EDGE_BUMP = (BDR_RAISEDOUTER | BDR_SUNKENINNER);
public const int EDGE_ETCHED = (BDR_SUNKENOUTER | BDR_RAISEDINNER);
public const int EDGE_RAISED = (BDR_RAISEDOUTER | BDR_RAISEDINNER);
public const int EDGE_SUNKEN = (BDR_SUNKENOUTER | BDR_SUNKENINNER);
public const int EM_CANPASTE = 0x432;
public const int EM_CANREDO = 0x455;
public const int EM_CANUNDO = 0xC6;
public const int EM_CHARFROMPOS = 0x427;
public const int EM_DISPLAYBAND = 0x433;
public const int EM_EMPTYUNDOBUFFER = 0xCD;
public const int EM_EXGETSEL = 0x434;
public const int EM_EXLIMITTEXT = 0x435;
public const int EM_EXLINEFROMCHAR = 0x436;
public const int EM_EXSETSEL = 0x437;
public const int EM_FINDTEXT = 0x438;
public const int EM_FINDTEXTEX = 0x44F;
public const int EM_FINDWORDBREAK = 0x44C;
public const int EM_FMTLINES = 0xC8;
public const int EM_FORMATRANGE = 0x439;
public const int EM_GETCHARFORMAT = 0x43A;
public const int EM_GETEVENTMASK = 0x43B;
public const int EM_GETFIRSTVISIBLELINE = 0xCE;
public const int EM_GETLIMITTEXT = 0x425;
public const int EM_GETLINE = 0xC4;
public const int EM_GETLINECOUNT = 0xBA;
public const int EM_GETMODIFY = 0xB8;
public const int EM_GETOLEINTERFACE = 0x43C;
public const int EM_GETOPTIONS = 0x44E;
public const int EM_GETPARAFORMAT = 0x43D;
public const int EM_GETPASSWORDCHAR = 0xD2;
public const int EM_GETRECT = 0xB2;
public const int EM_GETREDONAME = 0x457;
public const int EM_GETSEL = 0xB0;
public const int EM_GETSELTEXT = 0x43E;
public const int EM_GETTEXTMODE = 0x45A;
public const int EM_GETTEXTRANGE = 0x44B;
public const int EM_GETTHUMB = 0xBE;
public const int EM_GETUNDONAME = 0x456;
public const int EM_GETWORDBREAKPROC = 0xD1;
public const int EM_HIDESELECTION = 0x43F;
public const int EM_LIMITTEXT = 0xC5;
public const int EM_LINEFROMCHAR = 0xC9;
public const int EM_LINEINDEX = 0xBB;
public const int EM_LINELENGTH = 0xC1;
public const int EM_LINESCROLL = 0xB6;
public const int EM_PASTESPECIAL = 0x440;
public const int EM_POSFROMCHAR = 0x426;
public const int EM_REDO = 0x454;
public const int EM_REPLACESEL = 0xC2;
public const int EM_REQUESTRESIZE = 0x441;
public const int EM_SCROLL = 0xB5;
public const int EM_SCROLLCARET = 0xB7;
public const int EM_SELECTIONTYPE = 0x442;
public const int EM_SETBKGNDCOLOR = 0x443;
public const int EM_SETCHARFORMAT = 0x444;
public const int EM_SETEVENTMASK = 0x445;
public const int EM_SETMODIFY = 0xB9;
public const int EM_SETOLECALLBACK = 0x446;
public const int EM_SETOPTIONS = 0x44D;
public const int EM_SETPARAFORMAT = 0x447;
public const int EM_SETPASSWORDCHAR = 0xCC;
public const int EM_SETREADONLY = 0xCF;
public const int EM_SETRECT = 0xB3;
public const int EM_SETRECTNP = 0xB4;
public const int EM_SETSEL = 0xB1;
public const int EM_SETTABSTOPS = 0xCB;
public const int EM_SETTARGETDEVICE = 0x448;
public const int EM_SETTEXTMODE = 0x459;
public const int EM_SETUNDOLIMIT = 0x452;
public const int EM_SETWORDBREAKPROC = 0xD0;
public const int EM_STOPGROUPTYPING = 0x458;
public const int EM_STREAMIN = 0x449;
public const int EM_STREAMOUT = 0x44A;
public const int EM_UNDO = 0xC7;
public const int EN_CHANGE = 0x300;
public const int EN_ERRSPACE = 0x500;
public const int EN_HSCROLL = 0x601;
public const int EN_KILLFOCUS = 0x200;
public const int EN_MAXTEXT = 0x501;
public const int EN_SETFOCUS = 0x100;
public const int EN_UPDATE = 0x400;
public const int EN_VSCROLL = 0x602;
public const int ESB_DISABLE_BOTH = 0x3;
public const int ESB_DISABLE_DOWN = 0x2;
public const int ESB_DISABLE_LEFT = 0x1;
public const int ESB_DISABLE_LTUP = ESB_DISABLE_LEFT;
public const int ESB_DISABLE_RIGHT = 0x2;
public const int ESB_DISABLE_RTDN = ESB_DISABLE_RIGHT;
public const int ESB_DISABLE_UP = 0x1;
public const int ESB_ENABLE_BOTH = 0x0;
public const int ES_AUTOHSCROLL = 0x80;
public const int ES_AUTOVSCROLL = 0x40;
public const int ES_CENTER = 0x1;
public const int ES_LEFT = 0x0;
public const int ES_LOWERCASE = 0x10;
public const int ES_MULTILINE = 0x4;
public const int ES_NOHIDESEL = 0x100;
public const int ES_OEMCONVERT = 0x400;
public const int ES_PASSWORD = 0x20;
public const int ES_READONLY = 0x800;
public const int ES_RIGHT = 0x2;
public const int ES_UPPERCASE = 0x8;
public const int ES_WANTRETURN = 0x1000;
public const int EWX_FORCE = 4;
public const int EWX_LOGOFF = 0;
public const int EWX_REBOOT = 2;
public const int EWX_SHUTDOWN = 1;
public const int FALT = 0x10;
public const int FCONTROL = 0x8;
public const int FNOINVERT = 0x2;
public const int FSHIFT = 0x4;
public const int FVIRTKEY = 0x1;
public const int GCL_CBCLSEXTRA = (-20);
public const int GCL_CBWNDEXTRA = (-18);
public const int GCL_HBRBACKGROUND = (-10);
public const int GCL_HCURSOR = (-12);
public const int GCL_HICON = (-14);
public const int GCL_HMODULE = (-16);
public const int GCL_MENUNAME = (-8);
public const int GCL_STYLE = (-26);
public const int GCL_WNDPROC = (-24);
public const int GCW_ATOM = (-32);
public const int GWL_EXSTYLE = (-20);
public const int GWL_HINSTANCE = (-6);
public const int GWL_HWNDPARENT = (-8);
public const int GWL_ID = (-12);
public const int GWL_STYLE = (-16);
public const int GWL_USERDATA = (-21);
public const int GWL_WNDPROC = (-4);
public const int GW_CHILD = 5;
public const int GW_HWNDFIRST = 0;
public const int GW_HWNDLAST = 1;
public const int GW_HWNDNEXT = 2;
public const int GW_HWNDPREV = 3;
public const int GW_MAX = 5;
public const int GW_OWNER = 4;
public const int HCBT_ACTIVATE = 5;
public const int HCBT_CLICKSKIPPED = 6;
public const int HCBT_CREATEWND = 3;
public const int HCBT_DESTROYWND = 4;
public const int HCBT_KEYSKIPPED = 7;
public const int HCBT_MINMAX = 1;
public const int HCBT_MOVESIZE = 0;
public const int HCBT_QS = 2;
public const int HCBT_SETFOCUS = 9;
public const int HCBT_SYSCOMMAND = 8;
public const int HC_ACTION = 0;
public const int HC_GETNEXT = 1;
public const int HC_NOREM = HC_NOREMOVE;
public const int HC_NOREMOVE = 3;
public const int HC_SKIP = 2;
public const int HC_SYSMODALOFF = 5;
public const int HC_SYSMODALON = 4;
public const int HDATA_APPOWNED = 0x1;
public const int HELP_COMMAND = 0x102;
public const int HELP_CONTENTS = 0x3;
public const int HELP_CONTEXT = 0x1;
public const int HELP_CONTEXTPOPUP = 0x8;
public const int HELP_FORCEFILE = 0x9;
public const int HELP_HELPONHELP = 0x4;
public const int HELP_INDEX = 0x3;
public const int HELP_KEY = 0x101;
public const int HELP_MULTIKEY = 0x201;
public const int HELP_PARTIALKEY = 0x105;
public const int HELP_QUIT = 0x2;
public const int HELP_SETCONTENTS = 0x5;
public const int HELP_SETINDEX = 0x5;
public const int HELP_SETWINPOS = 0x203;
public const int HIDE_WINDOW = 0;
public const int HKL_NEXT = 1;
public const int HKL_PREV = 0;
public const int HSHELL_ACTIVATESHELLWINDOW = 3;
public const int HSHELL_WINDOWCREATED = 1;
public const int HSHELL_WINDOWDESTROYED = 2;
public const int HTBORDER = 18;
public const int HTBOTTOM = 15;
public const int HTBOTTOMLEFT = 16;
public const int HTBOTTOMRIGHT = 17;
public const int HTCAPTION = 2;
public const int HTCLIENT = 1;
public const int HTERROR = (-2);
public const int HTGROWBOX = 4;
public const int HTHSCROLL = 6;
public const int HTLEFT = 10;
public const int HTMAXBUTTON = 9;
public const int HTMENU = 5;
public const int HTMINBUTTON = 8;
public const int HTNOWHERE = 0;
public const int HTREDUCE = HTMINBUTTON;
public const int HTRIGHT = 11;
public const int HTSIZE = HTGROWBOX;
public const int HTSIZEFIRST = HTLEFT;
public const int HTSIZELAST = HTBOTTOMRIGHT;
public const int HTSYSMENU = 3;
public const int HTTOP = 12;
public const int HTTOPLEFT = 13;
public const int HTTOPRIGHT = 14;
public const int HTTRANSPARENT = (-1);
public const int HTVSCROLL = 7;
public const int HTZOOM = HTMAXBUTTON;
public HWND HWND_BOTTOM
{
get { return (HWND) 1; }
}
public HWND HWND_BROADCAST
{
get { return (HWND) 0xFFFF; }
}
public HWND HWND_DESKTOP
{
get { return (HWND) 0; }
}
public HWND HWND_TOP
{
get { return (HWND) 0; }
}
public HWND HWND_NOTOPMOST
{
get { return (HWND) (-2); }
}
public HWND HWND_TOPMOST
{
get { return (HWND) (-2); }
}
public const int IDABORT = 3;
public const int IDCANCEL = 2;
public const int IDC_APPSTARTING = 32650;
public const int IDC_ARROW = 32512;
public const int IDC_CROSS = 32515;
public const int IDC_IBEAM = 32513;
public const int IDC_ICON = 32641;
public const int IDC_NO = 32648;
public const int IDC_SIZE = 32640;
public const int IDC_SIZEALL = 32646;
public const int IDC_SIZENESW = 32643;
public const int IDC_SIZENS = 32645;
public const int IDC_SIZENWSE = 32642;
public const int IDC_SIZEWE = 32644;
public const int IDC_UPARROW = 32516;
public const int IDC_WAIT = 32514;
public const int IDHOT_SNAPDESKTOP = (-2);
public const int IDHOT_SNAPWINDOW = (-1);
public const int IDIGNORE = 5;
public const int IDI_APPLICATION = 32512;
public const int IDI_ASTERISK = 32516;
public const int IDI_EXCLAMATION = 32515;
public const int IDI_HAND = 32513;
public const int IDI_QUESTION = 32514;
public const int IDNO = 7;
public const int IDOK = 1;
public const int IDRETRY = 4;
public const int IDYES = 6;
public const int INVALID_HANDLE_VALUE = -1;
public const int KEYEVENTF_EXTENDEDKEY = 0x1;
public const int KEYEVENTF_KEYUP = 0x2;
public const int KF_ALTDOWN = 0x2000;
public const int KF_DLGMODE = 0x800;
public const int KF_EXTENDED = 0x100;
public const int KF_MENUMODE = 0x1000;
public const int KF_REPEAT = 0x4000;
public const int KF_UP = 0x8000;
public const int KLF_ACTIVATE = 0x1;
public const int KLF_REORDER = 0x8;
public const int KLF_SUBSTITUTE_OK = 0x2;
public const int KLF_UNLOADPREVIOUS = 0x4;
public const int KL_NAMELENGTH = 9;
public const int LBN_DBLCLK = 2;
public const int LBN_ERRSPACE = (-2);
public const int LBN_KILLFOCUS = 5;
public const int LBN_SELCANCEL = 3;
public const int LBN_SELCHANGE = 1;
public const int LBN_SETFOCUS = 4;
public const int LBS_DISABLENOSCROLL = 0x1000;
public const int LBS_EXTENDEDSEL = 0x800;
public const int LBS_HASSTRINGS = 0x40;
public const int LBS_MULTICOLUMN = 0x200;
public const int LBS_MULTIPLESEL = 0x8;
public const int LBS_NODATA = 0x2000;
public const int LBS_NOINTEGRALHEIGHT = 0x100;
public const int LBS_NOREDRAW = 0x4;
public const int LBS_NOTIFY = 0x1;
public const int LBS_OWNERDRAWFIXED = 0x10;
public const int LBS_OWNERDRAWVARIABLE = 0x20;
public const int LBS_SORT = 0x2;
public const int LBS_STANDARD = (LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER);
public const int LBS_USETABSTOPS = 0x80;
public const int LBS_WANTKEYBOARDINPUT = 0x400;
public const int LB_ADDFILE = 0x196;
public const int LB_ADDSTRING = 0x180;
public const int LB_CTLCODE = 0;
public const int LB_DELETESTRING = 0x182;
public const int LB_DIR = 0x18D;
public const int LB_ERR = (-1);
public const int LB_ERRSPACE = (-2);
public const int LB_FINDSTRING = 0x18F;
public const int LB_FINDSTRINGEXACT = 0x1A2;
public const int LB_GETANCHORINDEX = 0x19D;
public const int LB_GETCARETINDEX = 0x19F;
public const int LB_GETCOUNT = 0x18B;
public const int LB_GETCURSEL = 0x188;
public const int LB_GETHORIZONTALEXTENT = 0x193;
public const int LB_GETITEMDATA = 0x199;
public const int LB_GETITEMHEIGHT = 0x1A1;
public const int LB_GETITEMRECT = 0x198;
public const int LB_GETLOCALE = 0x1A6;
public const int LB_GETSEL = 0x187;
public const int LB_GETSELCOUNT = 0x190;
public const int LB_GETSELITEMS = 0x191;
public const int LB_GETTEXT = 0x189;
public const int LB_GETTEXTLEN = 0x18A;
public const int LB_GETTOPINDEX = 0x18E;
public const int LB_INSERTSTRING = 0x181;
public const int LB_MSGMAX = 0x1A8;
public const int LB_OKAY = 0;
public const int LB_RESETCONTENT = 0x184;
public const int LB_SELECTSTRING = 0x18C;
public const int LB_SELITEMRANGE = 0x19B;
public const int LB_SELITEMRANGEEX = 0x183;
public const int LB_SETANCHORINDEX = 0x19C;
public const int LB_SETCARETINDEX = 0x19E;
public const int LB_SETCOLUMNWIDTH = 0x195;
public const int LB_SETCOUNT = 0x1A7;
public const int LB_SETCURSEL = 0x186;
public const int LB_SETHORIZONTALEXTENT = 0x194;
public const int LB_SETITEMDATA = 0x19A;
public const int LB_SETITEMHEIGHT = 0x1A0;
public const int LB_SETLOCALE = 0x1A5;
public const int LB_SETSEL = 0x185;
public const int LB_SETTABSTOPS = 0x192;
public const int LB_SETTOPINDEX = 0x197;
public const int MAX_MONITORS = 4;
public const int MA_ACTIVATE = 1;
public const int MA_ACTIVATEANDEAT = 2;
public const int MA_NOACTIVATE = 3;
public const int MA_NOACTIVATEANDEAT = 4;
public const int MB_ABORTRETRYIGNORE = 0x2;
public const int MB_APPLMODAL = 0x0;
public const int MB_DEFAULT_DESKTOP_ONLY = 0x20000;
public const int MB_DEFBUTTON1 = 0x0;
public const int MB_DEFBUTTON2 = 0x100;
public const int MB_DEFBUTTON3 = 0x200;
public const int MB_DEFMASK = 0xF00;
public const int MB_ICONASTERISK = 0x40;
public const int MB_ICONEXCLAMATION = 0x30;
public const int MB_ICONHAND = 0x10;
public const int MB_ICONINFORMATION = MB_ICONASTERISK;
public const int MB_ICONMASK = 0xF0;
public const int MB_ICONQUESTION = 0x20;
public const int MB_ICONSTOP = MB_ICONHAND;
public const int MB_MISCMASK = 0xC000;
public const int MB_MODEMASK = 0x3000;
public const int MB_NOFOCUS = 0x8000;
public const int MB_OK = 0x0;
public const int MB_OKCANCEL = 0x1;
public const int MB_RETRYCANCEL = 0x5;
public const int MB_SETFOREGROUND = 0x10000;
public const int MB_SYSTEMMODAL = 0x1000;
public const int MB_TASKMODAL = 0x2000;
public const int MB_TYPEMASK = 0xF;
public const int MB_YESNO = 0x4;
public const int MB_YESNOCANCEL = 0x3;
public const int MDIS_ALLCHILDSTYLES = 0x1;
public const int MDITILE_HORIZONTAL = 0x1;
public const int MDITILE_SKIPDISABLED = 0x2;
public const int MDITILE_VERTICAL = 0x0;
public const int MF_APPEND = 0x100;
public const int MF_BITMAP = 0x4;
public const int MF_BYCOMMAND = 0x0;
public const int MF_BYPOSITION = 0x400;
public const int MF_CALLBACKS = 0x8000000;
public const int MF_CHANGE = 0x80;
public const int MF_CHECKED = 0x8;
public const int MF_CONV = 0x40000000;
public const int MF_DELETE = 0x200;
public const int MF_DISABLED = 0x2;
public const int MF_ENABLED = 0x0;
public const int MF_END = 0x80;
public const int MF_ERRORS = 0x10000000;
public const int MF_GRAYED = 0x1;
public const int MF_HELP = 0x4000;
public const int MF_HILITE = 0x80;
public const int MF_HSZ_INFO = 0x1000000;
public const int MF_INSERT = 0x0;
public const int MF_LINKS = 0x20000000;
public const int MF_MASK = unchecked((int)0xFF000000);
public const int MF_MENUBARBREAK = 0x20;
public const int MF_MENUBREAK = 0x40;
public const int MF_MOUSESELECT = 0x8000;
public const int MF_OWNERDRAW = 0x100;
public const int MF_POPUP = 0x10;
public const int MF_POSTMSGS = 0x4000000;
public const int MF_REMOVE = 0x1000;
public const int MF_SENDMSGS = 0x2000000;
public const int MF_SEPARATOR = 0x800;
public const int MF_STRING = 0x0;
public const int MF_SYSMENU = 0x2000;
public const int MF_UNCHECKED = 0x0;
public const int MF_UNHILITE = 0x0;
public const int MF_USECHECKBITMAPS = 0x200;
public const int MH_CLEANUP = 4;
public const int MH_CREATE = 1;
public const int MH_DELETE = 3;
public const int MH_KEEP = 2;
public const int MK_CONTROL = 0x8;
public const int MK_LBUTTON = 0x1;
public const int MK_MBUTTON = 0x10;
public const int MK_RBUTTON = 0x2;
public const int MK_SHIFT = 0x4;
public const int MOD_ALT = 0x1;
public const int MOD_CONTROL = 0x2;
public const int MOD_SHIFT = 0x4;
public const int MOUSEEVENTF_ABSOLUTE = 0x8000;
public const int MOUSEEVENTF_LEFTDOWN = 0x2;
public const int MOUSEEVENTF_LEFTUP = 0x4;
public const int MOUSEEVENTF_MIDDLEDOWN = 0x20;
public const int MOUSEEVENTF_MIDDLEUP = 0x40;
public const int MOUSEEVENTF_MOVE = 0x1;
public const int MOUSEEVENTF_RIGHTDOWN = 0x8;
public const int MOUSEEVENTF_RIGHTUP = 0x10;
public const int MSGF_DDEMGR = 0x8001;
public const int MSGF_DIALOGBOX = 0;
public const int MSGF_MAINLOOP = 8;
public const int MSGF_MAX = 8;
public const int MSGF_MENU = 2;
public const int MSGF_MESSAGEBOX = 1;
public const int MSGF_MOVE = 3;
public const int MSGF_NEXTWINDOW = 6;
public const int MSGF_SCROLLBAR = 5;
public const int MSGF_SIZE = 4;
public const int MSGF_USER = 4096;
public const int OBM_BTNCORNERS = 32758;
public const int OBM_BTSIZE = 32761;
public const int OBM_CHECK = 32760;
public const int OBM_CHECKBOXES = 32759;
public const int OBM_CLOSE = 32754;
public const int OBM_COMBO = 32738;
public const int OBM_DNARROW = 32752;
public const int OBM_DNARROWD = 32742;
public const int OBM_DNARROWI = 32736;
public const int OBM_LFARROW = 32750;
public const int OBM_LFARROWD = 32740;
public const int OBM_LFARROWI = 32734;
public const int OBM_MNARROW = 32739;
public const int OBM_OLD_CLOSE = 32767;
public const int OBM_OLD_DNARROW = 32764;
public const int OBM_OLD_LFARROW = 32762;
public const int OBM_OLD_REDUCE = 32757;
public const int OBM_OLD_RESTORE = 32755;
public const int OBM_OLD_RGARROW = 32763;
public const int OBM_OLD_UPARROW = 32765;
public const int OBM_OLD_ZOOM = 32756;
public const int OBM_REDUCE = 32749;
public const int OBM_REDUCED = 32746;
public const int OBM_RESTORE = 32747;
public const int OBM_RESTORED = 32744;
public const int OBM_RGARROW = 32751;
public const int OBM_RGARROWD = 32741;
public const int OBM_RGARROWI = 32735;
public const int OBM_SIZE = 32766;
public const int OBM_UPARROW = 32753;
public const int OBM_UPARROWD = 32743;
public const int OBM_UPARROWI = 32737;
public const int OBM_ZOOM = 32748;
public const int OBM_ZOOMD = 32745;
public const int OCR_CROSS = 32515;
public const int OCR_IBEAM = 32513;
public const int OCR_ICOCUR = 32647;
public const int OCR_ICON = 32641;
public const int OCR_NO = 32648;
public const int OCR_NORMAL = 32512;
public const int OCR_SIZE = 32640;
public const int OCR_SIZEALL = 32646;
public const int OCR_SIZENESW = 32643;
public const int OCR_SIZENS = 32645;
public const int OCR_SIZENWSE = 32642;
public const int OCR_SIZEWE = 32644;
public const int OCR_UP = 32516;
public const int OCR_WAIT = 32514;
public const int ODA_DRAWENTIRE = 0x1;
public const int ODA_FOCUS = 0x4;
public const int ODA_SELECT = 0x2;
public const int ODS_CHECKED = 0x8;
public const int ODS_DISABLED = 0x4;
public const int ODS_FOCUS = 0x10;
public const int ODS_GRAYED = 0x2;
public const int ODS_SELECTED = 0x1;
public const int ODT_BUTTON = 4;
public const int ODT_COMBOBOX = 3;
public const int ODT_LISTBOX = 2;
public const int ODT_MENU = 1;
public const int OIC_BANG = 32515;
public const int OIC_HAND = 32513;
public const int OIC_NOTE = 32516;
public const int OIC_QUES = 32514;
public const int OIC_SAMPLE = 32512;
public const int ORD_LANGDRIVER = 1;
public const int PAGE_EXECUTE = 0x10;
public const int PAGE_EXECUTE_READ = 0x20;
public const int PAGE_EXECUTE_READWRITE = 0x40;
public const int PAGE_EXECUTE_WRITECOPY = 0x80;
public const int PAGE_GUARD = 0x100;
public const int PAGE_NOACCESS = 0x1;
public const int PAGE_NOCACHE = 0x200;
public const int PAGE_READONLY = 0x2;
public const int PAGE_READWRITE = 0x4;
public const int PAGE_WRITECOPY = 0x8;
public const int PM_NOREMOVE = 0x0;
public const int PM_NOYIELD = 0x2;
public const int PM_REMOVE = 0x1;
public const int PWR_CRITICALRESUME = 3;
public const int PWR_FAIL = (-1);
public const int PWR_OK = 1;
public const int PWR_SUSPENDREQUEST = 1;
public const int PWR_SUSPENDRESUME = 2;
public const int QID_SYNC = 0xFFFF;
public const int QS_ALLEVENTS = (QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY);
public const int QS_ALLINPUT = (QS_SENDMESSAGE | QS_PAINT | QS_TIMER | QS_POSTMESSAGE | QS_MOUSEBUTTON | QS_MOUSEMOVE | QS_HOTKEY | QS_KEY);
public const int QS_HOTKEY = 0x80;
public const int QS_INPUT = (QS_MOUSE | QS_KEY);
public const int QS_KEY = 0x1;
public const int QS_MOUSE = (QS_MOUSEMOVE | QS_MOUSEBUTTON);
public const int QS_MOUSEBUTTON = 0x4;
public const int QS_MOUSEMOVE = 0x2;
public const int QS_PAINT = 0x20;
public const int QS_POSTMESSAGE = 0x8;
public const int QS_SENDMESSAGE = 0x40;
public const int QS_TIMER = 0x10;
public const int RDW_ALLCHILDREN = 0x80;
public const int RDW_ERASE = 0x4;
public const int RDW_ERASENOW = 0x200;
public const int RDW_FRAME = 0x400;
public const int RDW_INTERNALPAINT = 0x2;
public const int RDW_INVALIDATE = 0x1;
public const int RDW_NOCHILDREN = 0x40;
public const int RDW_NOERASE = 0x20;
public const int RDW_NOFRAME = 0x800;
public const int RDW_NOINTERNALPAINT = 0x10;
public const int RDW_UPDATENOW = 0x100;
public const int RDW_VALIDATE = 0x8;
public const int READ = 0;
public const int READ_WRITE = 2;
public const int SBM_ENABLE_ARROWS = 0xE4;
public const int SBM_GETPOS = 0xE1;
public const int SBM_GETRANGE = 0xE3;
public const int SBM_SETPOS = 0xE0;
public const int SBM_SETRANGE = 0xE2;
public const int SBM_SETRANGEREDRAW = 0xE6;
public const int SBS_BOTTOMALIGN = 0x4;
public const int SBS_HORZ = 0x0;
public const int SBS_LEFTALIGN = 0x2;
public const int SBS_RIGHTALIGN = 0x4;
public const int SBS_SIZEBOX = 0x8;
public const int SBS_SIZEBOXBOTTOMRIGHTALIGN = 0x4;
public const int SBS_SIZEBOXTOPLEFTALIGN = 0x2;
public const int SBS_TOPALIGN = 0x2;
public const int SBS_VERT = 0x1;
public const int SB_BOTH = 3;
public const int SB_BOTTOM = 7;
public const int SB_CTL = 2;
public const int SB_ENDSCROLL = 8;
public const int SB_HORZ = 0;
public const int SB_LEFT = 6;
public const int SB_LINEDOWN = 1;
public const int SB_LINELEFT = 0;
public const int SB_LINERIGHT = 1;
public const int SB_LINEUP = 0;
public const int SB_PAGEDOWN = 3;
public const int SB_PAGELEFT = 2;
public const int SB_PAGERIGHT = 3;
public const int SB_PAGEUP = 2;
public const int SB_RIGHT = 7;
public const int SB_THUMBPOSITION = 4;
public const int SB_THUMBTRACK = 5;
public const int SB_TOP = 6;
public const int SB_VERT = 1;
public const int SC_ARRANGE = 0xF110;
public const int SC_CLOSE = 0xF060;
public const int SC_HOTKEY = 0xF150;
public const int SC_HSCROLL = 0xF080;
public const int SC_ICON = SC_MINIMIZE;
public const int SC_KEYMENU = 0xF100;
public const int SC_MAXIMIZE = 0xF030;
public const int SC_MINIMIZE = 0xF020;
public const int SC_MOUSEMENU = 0xF090;
public const int SC_MOVE = 0xF010;
public const int SC_NEXTWINDOW = 0xF040;
public const int SC_PREVWINDOW = 0xF050;
public const int SC_RESTORE = 0xF120;
public const int SC_SCREENSAVE = 0xF140;
public const int SC_SIZE = 0xF000;
public const int SC_TASKLIST = 0xF130;
public const int SC_VSCROLL = 0xF070;
public const int SC_ZOOM = SC_MAXIMIZE;
public const int SHOW_FULLSCREEN = 3;
public const int SHOW_ICONWINDOW = 2;
public const int SHOW_OPENNOACTIVATE = 4;
public const int SHOW_OPENWINDOW = 1;
public const int SIZEFULLSCREEN = SIZE_MAXIMIZED;
public const int SIZEICONIC = SIZE_MINIMIZED;
public const int SIZENORMAL = SIZE_RESTORED;
public const int SIZEZOOMHIDE = SIZE_MAXHIDE;
public const int SIZEZOOMSHOW = SIZE_MAXSHOW;
public const int SIZE_MAXHIDE = 4;
public const int SIZE_MAXIMIZED = 2;
public const int SIZE_MAXSHOW = 3;
public const int SIZE_MINIMIZED = 1;
public const int SIZE_RESTORED = 0;
public const int SMTO_ABORTIFHUNG = 0x2;
public const int SMTO_BLOCK = 0x1;
public const int SMTO_NORMAL = 0x0;
public const int SM_CMETRICS = 44;
public const int SM_CMOUSEBUTTONS = 43;
public const int SM_CXBORDER = 5;
public const int SM_CXCURSOR = 13;
public const int SM_CXDLGFRAME = 7;
public const int SM_CXDOUBLECLK = 36;
public const int SM_CXFIXEDFRAME = SM_CXDLGFRAME;
public const int SM_CXFRAME = 32;
public const int SM_CXFULLSCREEN = 16;
public const int SM_CXHSCROLL = 21;
public const int SM_CXHTHUMB = 10;
public const int SM_CXICON = 11;
public const int SM_CXICONSPACING = 38;
public const int SM_CXMIN = 28;
public const int SM_CXMINTRACK = 34;
public const int SM_CXSCREEN = 0;
public const int SM_CXSIZE = 30;
public const int SM_CXSIZEFRAME = SM_CXFRAME;
public const int SM_CXVSCROLL = 2;
public const int SM_CYBORDER = 6;
public const int SM_CYCAPTION = 4;
public const int SM_CYCURSOR = 14;
public const int SM_CYDLGFRAME = 8;
public const int SM_CYDOUBLECLK = 37;
public const int SM_CYFIXEDFRAME = SM_CYDLGFRAME;
public const int SM_CYFRAME = 33;
public const int SM_CYFULLSCREEN = 17;
public const int SM_CYHSCROLL = 3;
public const int SM_CYICON = 12;
public const int SM_CYICONSPACING = 39;
public const int SM_CYKANJIWINDOW = 18;
public const int SM_CYMENU = 15;
public const int SM_CYMIN = 29;
public const int SM_CYMINTRACK = 35;
public const int SM_CYSCREEN = 1;
public const int SM_CYSIZE = 31;
public const int SM_CYSIZEFRAME = SM_CYFRAME;
public const int SM_CYVSCROLL = 20;
public const int SM_CYVTHUMB = 9;
public const int SM_DBCSENABLED = 42;
public const int SM_DEBUG = 22;
public const int SM_MENUDROPALIGNMENT = 40;
public const int SM_MOUSEPRESENT = 19;
public const int SM_PENWINDOWS = 41;
public const int SM_RESERVED1 = 24;
public const int SM_RESERVED2 = 25;
public const int SM_RESERVED3 = 26;
public const int SM_RESERVED4 = 27;
public const int SM_SWAPBUTTON = 23;
public const int SPIF_SENDWININICHANGE = 0x2;
public const int SPIF_UPDATEINIFILE = 0x1;
public const int SPI_GETACCESSTIMEOUT = 60;
public const int SPI_GETANIMATION = 72;
public const int SPI_GETBEEP = 1;
public const int SPI_GETBORDER = 5;
public const int SPI_GETDEFAULTINPUTLANG = 89;
public const int SPI_GETDRAGFULLWINDOWS = 38;
public const int SPI_GETFASTTASKSWITCH = 35;
public const int SPI_GETFILTERKEYS = 50;
public const int SPI_GETFONTSMOOTHING = 74;
public const int SPI_GETGRIDGRANULARITY = 18;
public const int SPI_GETHIGHCONTRAST = 66;
public const int SPI_GETICONMETRICS = 45;
public const int SPI_GETICONTITLELOGFONT = 31;
public const int SPI_GETICONTITLEWRAP = 25;
public const int SPI_GETKEYBOARDDELAY = 22;
public const int SPI_GETKEYBOARDPREF = 68;
public const int SPI_GETKEYBOARDSPEED = 10;
public const int SPI_GETLOWPOWERACTIVE = 83;
public const int SPI_GETLOWPOWERTIMEOUT = 79;
public const int SPI_GETMENUDROPALIGNMENT = 27;
public const int SPI_GETMINIMIZEDMETRICS = 43;
public const int SPI_GETMOUSE = 3;
public const int SPI_GETMOUSEKEYS = 54;
public const int SPI_GETMOUSETRAILS = 94;
public const int SPI_GETNONCLIENTMETRICS = 41;
public const int SPI_GETPOWEROFFACTIVE = 84;
public const int SPI_GETPOWEROFFTIMEOUT = 80;
public const int SPI_GETSCREENREADER = 70;
public const int SPI_GETSCREENSAVEACTIVE = 16;
public const int SPI_GETSCREENSAVETIMEOUT = 14;
public const int SPI_GETSERIALKEYS = 62;
public const int SPI_GETSHOWSOUNDS = 56;
public const int SPI_GETSOUNDSENTRY = 64;
public const int SPI_GETSTICKYKEYS = 58;
public const int SPI_GETTOGGLEKEYS = 52;
public const int SPI_GETWINDOWSEXTENSION = 92;
public const int SPI_GETWORKAREA = 48;
public const int SPI_ICONHORIZONTALSPACING = 13;
public const int SPI_ICONVERTICALSPACING = 24;
public const int SPI_LANGDRIVER = 12;
public const int SPI_SCREENSAVERRUNNING = 97;
public const int SPI_SETACCESSTIMEOUT = 61;
public const int SPI_SETANIMATION = 73;
public const int SPI_SETBEEP = 2;
public const int SPI_SETBORDER = 6;
public const int SPI_SETCURSORS = 87;
public const int SPI_SETDEFAULTINPUTLANG = 90;
public const int SPI_SETDESKPATTERN = 21;
public const int SPI_SETDESKWALLPAPER = 20;
public const int SPI_SETDOUBLECLICKTIME = 32;
public const int SPI_SETDOUBLECLKHEIGHT = 30;
public const int SPI_SETDOUBLECLKWIDTH = 29;
public const int SPI_SETDRAGFULLWINDOWS = 37;
public const int SPI_SETDRAGHEIGHT = 77;
public const int SPI_SETDRAGWIDTH = 76;
public const int SPI_SETFASTTASKSWITCH = 36;
public const int SPI_SETFILTERKEYS = 51;
public const int SPI_SETFONTSMOOTHING = 75;
public const int SPI_SETGRIDGRANULARITY = 19;
public const int SPI_SETHANDHELD = 78;
public const int SPI_SETHIGHCONTRAST = 67;
public const int SPI_SETICONMETRICS = 46;
public const int SPI_SETICONS = 88;
public const int SPI_SETICONTITLELOGFONT = 34;
public const int SPI_SETICONTITLEWRAP = 26;
public const int SPI_SETKEYBOARDDELAY = 23;
public const int SPI_SETKEYBOARDPREF = 69;
public const int SPI_SETKEYBOARDSPEED = 11;
public const int SPI_SETLANGTOGGLE = 91;
public const int SPI_SETLOWPOWERACTIVE = 85;
public const int SPI_SETLOWPOWERTIMEOUT = 81;
public const int SPI_SETMENUDROPALIGNMENT = 28;
public const int SPI_SETMINIMIZEDMETRICS = 44;
public const int SPI_SETMOUSE = 4;
public const int SPI_SETMOUSEBUTTONSWAP = 33;
public const int SPI_SETMOUSEKEYS = 55;
public const int SPI_SETMOUSETRAILS = 93;
public const int SPI_SETNONCLIENTMETRICS = 42;
public const int SPI_SETPENWINDOWS = 49;
public const int SPI_SETPOWEROFFACTIVE = 86;
public const int SPI_SETPOWEROFFTIMEOUT = 82;
public const int SPI_SETSCREENREADER = 71;
public const int SPI_SETSCREENSAVEACTIVE = 17;
public const int SPI_SETSCREENSAVETIMEOUT = 15;
public const int SPI_SETSERIALKEYS = 63;
public const int SPI_SETSHOWSOUNDS = 57;
public const int SPI_SETSOUNDSENTRY = 65;
public const int SPI_SETSTICKYKEYS = 59;
public const int SPI_SETTOGGLEKEYS = 53;
public const int SPI_SETWORKAREA = 47;
public const int SS_BLACKFRAME = 0x7;
public const int SS_BLACKRECT = 0x4;
public const int SS_CENTER = 0x1;
public const int SS_GRAYFRAME = 0x8;
public const int SS_GRAYRECT = 0x5;
public const int SS_ICON = 0x3;
public const int SS_LEFT = 0x0;
public const int SS_LEFTNOWORDWRAP = 0xC;
public const int SS_NOPREFIX = 0x80;
public const int SS_RIGHT = 0x2;
public const int SS_SIMPLE = 0xB;
public const int SS_USERITEM = 0xA;
public const int SS_WHITEFRAME = 0x9;
public const int SS_WHITERECT = 0x6;
public const int STM_GETICON = 0x171;
public const int STM_MSGMAX = 0x172;
public const int STM_SETICON = 0x170;
public const int ST_ADVISE = 0x2;
public const int ST_BEGINSWP = 0;
public const int ST_BLOCKED = 0x8;
public const int ST_BLOCKNEXT = 0x80;
public const int ST_CLIENT = 0x10;
public const int ST_CONNECTED = 0x1;
public const int ST_ENDSWP = 1;
public const int ST_INLIST = 0x40;
public const int ST_ISLOCAL = 0x4;
public const int ST_ISSELF = 0x100;
public const int ST_TERMINATED = 0x20;
public const int SWP_DRAWFRAME = SWP_FRAMECHANGED;
public const int SWP_FRAMECHANGED = 0x20;
public const int SWP_HIDEWINDOW = 0x80;
public const int SWP_NOACTIVATE = 0x10;
public const int SWP_NOCOPYBITS = 0x100;
public const int SWP_NOMOVE = 0x2;
public const int SWP_NOOWNERZORDER = 0x200;
public const int SWP_NOREDRAW = 0x8;
public const int SWP_NOREPOSITION = SWP_NOOWNERZORDER;
public const int SWP_NOSIZE = 0x1;
public const int SWP_NOZORDER = 0x4;
public const int SWP_SHOWWINDOW = 0x40;
public const int SW_ERASE = 0x4;
public const int SW_HIDE = 0;
public const int SW_INVALIDATE = 0x2;
public const int SW_MAX = 10;
public const int SW_MAXIMIZE = 3;
public const int SW_MINIMIZE = 6;
public const int SW_NORMAL = 1;
public const int SW_OTHERUNZOOM = 4;
public const int SW_OTHERZOOM = 2;
public const int SW_PARENTCLOSING = 1;
public const int SW_PARENTOPENING = 3;
public const int SW_RESTORE = 9;
public const int SW_SCROLLCHILDREN = 0x1;
public const int SW_SHOW = 5;
public const int SW_SHOWDEFAULT = 10;
public const int SW_SHOWMAXIMIZED = 3;
public const int SW_SHOWMINIMIZED = 2;
public const int SW_SHOWMINNOACTIVE = 7;
public const int SW_SHOWNA = 8;
public const int SW_SHOWNOACTIVATE = 4;
public const int SW_SHOWNORMAL = 1;
public const int TIMEOUT_ASYNC = 0xFFFF;
public const int TPM_CENTERALIGN = 0x4;
public const int TPM_LEFTALIGN = 0x0;
public const int TPM_LEFTBUTTON = 0x0;
public const int TPM_RIGHTALIGN = 0x8;
public const int TPM_RIGHTBUTTON = 0x2;
public const int VK_ADD = 0x6B;
public const int VK_ATTN = 0xF6;
public const int VK_BACK = 0x8;
public const int VK_CANCEL = 0x3;
public const int VK_CAPITAL = 0x14;
public const int VK_CLEAR = 0xC;
public const int VK_CONTROL = 0x11;
public const int VK_CRSEL = 0xF7;
public const int VK_DECIMAL = 0x6E;
public const int VK_DELETE = 0x2E;
public const int VK_DIVIDE = 0x6F;
public const int VK_DOWN = 0x28;
public const int VK_END = 0x23;
public const int VK_EREOF = 0xF9;
public const int VK_ESCAPE = 0x1B;
public const int VK_EXECUTE = 0x2B;
public const int VK_EXSEL = 0xF8;
public const int VK_F1 = 0x70;
public const int VK_F10 = 0x79;
public const int VK_F11 = 0x7A;
public const int VK_F12 = 0x7B;
public const int VK_F13 = 0x7C;
public const int VK_F14 = 0x7D;
public const int VK_F15 = 0x7E;
public const int VK_F16 = 0x7F;
public const int VK_F17 = 0x80;
public const int VK_F18 = 0x81;
public const int VK_F19 = 0x82;
public const int VK_F2 = 0x71;
public const int VK_F20 = 0x83;
public const int VK_F21 = 0x84;
public const int VK_F22 = 0x85;
public const int VK_F23 = 0x86;
public const int VK_F24 = 0x87;
public const int VK_F3 = 0x72;
public const int VK_F4 = 0x73;
public const int VK_F5 = 0x74;
public const int VK_F6 = 0x75;
public const int VK_F7 = 0x76;
public const int VK_F8 = 0x77;
public const int VK_F9 = 0x78;
public const int VK_HELP = 0x2F;
public const int VK_HOME = 0x24;
public const int VK_INSERT = 0x2D;
public const int VK_LBUTTON = 0x1;
public const int VK_LCONTROL = 0xA2;
public const int VK_LEFT = 0x25;
public const int VK_LMENU = 0xA4;
public const int VK_LSHIFT = 0xA0;
public const int VK_MBUTTON = 0x4;
public const int VK_MENU = 0x12;
public const int VK_MULTIPLY = 0x6A;
public const int VK_NEXT = 0x22;
public const int VK_NONAME = 0xFC;
public const int VK_NUMLOCK = 0x90;
public const int VK_NUMPAD0 = 0x60;
public const int VK_NUMPAD1 = 0x61;
public const int VK_NUMPAD2 = 0x62;
public const int VK_NUMPAD3 = 0x63;
public const int VK_NUMPAD4 = 0x64;
public const int VK_NUMPAD5 = 0x65;
public const int VK_NUMPAD6 = 0x66;
public const int VK_NUMPAD7 = 0x67;
public const int VK_NUMPAD8 = 0x68;
public const int VK_NUMPAD9 = 0x69;
public const int VK_OEM_CLEAR = 0xFE;
public const int VK_PA1 = 0xFD;
public const int VK_PAUSE = 0x13;
public const int VK_PLAY = 0xFA;
public const int VK_PRINT = 0x2A;
public const int VK_PRIOR = 0x21;
public const int VK_RBUTTON = 0x2;
public const int VK_RCONTROL = 0xA3;
public const int VK_RETURN = 0xD;
public const int VK_RIGHT = 0x27;
public const int VK_RMENU = 0xA5;
public const int VK_RSHIFT = 0xA1;
public const int VK_SCROLL = 0x91;
public const int VK_SELECT = 0x29;
public const int VK_SEPARATOR = 0x6C;
public const int VK_SHIFT = 0x10;
public const int VK_SNAPSHOT = 0x2C;
public const int VK_SPACE = 0x20;
public const int VK_SUBTRACT = 0x6D;
public const int VK_TAB = 0x9;
public const int VK_UP = 0x26;
public const int VK_ZOOM = 0xFB;
public const int WA_ACTIVE = 1;
public const int WA_CLICKACTIVE = 2;
public const int WA_INACTIVE = 0;
public const int WB_ISDELIMITER = 2;
public const int WB_LEFT = 0;
public const int WB_RIGHT = 1;
public const int WC_DIALOG = 8002;
public const int WH_CALLWNDPROC = 4;
public const int WH_CBT = 5;
public const int WH_DEBUG = 9;
public const int WH_FOREGROUNDIDLE = 11;
public const int WH_GETMESSAGE = 3;
public const int WH_HARDWARE = 8;
public const int WH_JOURNALPLAYBACK = 1;
public const int WH_JOURNALRECORD = 0;
public const int WH_KEYBOARD = 2;
public const int WH_MAX = 11;
public const int WH_MIN = (-1);
public const int WH_MOUSE = 7;
public const int WH_MSGFILTER = (-1);
public const int WH_SHELL = 10;
public const int WH_SYSMSGFILTER = 6;
public const int WINSTA_ACCESSCLIPBOARD = 0x4;
public const int WINSTA_ACCESSPUBLICATOMS = 0x20;
public const int WINSTA_CREATEDESKTOP = 0x8;
public const int WINSTA_ENUMDESKTOPS = 0x1;
public const int WINSTA_ENUMERATE = 0x100;
public const int WINSTA_EXITWINDOWS = 0x40;
public const int WINSTA_READATTRIBUTES = 0x2;
public const int WINSTA_READSCREEN = 0x200;
public const int WINSTA_WRITEATTRIBUTES = 0x10;
public const int WM_ACTIVATE = 0x6;
public const int WM_ACTIVATEAPP = 0x1C;
public const int WM_ASKCBFORMATNAME = 0x30C;
public const int WM_CANCELJOURNAL = 0x4B;
public const int WM_CANCELMODE = 0x1F;
public const int WM_CHANGECBCHAIN = 0x30D;
public const int WM_CHAR = 0x102;
public const int WM_CHARTOITEM = 0x2F;
public const int WM_CHILDACTIVATE = 0x22;
public const int WM_CLEAR = 0x303;
public const int WM_CLOSE = 0x10;
public const int WM_COMMAND = 0x111;
public const int WM_COMMNOTIFY = 0x44;
public const int WM_COMPACTING = 0x41;
public const int WM_COMPAREITEM = 0x39;
public const int WM_COPY = 0x301;
public const int WM_COPYDATA = 0x4A;
public const int WM_CREATE = 0x1;
public const int WM_CTLCOLORBTN = 0x135;
public const int WM_CTLCOLORDLG = 0x136;
public const int WM_CTLCOLOREDIT = 0x133;
public const int WM_CTLCOLORLISTBOX = 0x134;
public const int WM_CTLCOLORMSGBOX = 0x132;
public const int WM_CTLCOLORSCROLLBAR = 0x137;
public const int WM_CTLCOLORSTATIC = 0x138;
public const int WM_CUT = 0x300;
public const int WM_DDE_ACK = (WM_DDE_FIRST + 4);
public const int WM_DDE_ADVISE = (WM_DDE_FIRST + 2);
public const int WM_DDE_DATA = (WM_DDE_FIRST + 5);
public const int WM_DDE_EXECUTE = (WM_DDE_FIRST + 8);
public const int WM_DDE_FIRST = 0x3E0;
public const int WM_DDE_INITIATE = (WM_DDE_FIRST);
public const int WM_DDE_LAST = (WM_DDE_FIRST + 8);
public const int WM_DDE_POKE = (WM_DDE_FIRST + 7);
public const int WM_DDE_REQUEST = (WM_DDE_FIRST + 6);
public const int WM_DDE_TERMINATE = (WM_DDE_FIRST + 1);
public const int WM_DDE_UNADVISE = (WM_DDE_FIRST + 3);
public const int WM_DEADCHAR = 0x103;
public const int WM_DELETEITEM = 0x2D;
public const int WM_DESTROY = 0x2;
public const int WM_DESTROYCLIPBOARD = 0x307;
public const int WM_DEVMODECHANGE = 0x1B;
public const int WM_DRAWCLIPBOARD = 0x308;
public const int WM_DRAWITEM = 0x2B;
public const int WM_DROPFILES = 0x233;
public const int WM_ENABLE = 0xA;
public const int WM_ENDSESSION = 0x16;
public const int WM_ENTERIDLE = 0x121;
public const int WM_ENTERMENULOOP = 0x211;
public const int WM_ERASEBKGND = 0x14;
public const int WM_EXITMENULOOP = 0x212;
public const int WM_FONTCHANGE = 0x1D;
public const int WM_GETDLGCODE = 0x87;
public const int WM_GETFONT = 0x31;
public const int WM_GETHOTKEY = 0x33;
public const int WM_GETMINMAXINFO = 0x24;
public const int WM_GETTEXT = 0xD;
public const int WM_GETTEXTLENGTH = 0xE;
public const int WM_HOTKEY = 0x312;
public const int WM_HSCROLL = 0x114;
public const int WM_HSCROLLCLIPBOARD = 0x30E;
public const int WM_ICONERASEBKGND = 0x27;
public const int WM_INITDIALOG = 0x110;
public const int WM_INITMENU = 0x116;
public const int WM_INITMENUPOPUP = 0x117;
public const int WM_KEYDOWN = 0x100;
public const int WM_KEYFIRST = 0x100;
public const int WM_KEYLAST = 0x108;
public const int WM_KEYUP = 0x101;
public const int WM_KILLFOCUS = 0x8;
public const int WM_LBUTTONDBLCLK = 0x203;
public const int WM_LBUTTONDOWN = 0x201;
public const int WM_LBUTTONUP = 0x202;
public const int WM_MBUTTONDBLCLK = 0x209;
public const int WM_MBUTTONDOWN = 0x207;
public const int WM_MBUTTONUP = 0x208;
public const int WM_MDIACTIVATE = 0x222;
public const int WM_MDICASCADE = 0x227;
public const int WM_MDICREATE = 0x220;
public const int WM_MDIDESTROY = 0x221;
public const int WM_MDIGETACTIVE = 0x229;
public const int WM_MDIICONARRANGE = 0x228;
public const int WM_MDIMAXIMIZE = 0x225;
public const int WM_MDINEXT = 0x224;
public const int WM_MDIREFRESHMENU = 0x234;
public const int WM_MDIRESTORE = 0x223;
public const int WM_MDISETMENU = 0x230;
public const int WM_MDITILE = 0x226;
public const int WM_MEASUREITEM = 0x2C;
public const int WM_MENUCHAR = 0x120;
public const int WM_MENUSELECT = 0x11F;
public const int WM_MOUSEACTIVATE = 0x21;
public const int WM_MOUSEFIRST = 0x200;
public const int WM_MOUSELAST = 0x209;
public const int WM_MOUSEMOVE = 0x200;
public const int WM_MOVE = 0x3;
public const int WM_NCACTIVATE = 0x86;
public const int WM_NCCALCSIZE = 0x83;
public const int WM_NCCREATE = 0x81;
public const int WM_NCDESTROY = 0x82;
public const int WM_NCHITTEST = 0x84;
public const int WM_NCLBUTTONDBLCLK = 0xA3;
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int WM_NCLBUTTONUP = 0xA2;
public const int WM_NCMBUTTONDBLCLK = 0xA9;
public const int WM_NCMBUTTONDOWN = 0xA7;
public const int WM_NCMBUTTONUP = 0xA8;
public const int WM_NCMOUSEMOVE = 0xA0;
public const int WM_NCPAINT = 0x85;
public const int WM_NCRBUTTONDBLCLK = 0xA6;
public const int WM_NCRBUTTONDOWN = 0xA4;
public const int WM_NCRBUTTONUP = 0xA5;
public const int WM_NEXTDLGCTL = 0x28;
public const int WM_NULL = 0x0;
public const int WM_OTHERWINDOWCREATED = 0x42;
public const int WM_OTHERWINDOWDESTROYED = 0x43;
public const int WM_PAINT = 0xF;
public const int WM_PAINTCLIPBOARD = 0x309;
public const int WM_PAINTICON = 0x26;
public const int WM_PALETTECHANGED = 0x311;
public const int WM_PALETTEISCHANGING = 0x310;
public const int WM_PARENTNOTIFY = 0x210;
public const int WM_PASTE = 0x302;
public const int WM_PENWINFIRST = 0x380;
public const int WM_PENWINLAST = 0x38F;
public const int WM_POWER = 0x48;
public const int WM_QUERYDRAGICON = 0x37;
public const int WM_QUERYENDSESSION = 0x11;
public const int WM_QUERYNEWPALETTE = 0x30F;
public const int WM_QUERYOPEN = 0x13;
public const int WM_QUEUESYNC = 0x23;
public const int WM_QUIT = 0x12;
public const int WM_RBUTTONDBLCLK = 0x206;
public const int WM_RBUTTONDOWN = 0x204;
public const int WM_RBUTTONUP = 0x205;
public const int WM_RENDERALLFORMATS = 0x306;
public const int WM_RENDERFORMAT = 0x305;
public const int WM_SETCURSOR = 0x20;
public const int WM_SETFOCUS = 0x7;
public const int WM_SETFONT = 0x30;
public const int WM_SETHOTKEY = 0x32;
public const int WM_SETREDRAW = 0xB;
public const int WM_SETTEXT = 0xC;
public const int WM_SHOWWINDOW = 0x18;
public const int WM_SIZE = 0x5;
public const int WM_SIZECLIPBOARD = 0x30B;
public const int WM_SPOOLERSTATUS = 0x2A;
public const int WM_SYSCHAR = 0x106;
public const int WM_SYSCOLORCHANGE = 0x15;
public const int WM_SYSCOMMAND = 0x112;
public const int WM_SYSDEADCHAR = 0x107;
public const int WM_SYSKEYDOWN = 0x104;
public const int WM_SYSKEYUP = 0x105;
public const int WM_TIMECHANGE = 0x1E;
public const int WM_TIMER = 0x113;
public const int WM_UNDO = 0x304;
public const int WM_USER = 0x400;
public const int WM_VKEYTOITEM = 0x2E;
public const int WM_VSCROLL = 0x115;
public const int WM_VSCROLLCLIPBOARD = 0x30A;
public const int WM_WINDOWPOSCHANGED = 0x47;
public const int WM_WINDOWPOSCHANGING = 0x46;
public const int WM_WININICHANGE = 0x1A;
public const int WPF_RESTORETOMAXIMIZED = 0x2;
public const int WPF_SETMINPOSITION = 0x1;
public const int WRITE = 1;
public const int WS_BORDER = 0x800000;
public const int WS_CAPTION = 0xC00000;
public const int WS_CHILD = 0x40000000;
public const int WS_CHILDWINDOW = (WS_CHILD);
public const int WS_CLIPCHILDREN = 0x2000000;
public const int WS_CLIPSIBLINGS = 0x4000000;
public const int WS_DISABLED = 0x8000000;
public const int WS_DLGFRAME = 0x400000;
public const int WS_EX_ACCEPTFILES = 0x10;
public const int WS_EX_DLGMODALFRAME = 0x1;
public const int WS_EX_NOPARENTNOTIFY = 0x4;
public const int WS_EX_TOPMOST = 0x8;
public const int WS_EX_TRANSPARENT = 0x20;
public const int WS_GROUP = 0x20000;
public const int WS_HSCROLL = 0x100000;
public const int WS_ICONIC = WS_MINIMIZE;
public const int WS_MAXIMIZE = 0x1000000;
public const int WS_MAXIMIZEBOX = 0x10000;
public const int WS_MINIMIZE = 0x20000000;
public const int WS_MINIMIZEBOX = 0x20000;
public const int WS_OVERLAPPED = 0x0;
public const int WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
public const int WS_POPUP = unchecked((int)0x80000000);
public const int WS_POPUPWINDOW = (WS_POPUP | WS_BORDER | WS_SYSMENU);
public const int WS_SIZEBOX = WS_THICKFRAME;
public const int WS_SYSMENU = 0x80000;
public const int WS_TABSTOP = 0x10000;
public const int WS_THICKFRAME = 0x40000;
public const int WS_TILED = WS_OVERLAPPED;
public const int WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW;
public const int WS_VISIBLE = 0x10000000;
public const int WS_VSCROLL = 0x200000;
public const int WVR_ALIGNBOTTOM = 0x40;
public const int WVR_ALIGNLEFT = 0x20;
public const int WVR_ALIGNRIGHT = 0x80;
public const int WVR_ALIGNTOP = 0x10;
public const int WVR_HREDRAW = 0x100;
public const int WVR_REDRAW = (WVR_HREDRAW | WVR_VREDRAW);
public const int WVR_VALIDRECTS = 0x400;
public const int WVR_VREDRAW = 0x200;
public const int XCLASS_BOOL = 0x1000;
public const int XCLASS_DATA = 0x2000;
public const int XCLASS_FLAGS = 0x4000;
public const int XCLASS_MASK = 0xFC00;
public const int XCLASS_NOTIFICATION = 0x8000;
public const int XST_ADVACKRCVD = 13;
public const int XST_ADVDATAACKRCVD = 16;
public const int XST_ADVDATASENT = 15;
public const int XST_ADVSENT = 11;
public const int XST_CONNECTED = 2;
public const int XST_DATARCVD = 6;
public const int XST_EXECACKRCVD = 10;
public const int XST_EXECSENT = 9;
public const int XST_INCOMPLETE = 1;
public const int XST_INIT1 = 3;
public const int XST_INIT2 = 4;
public const int XST_NULL = 0;
public const int XST_POKEACKRCVD = 8;
public const int XST_POKESENT = 7;
public const int XST_REQSENT = 5;
public const int XST_UNADVACKRCVD = 14;
public const int XST_UNADVSENT = 12;
public const int XTYPF_ACKREQ = 0x8;
public const int XTYPF_NOBLOCK = 0x2;
public const int XTYPF_NODATA = 0x4;
public const int XTYP_ADVDATA = (0x10 | XCLASS_FLAGS);
public const int XTYP_ADVREQ = (0x20 | XCLASS_DATA | XTYPF_NOBLOCK);
public const int XTYP_ADVSTART = (0x30 | XCLASS_BOOL);
public const int XTYP_ADVSTOP = (0x40 | XCLASS_NOTIFICATION);
public const int XTYP_CONNECT = (0x60 | XCLASS_BOOL | XTYPF_NOBLOCK);
public const int XTYP_CONNECT_CONFIRM = (0x70 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK);
public const int XTYP_DISCONNECT = (0xC0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK);
public const int XTYP_ERROR = (0x0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK);
public const int XTYP_EXECUTE = (0x50 | XCLASS_FLAGS);
public const int XTYP_MASK = 0xF0;
public const int XTYP_MONITOR = (0xF0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK);
public const int XTYP_POKE = (0x90 | XCLASS_FLAGS);
public const int XTYP_REGISTER = (0xA0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK);
public const int XTYP_REQUEST = (0xB0 | XCLASS_DATA);
public const int XTYP_SHIFT = 4;
public const int XTYP_UNREGISTER = (0xD0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK);
public const int XTYP_WILDCONNECT = (0xE0 | XCLASS_DATA | XTYPF_NOBLOCK);
public const int XTYP_XACT_COMPLETE = (0x80 | XCLASS_NOTIFICATION);
public const string SZDDESYS_ITEM_FORMATS = "Formats";
public const string SZDDESYS_ITEM_HELP = "Help";
public const string SZDDESYS_ITEM_RTNMSG = "ReturnMessage";
public const string SZDDESYS_ITEM_STATUS = "Status";
public const string SZDDESYS_ITEM_SYSITEMS = "SysItems";
public const string SZDDESYS_ITEM_TOPICS = "Topics";
public const string SZDDESYS_TOPIC = "System";
public const string SZDDE_ITEM_ITEMLIST = "TopicItemList";
}
}


using System;
using System.Runtime.InteropServices;
namespace Win32
{
public struct RECT
{
public int Left;
public int
Top;
public int Right;
public int
Bottom;
}
public struct POINT
{
public int x;
public int
y;
}
public struct SIZE
{
public int
cx;
public int cy;
}
public struct FILETIME
{
public int dwLowDateTime;
public int
dwHighDateTime;
}
public struct SYSTEMTIME
{
public short wYear;
public short
wMonth;
public short wDayOfWeek;
public short
wDay;
public short wHour;
public short
wMinute;
public short wSecond;
public short
wMilliseconds;
}
}


using System;
using System.Runtime.InteropServices;
using HWND = System.IntPtr;
using HANDLE = System.IntPtr;
namespace Win32
{
public struct DRAGINFO
{
public int uSize;
public POINT
pt;
public int fNC;
public string
lpFileList;
public int grfKeyState;
}
public
struct APPBARDATA
{
public int
cbSize;
public HWND hwnd;
public int
uCallbackMessage;
public int uEdge;
public RECT
rc;
public int lParam;
}
public struct
SHFILEOPSTRUCT
{
public HWND
hwnd;
public int wFunc;
public string
pFrom;
public string pTo;
public short
fFlags;
public int fAnyOperationsAborted;
public
HANDLE hNameMappings;
public string lpszProgressTitle;
}
public struct SHNAMEMAPPING
{
public string pszOldPath;
public
string pszNewPath;
public int cchOldPath;
public
int cchNewPath;
}
public struct SHELLEXECUTEINFO
{
public int cbSize;
public int
fMask;
public HWND hwnd;
public string
lpVerb;
public string lpFile;
public string
lpParameters;
public string lpDirectory;
public
int nShow;
public HANDLE hInstApp;
public int
lpIDList;
public string lpClass;
public HANDLE
hkeyClass;
public int dwHotKey;
public HANDLE
hIcon;
public HANDLE hProcess;
}
public struct
NOTIFYICONDATA
{
public int
cbSize;
public HWND hwnd;
public int
uID;
public int uFlags;
public int
uCallbackMessage;
public HANDLE
hIcon;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=64)] public
string szTip;
}
public struct SHFILEINFO
{
public HANDLE hIcon;
public int
iIcon;
public int dwAttributes;
[MarshalAs(UnmanagedType.ByValArray,
SizeConst=Kernel.MAX_PATH)]public string szDisplayName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=80)] public string
szTypeName;
}
 public abstract class
Shell
{
[DllImport("shell32")] public static extern int
CommandLineToArgv(string lpCmdLine, short
pNumArgs);
[DllImport("shell32")] public static extern int
DoEnvironmentSubst(string szString, int
cbString);
[DllImport("shell32")] public static extern int
DragQueryFile(HANDLE hDROP, int UINT, string lpStr, int
ch);
[DllImport("shell32")] public static extern int
DragQueryPoint(HANDLE hDROP, ref POINT
lpPoint);
[DllImport("shell32")] public static extern int
DuplicateIcon(HANDLE hInst, HANDLE hIcon);
[DllImport("shell32")]
public static extern int ExtractAssociatedIcon(HANDLE hInst, string lpIconPath,
ref int lpiIcon);
[DllImport("shell32")] public static extern int
ExtractIcon(HANDLE hInst, string lpszExeFileName, int
nIconIndex);
[DllImport("shell32")] public static extern int
ExtractIconEx(string lpszFile, int nIconIndex, ref int phiconLarge, ref int
phiconSmall, int nIcons);
[DllImport("shell32")] public static
extern int FindExecutable(string lpFile, string lpDirectory, string
lpResult);
[DllImport("shell32")] public static extern int
SHAppBarMessage(int dwMessage, ref APPBARDATA
pData);
[DllImport("shell32")] public static extern int
SHFileOperation(ref SHFILEOPSTRUCT
lpFileOp);
[DllImport("shell32")] public static extern int
SHGetFileInfo(string pszPath, int dwFileAttributes, ref SHFILEINFO psfi, int
cbFileInfo, int uFlags);
[DllImport("shell32")] public static
extern int SHGetNewLinkInfo(string pszLinkto, string pszDir, string pszName, ref
int pfMustCopy, int uFlags);
[DllImport("shell32")] public static
extern int ShellAbout(HWND hwnd, string szApp, string szOtherStuff, HANDLE
hIcon);
[DllImport("shell32")] public static extern int
ShellExecute(HWND hwnd, string lpOperation, string lpFile, string lpParameters,
string lpDirectory, int nShowCmd);
[DllImport("shell32")] public
static extern int Shell_NotifyIcon(int dwMessage, ref NOTIFYICONDATA
lpData);
[DllImport("shell32")] public static extern void
DragAcceptFiles(HWND hwnd, int fAccept);
[DllImport("shell32")]
public static extern void DragFinish(HANDLE
hDrop);
[DllImport("shell32")] public static extern void
SHFreeNameMappings(HANDLE hNameMappings);
[DllImport("shell32")]
public static extern void WinExecError(HWND hwnd, int error, string
lpstrFileName, string lpstrTitle);
[DllImport("shell32")] public
static extern int SHBrowseForFolder(BROWSEINFO
lpbi);
[DllImport("shell32")] public static extern int
SHGetPathFromIDList(int pidList, string lpBuffer);
  public const int ABE_BOTTOM =
3;
public const int ABE_LEFT = 0;
public const int
ABE_RIGHT = 2;
public const int ABE_TOP =
1;
public const int ABM_ACTIVATE = 0x6;
public
const int ABM_GETAUTOHIDEBAR = 0x7;
public const int ABM_GETSTATE
= 0x4;
public const int ABM_GETTASKBARPOS =
0x5;
public const int ABM_NEW = 0x0;
public const
int ABM_QUERYPOS = 0x2;
public const int ABM_REMOVE =
0x1;
public const int ABM_SETAUTOHIDEBAR = 0x8;
public const int ABM_SETPOS = 0x3;
public const
int ABM_WINDOWPOSCHANGED = 0x9;
public const int
ABN_FULLSCREENAPP = 0x2;
public const int ABN_POSCHANGED =
0x1;
public const int ABN_STATECHANGE =
0x0;
public const int ABN_WINDOWARRANGE = 0x3;
public const int ABS_ALWAYSONTOP = 0x2;
public
const int ABS_AUTOHIDE = 0x1;
public const int EIRESID =
-1;
public const int FOF_ALLOWUNDO = 0x40;
public
const int FOF_CONFIRMMOUSE = 0x2;
public const int FOF_FILESONLY
= 0x80;
public const int FOF_MULTIDESTFILES =
0x1;
public const int FOF_NOCONFIRMATION = 0x10;
public const int FOF_NOCONFIRMMKDIR = 0x200;
public const int FOF_RENAMEONCOLLISION =
0x8;
public const int FOF_SILENT = 0x4;
public
const int FOF_SIMPLEPROGRESS = 0x100;
public const int
FOF_WANTMAPPINGHANDLE = 0x20;
public const int FO_COPY =
0x2;
public const int FO_DELETE = 0x3;
public
const int FO_MOVE = 0x1;
public const int FO_RENAME =
0x4;
public const int NIF_ICON = 0x2;
public const
int NIF_MESSAGE = 0x1;
public const int NIF_TIP =
0x4;
public const int NIM_ADD = 0x0;
public const
int NIM_DELETE = 0x2;
public const int NIM_MODIFY =
0x1;
public const int PO_DELETE = 0x13;
public
const int PO_PORTCHANGE = 0x20;
public const int PO_RENAME =
0x14;
public const int PO_REN_PORT = 0x34;
public const int SEE_MASK_CLASSKEY = 0x3;
public
const int SEE_MASK_CLASSNAME = 0x1;
public const int
SEE_MASK_CONNECTNETDRV = 0x80;
public const int
SEE_MASK_DOENVSUBST = 0x200;
public const int
SEE_MASK_FLAG_DDEWAIT = 0x100;
public const int
SEE_MASK_FLAG_NO_UI = 0x400;
public const int SEE_MASK_HOTKEY =
0x20;
public const int SEE_MASK_ICON =
0x10;
public const int SEE_MASK_IDLIST =
0x4;
public const int SEE_MASK_INVOKEIDLIST =
0xC;
public const int SEE_MASK_NOCLOSEPROCESS =
0x40;
public const int SE_ERR_ACCESSDENIED = 5;
public const int SE_ERR_ASSOCINCOMPLETE =
27;
public const int SE_ERR_DDEBUSY = 30;
public
const int SE_ERR_DDEFAIL = 29;
public const int SE_ERR_DDETIMEOUT
= 28;
public const int SE_ERR_DLLNOTFOUND =
32;
public const int SE_ERR_FNF = 2;
public const
int SE_ERR_NOASSOC = 31;
public const int SE_ERR_OOM = 8;
public const int SE_ERR_PNF = 3;
public const
int SE_ERR_SHARE = 26;
public const int SHGFI_ATTRIBUTES = 0x800;
public const int SHGFI_DISPLAYNAME = 0x200;
public const int SHGFI_EXETYPE = 0x2000;
public
const int SHGFI_ICON = 0x100;
public const int
SHGFI_ICONLOCATION = 0x1000;
public const int SHGFI_LARGEICON =
0x0;
public const int SHGFI_LINKOVERLAY = 0x8000;
public const int SHGFI_OPENICON = 0x2;
public
const int SHGFI_PIDL = 0x8;
public const int SHGFI_SELECTED =
0x10000;
public const int SHGFI_SHELLICONSIZE = 0x4;
public const int SHGFI_SMALLICON = 0x1;
public
const int SHGFI_SYSICONINDEX = 0x4000;
public const int
SHGFI_TYPENAME = 0x400;
public const int SHGFI_USEFILEATTRIBUTES
= 0x10;
public const int SHGNLI_PIDL = 0x1;
public const int SHGNLI_PREFIXNAME = 0x2;
}
}


using System;
using System.Runtime.InteropServices;
using System.Text;
using HANDLE = System.IntPtr;
using HWND = System.IntPtr;
namespace Win32
{
public struct NETRESOURCE
{
public int dwScope;
public int
dwType;
public int dwDisplayType;
public int
dwUsage;
public string lpLocalName;
public string
lpRemoteName;
public string lpComment;
public
string lpProvider;
}
public struct USER_INFO_3
{
public int Name;
public int
Password;
public int PasswordAge;
public int
Privilege;
public int HomeDir;
public int
Comment;
public int Flags;
public int
ScriptPath;
public int AuthFlags;
public int
FullName;
public int UserComment;
public int
Parms;
public int Workstations;
public int
LastLogon;
public int LastLogoff;
public int
AcctExpires;
public int MaxStorage;
public int
UnitsPerWeek;
public int LogonHours;
public int
BadPwCount;
public int NumLogons;
public int
LogonServer;
public int CountryCode;
public int
CodePage;
public int UserID;
public int
PrimaryGroupID;
public int Profile;
public int
HomeDirDrive;
public int
PasswordExpired;
}
public struct GROUP_INFO_2
{
public int Name;
public int
Comment;
public int GroupID;
public int
Attributes;
}
public struct LOCALGROUP_MEMBERS_INFO_0
{
public int pSID;
}
public struct
LOCALGROUP_MEMBERS_INFO_1
{
public int
pSID;
public g_netSID_NAME_USE eUsage;
public int
psName;
}
public struct WKSTA_INFO_102
{
public int wki102_platform_id;
public
int wki102_computername;
public int
wki102_langroup;
public int
wki102_ver_major;
public int
wki102_ver_minor;
public int
wki102_lanroot;
public int
wki102_logged_on_users;
}
public struct WKSTA_USER_INFO_1
{
public int wkui1_username;
public int
wkui1_logon_domain;
public int
wkui1_oth_domains;
public int
wkui1_logon_server;
}
public enum g_netSID_NAME_USE
{
SidTypeUser = 1,
SidTypeGroup =
2,
SidTypeDomain = 3,
SidTypeAlias =
4,
SidTypeWellKnownGroup =
5,
SidTypeDeletedAccount = 6,
SidTypeInvalid =
7,
SidTypeUnknown = 8,
}
public abstract class
Mpr
{
[DllImport("mpr")] public static extern int
WNetAddConnection(string lpszNetPath, string lpszPassword, string
lpszLocalName);
[DllImport("mpr")] public static extern int
WNetAddConnection2(ref NETRESOURCE lpNetResource, string lpPassword, string
lpUserName, int dwFlags);
[DllImport("mpr")] public static extern
int WNetCancelConnection(string lpszName, int
bForce);
[DllImport("mpr")] public static extern int
WNetCancelConnection2(string lpName, int dwFlags, int
fForce);
[DllImport("mpr")] public static extern int
WNetCloseEnum(HANDLE hEnum);
[DllImport("mpr")] public static
extern int WNetConnectionDialog(HWND hwnd, int
dwType);
[DllImport("mpr")] public static extern int
WNetDisconnectDialog(HWND hwnd, int dwType);
[DllImport("mpr")]
public static extern int WNetEnumResource(HANDLE hEnum, ref int lpcCount, ref
NETRESOURCE lpBuffer, ref int lpBufferSize);
[DllImport("mpr")]
public static extern int WNetGetConnection(string lpszLocalName, string
lpszRemoteName, int cbRemoteName);
[DllImport("mpr")] public
static extern int WNetGetLastError(int lpError, StringBuilder lpErrorBuf, int
nErrorBufSize, string lpNameBuf, int
nNameBufSize);
[DllImport("mpr")] public static extern int
WNetGetUser(string lpName, StringBuilder lpUserName, ref int
lpnLength);
[DllImport("mpr")] public static extern int
WNetOpenEnum(int dwScope, int dwType, int dwUsage, ref NETRESOURCE
lpNetResource, ref int lphEnum);
}
 public abstract class
NetApi
{
[DllImport("Netapi32")] public static extern
int NetApiBufferFree(int lpBuffer);
[DllImport("Netapi32")]
public static extern int NetRemoteTOD(IntPtr yServer, int
pBuffer);
[DllImport("Netapi32")] public static extern int
NetUserChangePassword(IntPtr Domain, IntPtr User, Byte OldPass, Byte
NewPass);
[DllImport("Netapi32")] public static extern int
NetUserGetGroups(IntPtr lpServer, Byte UserName, int Level, ref int lpBuffer,
int PrefMaxLen, ref int lpEntriesRead, ref int
lpTotalEntries);
[DllImport("Netapi32")] public static extern int
NetUserGetInfo(IntPtr lpServer, Byte UserName, int Level, ref int
lpBuffer);
[DllImport("Netapi32")] public static extern int
NetUserGetLocalGroups(IntPtr lpServer, Byte UserName, int Level, int Flags, ref
int lpBuffer, int MaxLen, ref int lpEntriesRead, ref int
lpTotalEntries);
[DllImport("Netapi32")] public static extern int
NetWkstaGetInfo(IntPtr lpServer, int Level, IntPtr
lpBuffer);
[DllImport("Netapi32")] public static extern int
NetWkstaUserGetInfo(IntPtr reserved, int Level, IntPtr
lpBuffer);
[DllImport("netapi32")] public static extern int
NetUserAdd(IntPtr lpServer, int Level, ref USER_INFO_3 lpUser, ref int
lpError);
[DllImport("netapi32")] public static extern int
NetLocalGroupDelMembers(int psServer, int psLocalGroup, int lLevel, ref
LOCALGROUP_MEMBERS_INFO_0 uMember, int
lMemberCount);
[DllImport("netapi32")] public static extern int
NetLocalGroupGetMembers(int psServer, int psLocalGroup, int lLevel, int pBuffer,
int lMaxLength, int plEntriesRead, int plTotalEntries, int phResume);
public const int CNLEN = 15;
public const int CONNECT_UPDATE_PROFILE = 0x1;
public const int FILTER_INTERDOMAIN_TRUST_ACCOUNT = 0x8;
public const int FILTER_NORMAL_ACCOUNT = 0x2;
public const int FILTER_PROXY_ACCOUNT = 0x4;
public const int FILTER_SERVER_TRUST_ACCOUNT = 0x20;
public const int FILTER_TEMP_DUPLICATE_ACCOUNT = 0x1;
public const int FILTER_WORKSTATION_TRUST_ACCOUNT = 0x10;
public const int GNLEN = UNLEN;
public const int LG_INCLUDE_INDIRECT = 0x1;
public const int LM20_PWLEN = 14;
public const int MAXCOMMENTSZ = 256;
public const int NERR_BASE = 2100;
public const int NERR_GroupExists = (NERR_BASE + 123);
public const int NERR_InvalidComputer = (NERR_BASE + 251);
public const int NERR_NotPrimary = (NERR_BASE + 126);
public const int NERR_PasswordTooShort = (NERR_BASE + 145);
public const int NERR_Success = 0;
public const int NERR_UserExists = (NERR_BASE + 124);
public const int PWLEN = 256;
public const int RESOURCEDISPLAYTYPE_DOMAIN = 0x1;
public const int RESOURCEDISPLAYTYPE_FILE = 0x4;
public const int RESOURCEDISPLAYTYPE_GENERIC = 0x0;
public const int RESOURCEDISPLAYTYPE_GROUP = 0x5;
public const int RESOURCEDISPLAYTYPE_SERVER = 0x2;
public const int RESOURCEDISPLAYTYPE_SHARE = 0x3;
public const int RESOURCETYPE_ANY = 0x0;
public const int RESOURCETYPE_DISK = 0x1;
public const int RESOURCETYPE_PRINT = 0x2;
public const int RESOURCETYPE_UNKNOWN = 0xFFFF;
public const int RESOURCEUSAGE_ALL = 0x0;
public const int RESOURCEUSAGE_CONNECTABLE = 0x1;
public const int RESOURCEUSAGE_CONTAINER = 0x2;
public const int RESOURCEUSAGE_RESERVED = unchecked((int)0x80000000);
public const int RESOURCE_CONNECTED = 0x1;
public const int RESOURCE_ENUM_ALL = 0xFFFF;
public const int RESOURCE_GLOBALNET = 0x2;
public const int RESOURCE_PUBLICNET = 0x2;
public const int RESOURCE_REMEMBERED = 0x3;
public const int TIMEQ_FOREVER = -1;
public const int UF_ACCOUNTDISABLE = 0x2;
public const int UF_HOMEDIR_REQUIRED = 0x8;
public const int UF_LOCKOUT = 0x10;
public const int UF_PASSWD_CANT_CHANGE = 0x40;
public const int UF_PASSWD_NOTREQD = 0x20;
public const int UF_SCRIPT = 0x1;
public const int UNITS_PER_DAY = 24;
public const int UNITS_PER_WEEK = UNITS_PER_DAY * 7;
public const int UNLEN = 256;
public const int USER_MAXSTORAGE_UNLIMITED = -1;
public const int USER_NO_LOGOFF = -1;
public const int USER_PRIV_ADMIN = 2;
public const int USER_PRIV_GUEST = 0;
public const int USER_PRIV_MASK = 3;
public const int USER_PRIV_USER = 1;
public const int WN_ACCESS_DENIED = ERROR.ERROR_ACCESS_DENIED;
public const int WN_ALREADY_CONNECTED = ERROR.ERROR_ALREADY_ASSIGNED;
public const int WN_BAD_LOCALNAME = ERROR.ERROR_BAD_DEVICE;
public const int WN_BAD_NETNAME = ERROR.ERROR_BAD_NET_NAME;
public const int WN_BAD_PASSWORD = ERROR.ERROR_INVALID_PASSWORD;
public const int WN_BAD_POINTER = ERROR.ERROR_INVALID_ADDRESS;
public const int WN_BAD_PROFILE = ERROR.ERROR_BAD_PROFILE;
public const int WN_BAD_PROVIDER = ERROR.ERROR_BAD_PROVIDER;
public const int WN_BAD_USER = ERROR.ERROR_BAD_USERNAME;
public const int WN_BAD_VALUE = ERROR.ERROR_INVALID_PARAMETER;
public const int WN_CANNOT_OPEN_PROFILE = ERROR.ERROR_CANNOT_OPEN_PROFILE;
public const int WN_CONNECTION_CLOSED = ERROR.ERROR_CONNECTION_UNAVAIL;
public const int WN_DEVICE_ERROR = ERROR.ERROR_GEN_FAILURE;
public const int WN_DEVICE_IN_USE = ERROR.ERROR_DEVICE_IN_USE;
public const int WN_EXTENDED_ERROR = ERROR.ERROR_EXTENDED_ERROR;
public const int WN_FUNCTION_BUSY = ERROR.ERROR_BUSY;
public const int WN_MORE_DATA = ERROR.ERROR_MORE_DATA;
public const int WN_NET_ERROR = ERROR.ERROR_UNEXP_NET_ERR;
public const int WN_NOT_CONNECTED = ERROR.ERROR_NOT_CONNECTED;
public const int WN_NOT_SUPPORTED = ERROR.ERROR_NOT_SUPPORTED;
public const int WN_NO_NETWORK = ERROR.ERROR_NO_NETWORK;
public const int WN_NO_NET_OR_BAD_PATH = ERROR.ERROR_NO_NET_OR_BAD_PATH;
public const int WN_OPEN_FILES = ERROR.ERROR_OPEN_FILES;
public const int WN_OUT_OF_MEMORY = ERROR.ERROR_NOT_ENOUGH_MEMORY;
public const int WN_SUCCESS = ERROR.NO_ERROR;
public const int WN_WINDOWS_ERROR = ERROR.ERROR_UNEXP_NET_ERR;
}
}


using System;
using System.Runtime.InteropServices;
using System.Text;
using HANDLE = System.IntPtr;
using HWND = System.IntPtr;
using HDC = System.IntPtr;
namespace Win32
{
public struct SMPTE
{
public byte hour;
public byte min;
public byte sec;
public byte frame;
public byte fps;
public byte dummy;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=2)] public byte pad;
}
public struct MIDI
{
public int songptrpos;
}
public struct MMTIME
{
public int wType;
public int u;
}
public struct MIDIEVENT
{
public int dwDeltaTime;
public int dwStreamID;
public int dwEvent;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=1)] public int dwParms;
}
public struct MIDISTRMBUFFVER
{
public int dwVersion;
public int dwMid;
public int dwOEMVersion;
}
public struct MIDIPROPTIMEDIV
{
public int cbStruct;
public int dwTimeDiv;
}
public struct MIDIPROPTEMPO
{
public int cbStruct;
public int dwTempo;
}
public struct MIXERCAPS
{
public short wMid;
public short wPid;
public int vDriverVersion;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=WinMM.MAXPNAMELEN)] public string szPname;
public int fdwSupport;
public int cDestinations;
}
public struct TARGET
{
public int dwType;
public int dwDeviceID;
public short wMid;
public short wPid;
public int vDriverVersion;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=WinMM.MAXPNAMELEN)]public string szPname;
}
public struct MIXERLINE
{
public int cbStruct;
public int dwDestination;
public int dwSource;
public int dwLineID;
public int fdwLine;
public int dwUser;
public int dwComponentType;
public int cChannels;
public int cConnections;
public int cControls;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=WinMM.MIXER_SHORT_NAME_CHARS)]
public string szShortName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=WinMM.MIXER_LONG_NAME_CHARS)]
public string szName;
public TARGET tTarget;
}
public struct MIXERCONTROL
{
public int cbStruct;
public int dwControlID;
public int dwControlType;
public int fdwControl;
public int cMultipleItems;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=WinMM.MIXER_SHORT_NAME_CHARS)] public string szShortName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=WinMM.MIXER_LONG_NAME_CHARS)] public string szName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=6)] public int[] Bounds;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=6)] public int[] Metrics;
}
public struct MIXERLINECONTROLS
{
public int cbStruct;
public int dwLineID;
public int dwControl;
public int cControls;
public int cbmxctrl;
public MIXERCONTROL pamxctrl;
}
public struct MIXERCONTROLDETAILS
{
public int cbStruct;
public int dwControlID;
public int cChannels;
public int item;
public int cbDetails;
public int paDetails;
}
public struct MIXERCONTROLDETAILS_LISTTEXT
{
public int dwParam1;
public int dwParam2;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=WinMM.MIXER_LONG_NAME_CHARS)] public string szName;
}
public struct MIXERCONTROLDETAILS_BOOLEAN
{
public int fValue;
}
public struct MIXERCONTROLDETAILS_SIGNED
{
public int lValue;
}
public struct MIXERCONTROLDETAILS_UNSIGNED
{
public int dwValue;
}
public struct JOYINFOEX
{
public int dwSize;
public int dwFlags;
public int dwXpos;
public int dwYpos;
public int dwZpos;
public int dwRpos;
public int dwUpos;
public int dwVpos;
public int dwButtons;
public int dwButtonNumber;
public int dwPOV;
public int dwReserved1;
public int dwReserved2;
}
public struct DRVCONFIGINFO
{
public int dwDCISize;
public string lpszDCISectionName;
public string lpszDCIAliasName;
public int dnDevNode;
}
public struct WAVEHDR
{
public string lpData;
public int dwBufferLength;
public int dwBytesRecorded;
public int dwUser;
public int dwFlags;
public int dwLoops;
public int lpNext;
public int Reserved;
}
public struct WAVEOUTCAPS
{
public short wMid;
public short wPid;
public int vDriverVersion;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=WinMM.MAXPNAMELEN)] public string szPname;
public int dwFormats;
public short wChannels;
public int dwSupport;
}
public struct WAVEINCAPS
{
public short wMid;
public short wPid;
public int vDriverVersion;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=WinMM.MAXPNAMELEN)]public string szPname;
public int dwFormats;
public short wChannels;
}
public struct WAVEFORMAT
{
public short wFormatTag;
public short nChannels;
public int nSamplesPerSec;
public int nAvgBytesPerSec;
public short nBlockAlign;
}
public struct PCMWAVEFORMAT
{
public WAVEFORMAT wf;
public short wBitsPerSample;
}
public struct MIDIOUTCAPS
{
public short wMid;
public short wPid;
public int vDriverVersion;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=WinMM.MAXPNAMELEN)]public string szPname;
public short wTechnology;
public short wVoices;
public short wNotes;
public short wChannelMask;
public int dwSupport;
}
public struct MIDIINCAPS
{
public short wMid;
public short wPid;
public int vDriverVersion;
public string szPname;
}
public struct MIDIHDR
{
public string lpData;
public int dwBufferLength;
public int dwBytesRecorded;
public int dwUser;
public int dwFlags;
public int lpNext;
public int Reserved;
}
public struct AUXCAPS
{
public short wMid;
public short wPid;
public int vDriverVersion;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=WinMM.MAXPNAMELEN)]public string szPname;
public short wTechnology;
public int dwSupport;
}
public struct TIMECAPS
{
public int wPeriodMin;
public int wPeriodMax;
}
public struct JOYCAPS
{
public short wMid;
public short wPid;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=WinMM.MAXPNAMELEN)] public string szPname;
public short wXmin;
public short wXmax;
public short wYmin;
public short wYmax;
public short wZmin;
public short wZmax;
public short wNumButtons;
public short wPeriodMin;
public short wPeriodMax;
}
public struct JOYINFO
{
public int wXpos;
public int wYpos;
public int wZpos;
public int wButtons;
}
public struct MMIOINFO
{
public int dwFlags;
public int fccIOProc;
public int pIOProc;
public int wErrorRet;
public HANDLE htask;
public int cchBuffer;
public string pchBuffer;
public string pchNext;
public string pchEndRead;
public string pchEndWrite;
public int lBufOffset;
public int lDiskOffset;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=4)] public int adwInfo;
public int dwReserved1;
public int dwReserved2;
public HANDLE hmmio;
}
public struct MMCKINFO
{
public int ckid;
public int ckSize;
public int fccType;
public int dwDataOffset;
public int dwFlags;
}
public struct MCI_GENERIC_PARMS
{
public int dwCallback;
}
public struct MCI_OPEN_PARMS
{
public int dwCallback;
public int wDeviceID;
public string lpstrDeviceType;
public string lpstrElementName;
public string lpstrAlias;
}
public struct MCI_PLAY_PARMS
{
public int dwCallback;
public int dwFrom;
public int dwTo;
}
public struct MCI_SEEK_PARMS
{
public int dwCallback;
public int dwTo;
}
public struct MCI_STATUS_PARMS
{
public int dwCallback;
public int dwReturn;
public int dwItem;
public short dwTrack;
}
public struct MCI_INFO_PARMS
{
public int dwCallback;
public string lpstrReturn;
public int dwRetSize;
}
public struct MCI_GETDEVCAPS_PARMS
{
public int dwCallback;
public int dwReturn;
public int dwIten;
}
public struct MCI_SYSINFO_PARMS
{
public int dwCallback;
public string lpstrReturn;
public int dwRetSize;
public int dwNumber;
public int wDeviceType;
}
public struct MCI_SET_PARMS
{
public int dwCallback;
public int dwTimeFormat;
public int dwAudio;
}
public struct MCI_BREAK_PARMS
{
public int dwCallback;
public int nVirtKey;
public HWND hwndBreak;
}
public struct MCI_SOUND_PARMS
{
public int dwCallback;
public string lpstrSoundName;
}
public struct MCI_SAVE_PARMS
{
public int dwCallback;
public string lpFileName;
}
public struct MCI_LOAD_PARMS
{
public int dwCallback;
public string lpFileName;
}
public struct MCI_RECORD_PARMS
{
public int dwCallback;
public int dwFrom;
public int dwTo;
}
public struct MCI_VD_PLAY_PARMS
{
public int dwCallback;
public int dwFrom;
public int dwTo;
public int dwSpeed;
}
public struct MCI_VD_STEP_PARMS
{
public int dwCallback;
public int dwFrames;
}
public struct MCI_VD_ESCAPE_PARMS
{
public int dwCallback;
public string lpstrCommand;
}
public struct MCI_WAVE_OPEN_PARMS
{
public int dwCallback;
public int wDeviceID;
public string lpstrDeviceType;
public string lpstrElementName;
public string lpstrAlias;
public int dwBufferSeconds;
}
public struct MCI_WAVE_DELETE_PARMS
{
public int dwCallback;
public int dwFrom;
public int dwTo;
}
public struct MCI_WAVE_SET_PARMS
{
public int dwCallback;
public int dwTimeFormat;
public int dwAudio;
public int wInput;
public int wOutput;
public short wFormatTag;
public short wReserved2;
public short nChannels;
public short wReserved3;
public int nSamplesPerSec;
public int nAvgBytesPerSec;
public short nBlockAlign;
public short wReserved4;
public short wBitsPerSample;
public short wReserved5;
}
public struct MCI_SEQ_SET_PARMS
{
public int dwCallback;
public int dwTimeFormat;
public int dwAudio;
public int dwTempo;
public int dwPort;
public int dwSlave;
public int dwMaster;
public int dwOffset;
}
public struct MCI_ANIM_OPEN_PARMS
{
public int dwCallback;
public int wDeviceID;
public string lpstrDeviceType;
public string lpstrElementName;
public string lpstrAlias;
public int dwStyle;
public HWND hwndParent;
}
public struct MCI_ANIM_PLAY_PARMS
{
public int dwCallback;
public int dwFrom;
public int dwTo;
public int dwSpeed;
}
public struct MCI_ANIM_STEP_PARMS
{
public int dwCallback;
public int dwFrames;
}
public struct MCI_ANIM_WINDOW_PARMS
{
public int dwCallback;
public HWND hwnd;
public int nCmdShow;
public string lpstrText;
}
public struct MCI_ANIM_RECT_PARMS
{
public int dwCallback;
public RECT rc;
}
public struct MCI_ANIM_UPDATE_PARMS
{
public int dwCallback;
public RECT rc;
public HDC hdc;
}
public struct MCI_OVLY_OPEN_PARMS
{
public int dwCallback;
public int wDeviceID;
public string lpstrDeviceType;
public string lpstrElementName;
public string lpstrAlias;
public int dwStyle;
public HWND hwndParent;
}
public struct MCI_OVLY_WINDOW_PARMS
{
public int dwCallback;
public HWND hwnd;
public int nCmdShow;
public string lpstrText;
}
public struct MCI_OVLY_RECT_PARMS
{
public int dwCallback;
public RECT rc;
}
public struct MCI_OVLY_SAVE_PARMS
{
public int dwCallback;
public string lpFileName;
public RECT rc;
}
public struct MCI_OVLY_LOAD_PARMS
{
public int dwCallback;
public string lpFileName;
public RECT rc;
}
 public abstract class
LZ
{
[DllImport("lz32")] public static extern int
CopyLZFile(int n1, int n2);
[DllImport("lz32")] public static
extern int LZStart();
[DllImport("lz32")] public static extern
void LZDone();
[DllImport("lz32")] public static extern int
GetExpandedName(string lpszSource, StringBuilder
lpszBuffer);
[DllImport("lz32")] public static extern int
LZCopy(HANDLE hfSource, HANDLE hfDest);
[DllImport("lz32")]
public static extern int LZInit(HANDLE
hfSrc);
[DllImport("lz32")] public static extern int
LZOpenFile(string lpszFile, ref OFSTRUCT lpOf, int
style);
[DllImport("lz32")] public static extern int
LZRead(HANDLE hfFile, string lpvBuf, int
cbread);
[DllImport("lz32")] public static extern int
LZSeek(HANDLE hfFile, int lOffset, int
nOrigin);
[DllImport("lz32")] public static extern void
LZClose(HANDLE hfFile);
}
public abstract class
WinMM
{
[DllImport("winmm")] public static extern int
mciGetYieldProc(int mciId, ref int
pdwYieldData);
[DllImport("winmm")] public static extern int
mciSetYieldProc(int mciId, int fpYieldProc, int
dwYieldData);
[DllImport("winmm")] public static extern int
mmioInstallIOProcA(int fccIOProc, ref int pIOProc, int
dwFlags);
[DllImport("winmm")] public static extern short
midiOutGetNumDevs();
[DllImport("winmm")] public static extern
int CloseDriver(HANDLE hDriver, int lParam1, int
lParam2);
[DllImport("winmm")] public static extern int
DefDriverProc(int dwDriverIdentifier, HANDLE hdrvr, int uMsg, int lParam1, int
lParam2);
[DllImport("winmm")] public static extern int
DrvGetModuleHandle(HANDLE hDriver);
[DllImport("winmm")] public
static extern int GetDriverModuleHandle(HANDLE
hDriver);
[DllImport("winmm")] public static extern int
OpenDriver(string szDriverName, string szSectionName, int
lParam2);
[DllImport("winmm")] public static extern int
PlaySound(string lpszName, HANDLE hModule, int
dwFlags);
[DllImport("winmm")] public static extern int
SendDriverMessage(HANDLE hDriver, int message, int lParam1, int
lParam2);
[DllImport("winmm")] public static extern int
auxGetDevCaps(int uDeviceID, ref AUXCAPS lpCaps, int
uSize);
[DllImport("winmm")] public static extern int
auxGetNumDevs();
[DllImport("winmm")] public static extern int
auxGetVolume(int uDeviceID, ref int
lpdwVolume);
[DllImport("winmm")] public static extern int
auxOutMessage(int uDeviceID, int msg, int dw1, int
dw2);
[DllImport("winmm")] public static extern int
auxSetVolume(int uDeviceID, int dwVolume);
[DllImport("winmm")]
public static extern int joyGetDevCaps(int id, ref JOYCAPS lpCaps, int
uSize);
[DllImport("winmm")] public static extern int
joyGetNumDevs();
[DllImport("winmm")] public static extern int
joyGetPos(int uJoyID, ref JOYINFO pji);
[DllImport("winmm")]
public static extern int joyGetPosEx(int uJoyID, ref JOYINFOEX
pji);
[DllImport("winmm")] public static extern int
joyGetThreshold(int id, ref int
lpuThreshold);
[DllImport("winmm")] public static extern int
joyReleaseCapture(int id);
[DllImport("winmm")] public static
extern int joySetCapture(HWND hwnd, int uID, int uPeriod, int
bChanged);
[DllImport("winmm")] public static extern int
joySetThreshold(int id, int uThreshold);
[DllImport("winmm")]
public static extern int mciExecute(string
lpstrCommand);
[DllImport("winmm")] public static extern int
mciGetCreatorTask(int wDeviceID);
[DllImport("winmm")] public
static extern int mciGetDeviceID(string
lpstrName);
[DllImport("winmm")] public static extern int
mciGetDeviceIDFromElementID(int dwElementID, string
lpstrType);
[DllImport("winmm")] public static extern int
mciGetErrorString(int dwError, string lpstrBuffer, int
uLength);
[DllImport("winmm")] public static extern int
mciSendCommand(int wDeviceID, int uMessage, int dwParam1, IntPtr
dwParam2);
[DllImport("winmm")] public static extern int
mciSendString(string lpstrCommand, StringBuilder lpstrReturnString, int
uReturnLength, HWND hwndCallback);
[DllImport("winmm")] public
static extern int midiConnect(HANDLE hmi, HANDLE hmo, IntPtr
pReserved);
[DllImport("winmm")] public static extern int
midiDisconnect(HANDLE hmi, HANDLE hmo, IntPtr
pReserved);
[DllImport("winmm")] public static extern int
midiInAddBuffer(HANDLE hMidiIn, ref MIDIHDR lpMidiInHdr, int
uSize);
[DllImport("winmm")] public static extern int
midiInClose(HANDLE hMidiIn);
[DllImport("winmm")] public static
extern int midiInGetDevCaps(int uDeviceID, ref MIDIINCAPS lpCaps, int
uSize);
[DllImport("winmm")] public static extern int
midiInGetErrorText(int err, string lpText, int
uSize);
[DllImport("winmm")] public static extern int
midiInGetID(HANDLE hMidiIn, ref int
lpuDeviceID);
[DllImport("winmm")] public static extern int
midiInGetNumDevs();
[DllImport("winmm")] public static extern int
midiInMessage(HANDLE hMidiIn, int msg, int dw1, int
dw2);
[DllImport("winmm")] public static extern int
midiInOpen(int lphMidiIn, int uDeviceID, int dwCallback, int dwInstance, int
dwFlags);
[DllImport("winmm")] public static extern int
midiInPrepareHeader(HANDLE hMidiIn, ref MIDIHDR lpMidiInHdr, int
uSize);
[DllImport("winmm")] public static extern int
midiInReset(HANDLE hMidiIn);
[DllImport("winmm")] public static
extern int midiInStart(HANDLE hMidiIn);
[DllImport("winmm")]
public static extern int midiInStop(HANDLE
hMidiIn);
[DllImport("winmm")] public static extern int
midiInUnprepareHeader(HANDLE hMidiIn, ref MIDIHDR lpMidiInHdr, int
uSize);
[DllImport("winmm")] public static extern int
midiOutCacheDrumPatches(HANDLE hMidiOut, int uPatch, ref int lpKeyArray, int
uFlags);
[DllImport("winmm")] public static extern int
midiOutCachePatches(HANDLE hMidiOut, int uBank, ref int lpPatchArray, int
uFlags);
[DllImport("winmm")] public static extern int
midiOutClose(HANDLE hMidiOut);
[DllImport("winmm")] public static
extern int midiOutGetDevCaps(int uDeviceID, ref MIDIOUTCAPS lpCaps, int
uSize);
[DllImport("winmm")] public static extern int
midiOutGetErrorText(int err, StringBuilder lpText, int
uSize);
[DllImport("winmm")] public static extern int
midiOutGetID(HANDLE hMidiOut, ref int
lpuDeviceID);
[DllImport("winmm")] public static extern int
midiOutGetVolume(int uDeviceID, ref int
lpdwVolume);
[DllImport("winmm")] public static extern int
midiOutLongMsg(HANDLE hMidiOut, ref MIDIHDR lpMidiOutHdr, int
uSize);
[DllImport("winmm")] public static extern int
midiOutMessage(HANDLE hMidiOut, int msg, int dw1, int
dw2);
[DllImport("winmm")] public static extern int
midiOutOpen(int lphMidiOut, int uDeviceID, int dwCallback, int dwInstance, int
dwFlags);
[DllImport("winmm")] public static extern int
midiOutPrepareHeader(HANDLE hMidiOut, ref MIDIHDR lpMidiOutHdr, int
uSize);
[DllImport("winmm")] public static extern int
midiOutReset(HANDLE hMidiOut);
[DllImport("winmm")] public static
extern int midiOutSetVolume(int uDeviceID, int
dwVolume);
[DllImport("winmm")] public static extern int
midiOutShortMsg(HANDLE hMidiOut, int dwMsg);
[DllImport("winmm")]
public static extern int midiOutUnprepareHeader(HANDLE hMidiOut, ref MIDIHDR
lpMidiOutHdr, int uSize);
[DllImport("winmm")] public static
extern int midiStreamClose(HANDLE hms);
[DllImport("winmm")]
public static extern int midiStreamOpen(int phms, int puDeviceID, int cMidi, int
dwCallback, int dwInstance, int fdwOpen);
[DllImport("winmm")]
public static extern int midiStreamOut(HANDLE hms, ref MIDIHDR pmh, int
cbmh);
[DllImport("winmm")] public static extern int
midiStreamPause(HANDLE hms);
[DllImport("winmm")] public static
extern int midiStreamPosition(HANDLE hms, ref MMTIME lpmmt, int
cbmmt);
[DllImport("winmm")] public static extern int
midiStreamProperty(HANDLE hms, Byte lppropdata, int
dwProperty);
[DllImport("winmm")] public static extern int
midiStreamRestart(HANDLE hms);
[DllImport("winmm")] public static
extern int midiStreamStop(HANDLE hms);
[DllImport("winmm")]
public static extern int mixerClose(HANDLE
hmx);
[DllImport("winmm")] public static extern int
mixerGetControlDetails(HANDLE hmxobj, ref MIXERCONTROLDETAILS pmxcd, int
fdwDetails);
[DllImport("winmm")] public static extern int
mixerGetDevCaps(int uMxId, ref MIXERCAPS pmxcaps, int
cbmxcaps);
[DllImport("winmm")] public static extern int
mixerGetID(HANDLE hmxobj, ref int pumxID, int
fdwId);
[DllImport("winmm")] public static extern int
mixerGetLineControls(HANDLE hmxobj, ref MIXERLINECONTROLS pmxlc, int
fdwControls);
[DllImport("winmm")] public static extern int
mixerGetLineInfo(HANDLE hmxobj, ref MIXERLINE pmxl, int
fdwInfo);
[DllImport("winmm")] public static extern int
mixerGetNumDevs();
[DllImport("winmm")] public static extern int
mixerMessage(HANDLE hmx, int uMsg, int dwParam1, int
dwParam2);
[DllImport("winmm")] public static extern int
mixerOpen(int phmx, int uMxId, int dwCallback, int dwInstance, int
fdwOpen);
[DllImport("winmm")] public static extern int
mixerSetControlDetails(HANDLE hmxobj, ref MIXERCONTROLDETAILS pmxcd, int
fdwDetails);
[DllImport("winmm")] public static extern int
mmioAdvance(HANDLE hmmio, ref MMIOINFO lpmmioinfo, int
uFlags);
[DllImport("winmm")] public static extern int
mmioAscend(HANDLE hmmio, ref MMCKINFO lpck, int
uFlags);
[DllImport("winmm")] public static extern int
mmioClose(HANDLE hmmio, int uFlags);
[DllImport("winmm")] public
static extern int mmioCreateChunk(HANDLE hmmio, ref MMCKINFO lpck, int
uFlags);
[DllImport("winmm")] public static extern int
mmioDescend(HANDLE hmmio, ref MMCKINFO lpck, ref MMCKINFO lpckParent, int
uFlags);
[DllImport("winmm")] public static extern int
mmioFlush(HANDLE hmmio, int uFlags);
[DllImport("winmm")] public
static extern int mmioGetInfo(HANDLE hmmio, ref MMIOINFO lpmmioinfo, int
uFlags);
[DllImport("winmm")] public static extern int
mmioOpen(string szFileName, ref MMIOINFO lpmmioinfo, int
dwOpenFlags);
[DllImport("winmm")] public static extern int
mmioRead(HANDLE hmmio, string pch, int cch);
[DllImport("winmm")]
public static extern int mmioRename(string szFileName, string SzNewFileName, ref
MMIOINFO lpmmioinfo, int dwRenameFlags);
[DllImport("winmm")]
public static extern int mmioSeek(HANDLE hmmio, int lOffset, int
iOrigin);
[DllImport("winmm")] public static extern int
mmioSendMessage(HANDLE hmmio, int uMsg, int lParam1, int
lParam2);
[DllImport("winmm")] public static extern int
mmioSetBuffer(HANDLE hmmio, string pchBuffer, int cchBuffer, int
uFlags);
[DllImport("winmm")] public static extern int
mmioSetInfo(HANDLE hmmio, ref MMIOINFO lpmmioinfo, int
uFlags);
[DllImport("winmm")] public static extern int
mmioStringToFOURCC(string sz, int uFlags);
[DllImport("winmm")]
public static extern int mmioWrite(HANDLE hmmio, string pch, int
cch);
[DllImport("winmm")] public static extern int
mmsystemGetVersion();
[DllImport("winmm")] public static extern
int sndPlaySound(string lpszSoundName, int
uFlags);
[DllImport("winmm")] public static extern int
timeBeginPeriod(int uPeriod);
[DllImport("winmm")] public static
extern int timeEndPeriod(int uPeriod);
[DllImport("winmm")]
public static extern int timeGetDevCaps(ref TIMECAPS lpTimeCaps, int
uSize);
[DllImport("winmm")] public static extern int
timeGetSystemTime(ref MMTIME lpTime, int
uSize);
[DllImport("winmm")] public static extern int
timeGetTime();
[DllImport("winmm")] public static extern int
timeKillEvent(int uID);
[DllImport("winmm")] public static extern
int timeSetEvent(int uDelay, int uResolution, ref int lpFunction, int dwUser,
int uFlags);
[DllImport("winmm")] public static extern int
waveInAddBuffer(HANDLE hWaveIn, ref WAVEHDR lpWaveInHdr, int
uSize);
[DllImport("winmm")] public static extern int
waveInClose(HANDLE hWaveIn);
[DllImport("winmm")] public static
extern int waveInGetDevCaps(int uDeviceID, ref WAVEINCAPS lpCaps, int
uSize);
[DllImport("winmm")] public static extern int
waveInGetErrorText(int err, string lpText, int
uSize);
[DllImport("winmm")] public static extern int
waveInGetID(HANDLE hWaveIn, ref int
lpuDeviceID);
[DllImport("winmm")] public static extern int
waveInGetNumDevs();
[DllImport("winmm")] public static extern int
waveInGetPosition(HANDLE hWaveIn, ref MMTIME lpInfo, int
uSize);
[DllImport("winmm")] public static extern int
waveInMessage(HANDLE hWaveIn, int msg, int dw1, int
dw2);
[DllImport("winmm")] public static extern int
waveInOpen(int lphWaveIn, int uDeviceID, ref WAVEFORMAT lpFormat, int
dwCallback, int dwInstance, int dwFlags);
[DllImport("winmm")]
public static extern int waveInPrepareHeader(HANDLE hWaveIn, ref WAVEHDR
lpWaveInHdr, int uSize);
[DllImport("winmm")] public static
extern int waveInReset(HANDLE hWaveIn);
[DllImport("winmm")]
public static extern int waveInStart(HANDLE
hWaveIn);
[DllImport("winmm")] public static extern int
waveInStop(HANDLE hWaveIn);
[DllImport("winmm")] public static
extern int waveInUnprepareHeader(HANDLE hWaveIn, ref WAVEHDR lpWaveInHdr, int
uSize);
[DllImport("winmm")] public static extern int
waveOutBreakLoop(HANDLE hWaveOut);
[DllImport("winmm")] public
static extern int waveOutClose(HANDLE
hWaveOut);
[DllImport("winmm")] public static extern int
waveOutGetDevCaps(int uDeviceID, ref WAVEOUTCAPS lpCaps, int
uSize);
[DllImport("winmm")] public static extern int
waveOutGetErrorText(int err, string lpText, int
uSize);
[DllImport("winmm")] public static extern int
waveOutGetID(HANDLE hWaveOut, ref int
lpuDeviceID);
[DllImport("winmm")] public static extern int
waveOutGetNumDevs();
[DllImport("winmm")] public static extern
int waveOutGetPitch(HANDLE hWaveOut, ref int
lpdwPitch);
[DllImport("winmm")] public static extern int
waveOutGetPlaybackRate(HANDLE hWaveOut, ref int
lpdwRate);
[DllImport("winmm")] public static extern int
waveOutGetPosition(HANDLE hWaveOut, ref MMTIME lpInfo, int
uSize);
[DllImport("winmm")] public static extern int
waveOutGetVolume(int uDeviceID, ref int
lpdwVolume);
[DllImport("winmm")] public static extern int
waveOutMessage(HANDLE hWaveOut, int msg, int dw1, int
dw2);
[DllImport("winmm")] public static extern int
waveOutOpen(int lphWaveOut, int uDeviceID, ref WAVEFORMAT lpFormat, int
dwCallback, int dwInstance, int dwFlags);
[DllImport("winmm")]
public static extern int waveOutPause(HANDLE
hWaveOut);
[DllImport("winmm")] public static extern int
waveOutPrepareHeader(HANDLE hWaveOut, ref WAVEHDR lpWaveOutHdr, int
uSize);
[DllImport("winmm")] public static extern int
waveOutReset(HANDLE hWaveOut);
[DllImport("winmm")] public static
extern int waveOutRestart(HANDLE hWaveOut);
[DllImport("winmm")]
public static extern int waveOutSetPitch(HANDLE hWaveOut, int
dwPitch);
[DllImport("winmm")] public static extern int
waveOutSetPlaybackRate(HANDLE hWaveOut, int
dwRate);
[DllImport("winmm")] public static extern int
waveOutSetVolume(int uDeviceID, int
dwVolume);
[DllImport("winmm")] public static extern int
waveOutUnprepareHeader(HANDLE hWaveOut, ref WAVEHDR lpWaveOutHdr, int
uSize);
[DllImport("winmm")] public static extern int
waveOutWrite(HANDLE hWaveOut, ref WAVEHDR lpWaveOutHdr, int uSize);
public const int AUXCAPS_AUXIN = 2;
public const int AUXCAPS_CDAUDIO = 1;
public const int AUXCAPS_LRVOLUME = 0x2;
public const int AUXCAPS_VOLUME = 0x1;
public const int AUX_MAPPER = -1;
public const int C1_TRANSPARENT = 0x1;
public const int CALLBACK_FUNCTION = 0x30000;
public const int CALLBACK_NULL = 0x0;
public const int CALLBACK_TASK = 0x20000;
public const int CALLBACK_TYPEMASK = 0x70000;
public const int CALLBACK_WINDOW = 0x10000;
public const int CAPS1 = 94;
public const int DRVCNF_CANCEL = 0x0;
public const int DRVCNF_OK = 0x1;
public const int DRVCNF_RESTART = 0x2;
public const int DRV_CANCEL = DRVCNF_CANCEL;
public const int DRV_CLOSE = 0x4;
public const int DRV_CONFIGURE = 0x7;
public const int DRV_DISABLE = 0x5;
public const int DRV_ENABLE = 0x2;
public const int DRV_EXITSESSION = 0xB;
public const int DRV_FREE = 0x6;
public const int DRV_INSTALL = 0x9;
public const int DRV_LOAD = 0x1;
public const int DRV_MCI_FIRST = DRV_RESERVED;
public const int DRV_MCI_LAST = DRV_RESERVED + 0xFFF;
public const int DRV_OK = DRVCNF_OK;
public const int DRV_OPEN = 0x3;
public const int DRV_POWER = 0xF;
public const int DRV_QUERYCONFIGURE = 0x8;
public const int DRV_REMOVE = 0xA;
public const int DRV_RESERVED = 0x800;
public const int DRV_RESTART = DRVCNF_RESTART;
public const int DRV_USER = 0x4000;
public const int JOYERR_BASE = 160;
public const int JOYERR_NOCANDO = (JOYERR_BASE + 6);
public const int JOYERR_NOERROR = (0);
public const int JOYERR_PARMS = (JOYERR_BASE + 5);
public const int JOYERR_UNPLUGGED = (JOYERR_BASE + 7);
public const int JOYSTICKID1 = 0;
public const int JOYSTICKID2 = 1;
public const int JOY_BUTTON1 = 0x1;
public const int JOY_BUTTON10 = 0x200;
public const int JOY_BUTTON11 = 0x400;
public const int JOY_BUTTON12 = 0x800;
public const int JOY_BUTTON13 = 0x1000;
public const int JOY_BUTTON14 = 0x2000;
public const int JOY_BUTTON15 = 0x4000;
public const int JOY_BUTTON16 = 0x8000;
public const int JOY_BUTTON17 = 0x10000;
public const int JOY_BUTTON18 = 0x20000;
public const int JOY_BUTTON19 = 0x40000;
public const int JOY_BUTTON1CHG = 0x100;
public const int JOY_BUTTON2 = 0x2;
public const int JOY_BUTTON20 = 0x80000;
public const int JOY_BUTTON21 = 0x100000;
public const int JOY_BUTTON22 = 0x200000;
public const int JOY_BUTTON23 = 0x400000;
public const int JOY_BUTTON24 = 0x800000;
public const int JOY_BUTTON25 = 0x1000000;
public const int JOY_BUTTON26 = 0x2000000;
public const int JOY_BUTTON27 = 0x4000000;
public const int JOY_BUTTON28 = 0x8000000;
public const int JOY_BUTTON29 = 0x10000000;
public const int JOY_BUTTON2CHG = 0x200;
public const int JOY_BUTTON3 = 0x4;
public const int JOY_BUTTON30 = 0x20000000;
public const int JOY_BUTTON31 = 0x40000000;
public const int JOY_BUTTON32 = unchecked((int)0x80000000);
public const int JOY_BUTTON3CHG = 0x400;
public const int JOY_BUTTON4 = 0x8;
public const int JOY_BUTTON4CHG = 0x800;
public const int JOY_BUTTON5 = 0x10;
public const int JOY_BUTTON6 = 0x20;
public const int JOY_BUTTON7 = 0x40;
public const int JOY_BUTTON8 = 0x80;
public const int JOY_BUTTON9 = 0x100;
public const int JOY_CAL_READ3 = 0x40000;
public const int JOY_CAL_READ4 = 0x80000;
public const int JOY_CAL_READ5 = 0x400000;
public const int JOY_CAL_READ6 = 0x800000;
public const int JOY_CAL_READALWAYS = 0x10000;
public const int JOY_CAL_READRONLY = 0x2000000;
public const int JOY_CAL_READUONLY = 0x4000000;
public const int JOY_CAL_READVONLY = 0x8000000;
public const int JOY_CAL_READXONLY = 0x100000;
public const int JOY_CAL_READXYONLY = 0x20000;
public const int JOY_CAL_READYONLY = 0x200000;
public const int JOY_CAL_READZONLY = 0x1000000;
public const int JOY_POVBACKWARD = 18000;
public const int JOY_POVCENTERED = -1;
public const int JOY_POVFORWARD = 0;
public const int JOY_POVLEFT = 27000;
public const int JOY_POVRIGHT = 9000;
public const int JOY_RETURNALL = (JOY_RETURNX | JOY_RETURNY | JOY_RETURNZ | JOY_RETURNR | JOY_RETURNU | JOY_RETURNV | JOY_RETURNPOV | JOY_RETURNBUTTONS);
public const int JOY_RETURNBUTTONS = 0x80;
public const int JOY_RETURNCENTERED = 0x400;
public const int JOY_RETURNPOV = 0x40;
public const int JOY_RETURNPOVCTS = 0x200;
public const int JOY_RETURNR = 0x8;
public const int JOY_RETURNRAWDATA = 0x100;
public const int JOY_RETURNU = 0x10;
public const int JOY_RETURNV = 0x20;
public const int JOY_RETURNX = 0x1;
public const int JOY_RETURNY = 0x2;
public const int JOY_RETURNZ = 0x4;
public const int JOY_USEDEADZONE = 0x800;
public const int LZERROR_BADINHANDLE = (-1);
public const int LZERROR_BADOUTHANDLE = (-2);
public const int LZERROR_BADVALUE = (-7);
public const int LZERROR_GLOBLOCK = (-6);
public const int LZERROR_PUBLICLOC = (-5);
public const int LZERROR_READ = (-3);
public const int LZERROR_UNKNOWNALG = (-8);
public const int LZERROR_WRITE = (-4);
public const int MAXERRORLENGTH = 128;
public const int MAXPNAMELEN = 32;
public const int MCIERR_BAD_CONSTANT = (MCIERR_BASE + 34);
public const int MCIERR_BAD_INTEGER = (MCIERR_BASE + 14);
public const int MCIERR_BAD_TIME_FORMAT = (MCIERR_BASE + 37);
public const int MCIERR_BASE = 256;
public const int MCIERR_CANNOT_LOAD_DRIVER = (MCIERR_BASE + 10);
public const int MCIERR_CANNOT_USE_ALL = (MCIERR_BASE + 23);
public const int MCIERR_CREATEWINDOW = (MCIERR_BASE + 91);
public const int MCIERR_CUSTOM_DRIVER_BASE = (MCIERR_BASE + 256);
public const int MCIERR_DEVICE_LENGTH = (MCIERR_BASE + 54);
public const int MCIERR_DEVICE_LOCKED = (MCIERR_BASE + 32);
public const int MCIERR_DEVICE_NOT_INSTALLED = (MCIERR_BASE + 50);
public const int MCIERR_DEVICE_NOT_READY = (MCIERR_BASE + 20);
public const int MCIERR_DEVICE_OPEN = (MCIERR_BASE + 9);
public const int MCIERR_DEVICE_ORD_LENGTH = (MCIERR_BASE + 55);
public const int MCIERR_DEVICE_TYPE_REQUIRED = (MCIERR_BASE + 31);
public const int MCIERR_DRIVER = (MCIERR_BASE + 22);
public const int MCIERR_DRIVER_INTERNAL = (MCIERR_BASE + 16);
public const int MCIERR_DUPLICATE_ALIAS = (MCIERR_BASE + 33);
public const int MCIERR_DUPLICATE_FLAGS = (MCIERR_BASE + 39);
public const int MCIERR_EXTENSION_NOT_FOUND = (MCIERR_BASE + 25);
public const int MCIERR_EXTRA_CHARACTERS = (MCIERR_BASE + 49);
public const int MCIERR_FILENAME_REQUIRED = (MCIERR_BASE + 48);
public const int MCIERR_FILE_NOT_FOUND = (MCIERR_BASE + 19);
public const int MCIERR_FILE_NOT_SAVED = (MCIERR_BASE + 30);
public const int MCIERR_FILE_READ = (MCIERR_BASE + 92);
public const int MCIERR_FILE_WRITE = (MCIERR_BASE + 93);
public const int MCIERR_FLAGS_NOT_COMPATIBLE = (MCIERR_BASE + 28);
public const int MCIERR_GET_CD = (MCIERR_BASE + 51);
public const int MCIERR_HARDWARE = (MCIERR_BASE + 6);
public const int MCIERR_ILLEGAL_FOR_AUTO_OPEN = (MCIERR_BASE + 47);
public const int MCIERR_INTERNAL = (MCIERR_BASE + 21);
public const int MCIERR_INVALID_DEVICE_ID = (MCIERR_BASE + 1);
public const int MCIERR_INVALID_DEVICE_NAME = (MCIERR_BASE + 7);
public const int MCIERR_INVALID_FILE = (MCIERR_BASE + 40);
public const int MCIERR_MISSING_COMMAND_STRING = (MCIERR_BASE + 11);
public const int MCIERR_MISSING_DEVICE_NAME = (MCIERR_BASE + 36);
public const int MCIERR_MISSING_PARAMETER = (MCIERR_BASE + 17);
public const int MCIERR_MISSING_STRING_ARGUMENT = (MCIERR_BASE + 13);
public const int MCIERR_MULTIPLE = (MCIERR_BASE + 24);
public const int MCIERR_MUST_USE_SHAREABLE = (MCIERR_BASE + 35);
public const int MCIERR_NEW_REQUIRES_ALIAS = (MCIERR_BASE + 43);
public const int MCIERR_NONAPPLICABLE_FUNCTION = (MCIERR_BASE + 46);
public const int MCIERR_NOTIFY_ON_AUTO_OPEN = (MCIERR_BASE + 44);
public const int MCIERR_NO_CLOSING_QUOTE = (MCIERR_BASE + 38);
public const int MCIERR_NO_ELEMENT_ALLOWED = (MCIERR_BASE + 45);
public const int MCIERR_NO_INTEGER = (MCIERR_BASE + 56);
public const int MCIERR_NO_WINDOW = (MCIERR_BASE + 90);
public const int MCIERR_NULL_PARAMETER_BLOCK = (MCIERR_BASE + 41);
public const int MCIERR_OUTOFRANGE = (MCIERR_BASE + 26);
public const int MCIERR_OUT_OF_MEMORY = (MCIERR_BASE + 8);
public const int MCIERR_PARAM_OVERFLOW = (MCIERR_BASE + 12);
public const int MCIERR_PARSER_INTERNAL = (MCIERR_BASE + 15);
public const int MCIERR_SEQ_DIV_INCOMPATIBLE = (MCIERR_BASE + 80);
public const int MCIERR_SEQ_NOMIDIPRESENT = (MCIERR_BASE + 87);
public const int MCIERR_SEQ_PORTUNSPECIFIED = (MCIERR_BASE + 86);
public const int MCIERR_SEQ_PORT_INUSE = (MCIERR_BASE + 81);
public const int MCIERR_SEQ_PORT_MAPNODEVICE = (MCIERR_BASE + 83);
public const int MCIERR_SEQ_PORT_MISCERROR = (MCIERR_BASE + 84);
public const int MCIERR_SEQ_PORT_NONEXISTENT = (MCIERR_BASE + 82);
public const int MCIERR_SEQ_TIMER = (MCIERR_BASE + 85);
public const int MCIERR_SET_CD = (MCIERR_BASE + 52);
public const int MCIERR_SET_DRIVE = (MCIERR_BASE + 53);
public const int MCIERR_UNNAMED_RESOURCE = (MCIERR_BASE + 42);
public const int MCIERR_UNRECOGNIZED_COMMAND = (MCIERR_BASE + 5);
public const int MCIERR_UNRECOGNIZED_KEYWORD = (MCIERR_BASE + 3);
public const int MCIERR_UNSUPPORTED_FUNCTION = (MCIERR_BASE + 18);
public const int MCIERR_WAVE_INPUTSINUSE = (MCIERR_BASE + 66);
public const int MCIERR_WAVE_INPUTSUNSUITABLE = (MCIERR_BASE + 72);
public const int MCIERR_WAVE_INPUTUNSPECIFIED = (MCIERR_BASE + 69);
public const int MCIERR_WAVE_OUTPUTSINUSE = (MCIERR_BASE + 64);
public const int MCIERR_WAVE_OUTPUTSUNSUITABLE = (MCIERR_BASE + 70);
public const int MCIERR_WAVE_OUTPUTUNSPECIFIED = (MCIERR_BASE + 68);
public const int MCIERR_WAVE_SETINPUTINUSE = (MCIERR_BASE + 67);
public const int MCIERR_WAVE_SETINPUTUNSUITABLE = (MCIERR_BASE + 73);
public const int MCIERR_WAVE_SETOUTPUTINUSE = (MCIERR_BASE + 65);
public const int MCIERR_WAVE_SETOUTPUTUNSUITABLE = (MCIERR_BASE + 71);
public const int MCI_ALL_DEVICE_ID = - 1;
public const int MCI_ANIM_GETDEVCAPS_CAN_REVERSE = 0x4001;
public const int MCI_ANIM_GETDEVCAPS_CAN_STRETCH = 0x4007;
public const int MCI_ANIM_GETDEVCAPS_FAST_RATE = 0x4002;
public const int MCI_ANIM_GETDEVCAPS_MAX_WINDOWS = 0x4008;
public const int MCI_ANIM_GETDEVCAPS_NORMAL_RATE = 0x4004;
public const int MCI_ANIM_GETDEVCAPS_PALETTES = 0x4006;
public const int MCI_ANIM_GETDEVCAPS_SLOW_RATE = 0x4003;
public const int MCI_ANIM_INFO_TEXT = 0x10000;
public const int MCI_ANIM_OPEN_NOSTATIC = 0x40000;
public const int MCI_ANIM_OPEN_PARENT = 0x20000;
public const int MCI_ANIM_OPEN_WS = 0x10000;
public const int MCI_ANIM_PLAY_FAST = 0x40000;
public const int MCI_ANIM_PLAY_REVERSE = 0x20000;
public const int MCI_ANIM_PLAY_SCAN = 0x100000;
public const int MCI_ANIM_PLAY_SLOW = 0x80000;
public const int MCI_ANIM_PLAY_SPEED = 0x10000;
public const int MCI_ANIM_PUT_DESTINATION = 0x40000;
public const int MCI_ANIM_PUT_SOURCE = 0x20000;
public const int MCI_ANIM_REALIZE_BKGD = 0x20000;
public const int MCI_ANIM_REALIZE_NORM = 0x10000;
public const int MCI_ANIM_RECT = 0x10000;
public const int MCI_ANIM_STATUS_FORWARD = 0x4002;
public const int MCI_ANIM_STATUS_HPAL = 0x4004;
public const int MCI_ANIM_STATUS_HWND = 0x4003;
public const int MCI_ANIM_STATUS_SPEED = 0x4001;
public const int MCI_ANIM_STATUS_STRETCH = 0x4005;
public const int MCI_ANIM_STEP_FRAMES = 0x20000;
public const int MCI_ANIM_STEP_REVERSE = 0x10000;
public const int MCI_ANIM_UPDATE_HDC = 0x20000;
public const int MCI_ANIM_WHERE_DESTINATION = 0x40000;
public const int MCI_ANIM_WHERE_SOURCE = 0x20000;
public const int MCI_ANIM_WINDOW_DEFAULT = 0x0;
public const int MCI_ANIM_WINDOW_DISABLE_STRETCH = 0x200000;
public const int MCI_ANIM_WINDOW_ENABLE_STRETCH = 0x100000;
public const int MCI_ANIM_WINDOW_HWND = 0x10000;
public const int MCI_ANIM_WINDOW_STATE = 0x40000;
public const int MCI_ANIM_WINDOW_TEXT = 0x80000;
public const int MCI_BREAK = 0x811;
public const int MCI_BREAK_HWND = 0x200;
public const int MCI_BREAK_KEY = 0x100;
public const int MCI_BREAK_OFF = 0x400;
public const int MCI_CD_OFFSET = 1088;
public const int MCI_CLOSE = 0x804;
public const int MCI_COPY = 0x852;
public const int MCI_CUE = 0x830;
public const int MCI_CUT = 0x851;
public const int MCI_DELETE = 0x856;
public const int MCI_DEVTYPE_ANIMATION = 519;
public const int MCI_DEVTYPE_CD_AUDIO = 516;
public const int MCI_DEVTYPE_DAT = 517;
public const int MCI_DEVTYPE_DIGITAL_VIDEO = 520;
public const int MCI_DEVTYPE_FIRST = MCI_DEVTYPE_VCR;
public const int MCI_DEVTYPE_FIRST_USER = 0x1000;
public const int MCI_DEVTYPE_LAST = MCI_DEVTYPE_SEQUENCER;
public const int MCI_DEVTYPE_OTHER = 521;
public const int MCI_DEVTYPE_OVERLAY = 515;
public const int MCI_DEVTYPE_SCANNER = 518;
public const int MCI_DEVTYPE_SEQUENCER = 523;
public const int MCI_DEVTYPE_VCR = 513;
public const int MCI_DEVTYPE_VIDEODISC = 514;
public const int MCI_DEVTYPE_WAVEFORM_AUDIO = 522;
public const int MCI_ESCAPE = 0x805;
public const int MCI_FIRST = 0x800;
public const int MCI_FORMAT_BYTES = 8;
public const int MCI_FORMAT_FRAMES = 3;
public const int MCI_FORMAT_HMS = 1;
public const int MCI_FORMAT_MILLISECONDS = 0;
public const int MCI_FORMAT_MSF = 2;
public const int MCI_FORMAT_SAMPLES = 9;
public const int MCI_FORMAT_SMPTE_24 = 4;
public const int MCI_FORMAT_SMPTE_25 = 5;
public const int MCI_FORMAT_SMPTE_30 = 6;
public const int MCI_FORMAT_SMPTE_30DROP = 7;
public const int MCI_FORMAT_TMSF = 10;
public const int MCI_FREEZE = 0x844;
public const int MCI_FROM = 0x4;
public const int MCI_GETDEVCAPS = 0x80B;
public const int MCI_GETDEVCAPS_CAN_EJECT = 0x7;
public const int MCI_GETDEVCAPS_CAN_PLAY = 0x8;
public const int MCI_GETDEVCAPS_CAN_RECORD = 0x1;
public const int MCI_GETDEVCAPS_CAN_SAVE = 0x9;
public const int MCI_GETDEVCAPS_COMPOUND_DEVICE = 0x6;
public const int MCI_GETDEVCAPS_DEVICE_TYPE = 0x4;
public const int MCI_GETDEVCAPS_HAS_AUDIO = 0x2;
public const int MCI_GETDEVCAPS_HAS_VIDEO = 0x3;
public const int MCI_GETDEVCAPS_ITEM = 0x100;
public const int MCI_GETDEVCAPS_USES_FILES = 0x5;
public const int MCI_INFO = 0x80A;
public const int MCI_INFO_FILE = 0x200;
public const int MCI_INFO_PRODUCT = 0x100;
public const int MCI_LAST = 0xFFF;
public const int MCI_LOAD = 0x850;
public const int MCI_LOAD_FILE = 0x100;
public const int MCI_MODE_NOT_READY = (MCI_STRING_OFFSET + 12);
public const int MCI_MODE_OPEN = (MCI_STRING_OFFSET + 18);
public const int MCI_MODE_PAUSE = (MCI_STRING_OFFSET + 17);
public const int MCI_MODE_PLAY = (MCI_STRING_OFFSET + 14);
public const int MCI_MODE_RECORD = (MCI_STRING_OFFSET + 15);
public const int MCI_MODE_SEEK = (MCI_STRING_OFFSET + 16);
public const int MCI_MODE_STOP = (MCI_STRING_OFFSET + 13);
public const int MCI_NOTIFY = 0x1;
public const int MCI_NOTIFY_ABORTED = 0x4;
public const int MCI_NOTIFY_FAILURE = 0x8;
public const int MCI_NOTIFY_SUCCESSFUL = 0x1;
public const int MCI_NOTIFY_SUPERSEDED = 0x2;
public const int MCI_OPEN = 0x803;
public const int MCI_OPEN_ALIAS = 0x400;
public const int MCI_OPEN_ELEMENT = 0x200;
public const int MCI_OPEN_ELEMENT_ID = 0x800;
public const int MCI_OPEN_SHAREABLE = 0x100;
public const int MCI_OPEN_TYPE = 0x2000;
public const int MCI_OPEN_TYPE_ID = 0x1000;
public const int MCI_OVLY_GETDEVCAPS_CAN_FREEZE = 0x4002;
public const int MCI_OVLY_GETDEVCAPS_CAN_STRETCH = 0x4001;
public const int MCI_OVLY_GETDEVCAPS_MAX_WINDOWS = 0x4003;
public const int MCI_OVLY_INFO_TEXT = 0x10000;
public const int MCI_OVLY_OPEN_PARENT = 0x20000;
public const int MCI_OVLY_OPEN_WS = 0x10000;
public const int MCI_OVLY_PUT_DESTINATION = 0x40000;
public const int MCI_OVLY_PUT_FRAME = 0x80000;
public const int MCI_OVLY_PUT_SOURCE = 0x20000;
public const int MCI_OVLY_PUT_VIDEO = 0x100000;
public const int MCI_OVLY_RECT = 0x10000;
public const int MCI_OVLY_STATUS_HWND = 0x4001;
public const int MCI_OVLY_STATUS_STRETCH = 0x4002;
public const int MCI_OVLY_WHERE_DESTINATION = 0x40000;
public const int MCI_OVLY_WHERE_FRAME = 0x80000;
public const int MCI_OVLY_WHERE_SOURCE = 0x20000;
public const int MCI_OVLY_WHERE_VIDEO = 0x100000;
public const int MCI_OVLY_WINDOW_DEFAULT = 0x0;
public const int MCI_OVLY_WINDOW_DISABLE_STRETCH = 0x200000;
public const int MCI_OVLY_WINDOW_ENABLE_STRETCH = 0x100000;
public const int MCI_OVLY_WINDOW_HWND = 0x10000;
public const int MCI_OVLY_WINDOW_STATE = 0x40000;
public const int MCI_OVLY_WINDOW_TEXT = 0x80000;
public const int MCI_PASTE = 0x853;
public const int MCI_PAUSE = 0x809;
public const int MCI_PLAY = 0x806;
public const int MCI_PUT = 0x842;
public const int MCI_REALIZE = 0x840;
public const int MCI_RECORD = 0x80F;
public const int MCI_RECORD_INSERT = 0x100;
public const int MCI_RECORD_OVERWRITE = 0x200;
public const int MCI_RESUME = 0x855;
public const int MCI_SAVE = 0x813;
public const int MCI_SAVE_FILE = 0x100;
public const int MCI_SEEK = 0x807;
public const int MCI_SEEK_TO_END = 0x200;
public const int MCI_SEEK_TO_START = 0x100;
public const int MCI_SEQ_DIV_PPQN = (0 + MCI_SEQ_OFFSET);
public const int MCI_SEQ_DIV_SMPTE_24 = (1 + MCI_SEQ_OFFSET);
public const int MCI_SEQ_DIV_SMPTE_25 = (2 + MCI_SEQ_OFFSET);
public const int MCI_SEQ_DIV_SMPTE_30 = (4 + MCI_SEQ_OFFSET);
public const int MCI_SEQ_DIV_SMPTE_30DROP = (3 + MCI_SEQ_OFFSET);
public const int MCI_SEQ_FILE = 0x4002;
public const int MCI_SEQ_FORMAT_SONGPTR = 0x4001;
public const int MCI_SEQ_MAPPER = 65535;
public const int MCI_SEQ_MIDI = 0x4003;
public const int MCI_SEQ_NONE = 65533;
public const int MCI_SEQ_OFFSET = 1216;
public const int MCI_SEQ_SET_MASTER = 0x80000;
public const int MCI_SEQ_SET_OFFSET = 0x1000000;
public const int MCI_SEQ_SET_PORT = 0x20000;
public const int MCI_SEQ_SET_SLAVE = 0x40000;
public const int MCI_SEQ_SET_TEMPO = 0x10000;
public const int MCI_SEQ_SMPTE = 0x4004;
public const int MCI_SEQ_STATUS_DIVTYPE = 0x400A;
public const int MCI_SEQ_STATUS_MASTER = 0x4008;
public const int MCI_SEQ_STATUS_OFFSET = 0x4009;
public const int MCI_SEQ_STATUS_PORT = 0x4003;
public const int MCI_SEQ_STATUS_SLAVE = 0x4007;
public const int MCI_SEQ_STATUS_TEMPO = 0x4002;
public const int MCI_SET = 0x80D;
public const int MCI_SET_AUDIO = 0x800;
public const int MCI_SET_AUDIO_ALL = 0x4001;
public const int MCI_SET_AUDIO_LEFT = 0x4002;
public const int MCI_SET_AUDIO_RIGHT = 0x4003;
public const int MCI_SET_DOOR_CLOSED = 0x200;
public const int MCI_SET_DOOR_OPEN = 0x100;
public const int MCI_SET_OFF = 0x4000;
public const int MCI_SET_ON = 0x2000;
public const int MCI_SET_TIME_FORMAT = 0x400;
public const int MCI_SET_VIDEO = 0x1000;
public const int MCI_SOUND = 0x812;
public const int MCI_SOUND_NAME = 0x100;
public const int MCI_SPIN = 0x80C;
public const int MCI_STATUS = 0x814;
public const int MCI_STATUS_CURRENT_TRACK = 0x8;
public const int MCI_STATUS_ITEM = 0x100;
public const int MCI_STATUS_LENGTH = 0x1;
public const int MCI_STATUS_MEDIA_PRESENT = 0x5;
public const int MCI_STATUS_MODE = 0x4;
public const int MCI_STATUS_NUMBER_OF_TRACKS = 0x3;
public const int MCI_STATUS_POSITION = 0x2;
public const int MCI_STATUS_READY = 0x7;
public const int MCI_STATUS_START = 0x200;
public const int MCI_STATUS_TIME_FORMAT = 0x6;
public const int MCI_STEP = 0x80E;
public const int MCI_STOP = 0x808;
public const int MCI_STRING_OFFSET = 512;
public const int MCI_SYSINFO = 0x810;
public const int MCI_SYSINFO_INSTALLNAME = 0x800;
public const int MCI_SYSINFO_NAME = 0x400;
public const int MCI_SYSINFO_OPEN = 0x200;
public const int MCI_SYSINFO_QUANTITY = 0x100;
public const int MCI_TO = 0x8;
public const int MCI_TRACK = 0x10;
public const int MCI_UNFREEZE = 0x845;
public const int MCI_UPDATE = 0x854;
public const int MCI_USER_MESSAGES = (0x400 + MCI_FIRST);
public const int MCI_VD_ESCAPE_STRING = 0x100;
public const int MCI_VD_FORMAT_TRACK = 0x4001;
public const int MCI_VD_GETDEVCAPS_CAN_REVERSE = 0x4002;
public const int MCI_VD_GETDEVCAPS_CAV = 0x20000;
public const int MCI_VD_GETDEVCAPS_CLV = 0x10000;
public const int MCI_VD_GETDEVCAPS_FAST_RATE = 0x4003;
public const int MCI_VD_GETDEVCAPS_NORMAL_RATE = 0x4005;
public const int MCI_VD_GETDEVCAPS_SLOW_RATE = 0x4004;
public const int MCI_VD_MEDIA_CAV = (MCI_VD_OFFSET + 3);
public const int MCI_VD_MEDIA_CLV = (MCI_VD_OFFSET + 2);
public const int MCI_VD_MEDIA_OTHER = (MCI_VD_OFFSET + 4);
public const int MCI_VD_MODE_PARK = (MCI_VD_OFFSET + 1);
public const int MCI_VD_OFFSET = 1024;
public const int MCI_VD_PLAY_FAST = 0x20000;
public const int MCI_VD_PLAY_REVERSE = 0x10000;
public const int MCI_VD_PLAY_SCAN = 0x80000;
public const int MCI_VD_PLAY_SLOW = 0x100000;
public const int MCI_VD_PLAY_SPEED = 0x40000;
public const int MCI_VD_SEEK_REVERSE = 0x10000;
public const int MCI_VD_SPIN_DOWN = 0x20000;
public const int MCI_VD_SPIN_UP = 0x10000;
public const int MCI_VD_STATUS_DISC_SIZE = 0x4006;
public const int MCI_VD_STATUS_FORWARD = 0x4003;
public const int MCI_VD_STATUS_MEDIA_TYPE = 0x4004;
public const int MCI_VD_STATUS_SIDE = 0x4005;
public const int MCI_VD_STATUS_SPEED = 0x4002;
public const int MCI_VD_STEP_FRAMES = 0x10000;
public const int MCI_VD_STEP_REVERSE = 0x20000;
public const int MCI_WAIT = 0x2;
public const int MCI_WAVE_GETDEVCAPS_INPUTS = 0x4001;
public const int MCI_WAVE_GETDEVCAPS_OUTPUTS = 0x4002;
public const int MCI_WAVE_INPUT = 0x400000;
public const int MCI_WAVE_MAPPER = (MCI_WAVE_OFFSET + 1);
public const int MCI_WAVE_OFFSET = 1152;
public const int MCI_WAVE_OPEN_BUFFER = 0x10000;
public const int MCI_WAVE_OUTPUT = 0x800000;
public const int MCI_WAVE_PCM = (MCI_WAVE_OFFSET + 0);
public const int MCI_WAVE_SET_ANYINPUT = 0x4000000;
public const int MCI_WAVE_SET_ANYOUTPUT = 0x8000000;
public const int MCI_WAVE_SET_AVGBYTESPERSEC = 0x80000;
public const int MCI_WAVE_SET_BITSPERSAMPLE = 0x200000;
public const int MCI_WAVE_SET_BLOCKALIGN = 0x100000;
public const int MCI_WAVE_SET_CHANNELS = 0x20000;
public const int MCI_WAVE_SET_FORMATTAG = 0x10000;
public const int MCI_WAVE_SET_SAMPLESPERSEC = 0x40000;
public const int MCI_WAVE_STATUS_AVGBYTESPERSEC = 0x4004;
public const int MCI_WAVE_STATUS_BITSPERSAMPLE = 0x4006;
public const int MCI_WAVE_STATUS_BLOCKALIGN = 0x4005;
public const int MCI_WAVE_STATUS_CHANNELS = 0x4002;
public const int MCI_WAVE_STATUS_FORMATTAG = 0x4001;
public const int MCI_WAVE_STATUS_LEVEL = 0x4007;
public const int MCI_WAVE_STATUS_SAMPLESPERSEC = 0x4003;
public const int MCI_WHERE = 0x843;
public const int MCI_WINDOW = 0x841;
public const int MEVT_F_CALLBACK = 0x40000000;
public const int MEVT_F_LONG = unchecked((int)0x80000000);
public const int MEVT_F_SHORT = 0x0;
public const int MHDR_DONE = 0x1;
public const int MHDR_INQUEUE = 0x4;
public const int MHDR_PREPARED = 0x2;
public const int MHDR_VALID = 0x7;
public const int MIDICAPS_CACHE = 0x4;
public const int MIDICAPS_LRVOLUME = 0x2;
public const int MIDICAPS_STREAM = 0x8;
public const int MIDICAPS_VOLUME = 0x1;
public const int MIDIERR_BASE = 64;
public const int MIDIERR_INVALIDSETUP = (MIDIERR_BASE + 5);
public const int MIDIERR_LASTERROR = (MIDIERR_BASE + 5);
public const int MIDIERR_NODEVICE = (MIDIERR_BASE + 4);
public const int MIDIERR_NOMAP = (MIDIERR_BASE + 2);
public const int MIDIERR_NOTREADY = (MIDIERR_BASE + 3);
public const int MIDIERR_STILLPLAYING = (MIDIERR_BASE + 1);
public const int MIDIERR_UNPREPARED = (MIDIERR_BASE + 0);
public const int MIDIMAPPER = (-1);
public const int MIDIPROP_GET = 0x40000000;
public const int MIDIPROP_SET = unchecked((int)0x80000000);
public const int MIDIPROP_TEMPO = 0x2;
public const int MIDIPROP_TIMEDIV = 0x1;
public const int MIDISTRM_ERROR = -2;
public const int MIDI_CACHE_ALL = 1;
public const int MIDI_CACHE_BESTFIT = 2;
public const int MIDI_CACHE_QUERY = 3;
public const int MIDI_CACHE_VALID = (MIDI_CACHE_ALL | MIDI_CACHE_BESTFIT | MIDI_CACHE_QUERY | MIDI_UNCACHE);
public const int MIDI_IO_STATUS = 0x20;
public const int MIDI_MAPPER = -1;
public const int MIDI_UNCACHE = 4;
public const int MIM_CLOSE = MM_MIM_CLOSE;
public const int MIM_DATA = MM_MIM_DATA;
public const int MIM_ERROR = MM_MIM_ERROR;
public const int MIM_LONGDATA = MM_MIM_LONGDATA;
public const int MIM_LONGERROR = MM_MIM_LONGERROR;
public const int MIM_MOREDATA = MM_MIM_MOREDATA;
public const int MIM_OPEN = MM_MIM_OPEN;
public const int MIXERCONTROL_CONTROLF_DISABLED = unchecked((int)0x80000000);
public const int MIXERCONTROL_CONTROLF_MULTIPLE = 0x2;
public const int MIXERCONTROL_CONTROLF_UNIFORM = 0x1;
public const int MIXERCONTROL_CONTROLTYPE_BASS = (MIXERCONTROL_CONTROLTYPE_FADER + 2);
public const int MIXERCONTROL_CONTROLTYPE_BOOLEAN = (MIXERCONTROL_CT_CLASS_SWITCH | MIXERCONTROL_CT_SC_SWITCH_BOOLEAN | MIXERCONTROL_CT_UNITS_BOOLEAN);
public const int MIXERCONTROL_CONTROLTYPE_BOOLEANMETER = (MIXERCONTROL_CT_CLASS_METER | MIXERCONTROL_CT_SC_METER_POLLED | MIXERCONTROL_CT_UNITS_BOOLEAN);
public const int MIXERCONTROL_CONTROLTYPE_BUTTON = (MIXERCONTROL_CT_CLASS_SWITCH | MIXERCONTROL_CT_SC_SWITCH_BUTTON | MIXERCONTROL_CT_UNITS_BOOLEAN);
public const int MIXERCONTROL_CONTROLTYPE_CUSTOM = (MIXERCONTROL_CT_CLASS_CUSTOM | MIXERCONTROL_CT_UNITS_CUSTOM);
public const int MIXERCONTROL_CONTROLTYPE_DECIBELS = (MIXERCONTROL_CT_CLASS_NUMBER | MIXERCONTROL_CT_UNITS_DECIBELS);
public const int MIXERCONTROL_CONTROLTYPE_EQUALIZER = (MIXERCONTROL_CONTROLTYPE_FADER + 4);
public const int MIXERCONTROL_CONTROLTYPE_FADER = (MIXERCONTROL_CT_CLASS_FADER | MIXERCONTROL_CT_UNITS_UNSIGNED);
public const int MIXERCONTROL_CONTROLTYPE_LOUDNESS = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 4);
public const int MIXERCONTROL_CONTROLTYPE_MICROTIME = (MIXERCONTROL_CT_CLASS_TIME | MIXERCONTROL_CT_SC_TIME_MICROSECS | MIXERCONTROL_CT_UNITS_UNSIGNED);
public const int MIXERCONTROL_CONTROLTYPE_MILLITIME = (MIXERCONTROL_CT_CLASS_TIME | MIXERCONTROL_CT_SC_TIME_MILLISECS | MIXERCONTROL_CT_UNITS_UNSIGNED);
public const int MIXERCONTROL_CONTROLTYPE_MIXER = (MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT + 1);
public const int MIXERCONTROL_CONTROLTYPE_MONO = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 3);
public const int MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT = (MIXERCONTROL_CT_CLASS_LIST | MIXERCONTROL_CT_SC_LIST_MULTIPLE | MIXERCONTROL_CT_UNITS_BOOLEAN);
public const int MIXERCONTROL_CONTROLTYPE_MUTE = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 2);
public const int MIXERCONTROL_CONTROLTYPE_MUX = (MIXERCONTROL_CONTROLTYPE_SINGLESELECT + 1);
public const int MIXERCONTROL_CONTROLTYPE_ONOFF = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 1);
public const int MIXERCONTROL_CONTROLTYPE_PAN = (MIXERCONTROL_CONTROLTYPE_SLIDER + 1);
public const int MIXERCONTROL_CONTROLTYPE_PEAKMETER = (MIXERCONTROL_CONTROLTYPE_SIGNEDMETER + 1);
public const int MIXERCONTROL_CONTROLTYPE_PERCENT = (MIXERCONTROL_CT_CLASS_NUMBER | MIXERCONTROL_CT_UNITS_PERCENT);
public const int MIXERCONTROL_CONTROLTYPE_QSOUNDPAN = (MIXERCONTROL_CONTROLTYPE_SLIDER + 2);
public const int MIXERCONTROL_CONTROLTYPE_SIGNED = (MIXERCONTROL_CT_CLASS_NUMBER | MIXERCONTROL_CT_UNITS_SIGNED);
public const int MIXERCONTROL_CONTROLTYPE_SIGNEDMETER = (MIXERCONTROL_CT_CLASS_METER | MIXERCONTROL_CT_SC_METER_POLLED | MIXERCONTROL_CT_UNITS_SIGNED);
public const int MIXERCONTROL_CONTROLTYPE_SINGLESELECT = (MIXERCONTROL_CT_CLASS_LIST | MIXERCONTROL_CT_SC_LIST_SINGLE | MIXERCONTROL_CT_UNITS_BOOLEAN);
public const int MIXERCONTROL_CONTROLTYPE_SLIDER = (MIXERCONTROL_CT_CLASS_SLIDER | MIXERCONTROL_CT_UNITS_SIGNED);
public const int MIXERCONTROL_CONTROLTYPE_STEREOENH = (MIXERCONTROL_CONTROLTYPE_BOOLEAN + 5);
public const int MIXERCONTROL_CONTROLTYPE_TREBLE = (MIXERCONTROL_CONTROLTYPE_FADER + 3);
public const int MIXERCONTROL_CONTROLTYPE_UNSIGNED = (MIXERCONTROL_CT_CLASS_NUMBER | MIXERCONTROL_CT_UNITS_UNSIGNED);
public const int MIXERCONTROL_CONTROLTYPE_UNSIGNEDMETER = (MIXERCONTROL_CT_CLASS_METER | MIXERCONTROL_CT_SC_METER_POLLED | MIXERCONTROL_CT_UNITS_UNSIGNED);
public const int MIXERCONTROL_CONTROLTYPE_VOLUME = (MIXERCONTROL_CONTROLTYPE_FADER + 1);
public const int MIXERCONTROL_CT_CLASS_CUSTOM = 0x0;
public const int MIXERCONTROL_CT_CLASS_FADER = 0x50000000;
public const int MIXERCONTROL_CT_CLASS_LIST = 0x70000000;
public const int MIXERCONTROL_CT_CLASS_MASK = unchecked((int)0xF0000000);
public const int MIXERCONTROL_CT_CLASS_METER = 0x10000000;
public const int MIXERCONTROL_CT_CLASS_NUMBER = 0x30000000;
public const int MIXERCONTROL_CT_CLASS_SLIDER = 0x40000000;
public const int MIXERCONTROL_CT_CLASS_SWITCH = 0x20000000;
public const int MIXERCONTROL_CT_CLASS_TIME = 0x60000000;
public const int MIXERCONTROL_CT_SC_LIST_MULTIPLE = 0x1000000;
public const int MIXERCONTROL_CT_SC_LIST_SINGLE = 0x0;
public const int MIXERCONTROL_CT_SC_METER_POLLED = 0x0;
public const int MIXERCONTROL_CT_SC_SWITCH_BOOLEAN = 0x0;
public const int MIXERCONTROL_CT_SC_SWITCH_BUTTON = 0x1000000;
public const int MIXERCONTROL_CT_SC_TIME_MICROSECS = 0x0;
public const int MIXERCONTROL_CT_SC_TIME_MILLISECS = 0x1000000;
public const int MIXERCONTROL_CT_SUBCLASS_MASK = 0xF000000;
public const int MIXERCONTROL_CT_UNITS_BOOLEAN = 0x10000;
public const int MIXERCONTROL_CT_UNITS_CUSTOM = 0x0;
public const int MIXERCONTROL_CT_UNITS_DECIBELS = 0x40000;
public const int MIXERCONTROL_CT_UNITS_MASK = 0xFF0000;
public const int MIXERCONTROL_CT_UNITS_PERCENT = 0x50000;
public const int MIXERCONTROL_CT_UNITS_SIGNED = 0x20000;
public const int MIXERCONTROL_CT_UNITS_UNSIGNED = 0x30000;
public const int MIXERLINE_COMPONENTTYPE_DST_DIGITAL = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 1);
public const int MIXERLINE_COMPONENTTYPE_DST_FIRST = 0x0;
public const int MIXERLINE_COMPONENTTYPE_DST_HEADPHONES = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 5);
public const int MIXERLINE_COMPONENTTYPE_DST_LAST = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 8);
public const int MIXERLINE_COMPONENTTYPE_DST_LINE = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 2);
public const int MIXERLINE_COMPONENTTYPE_DST_MONITOR = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 3);
public const int MIXERLINE_COMPONENTTYPE_DST_SPEAKERS = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 4);
public const int MIXERLINE_COMPONENTTYPE_DST_TELEPHONE = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 6);
public const int MIXERLINE_COMPONENTTYPE_DST_UNDEFINED = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 0);
public const int MIXERLINE_COMPONENTTYPE_DST_VOICEIN = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 8);
public const int MIXERLINE_COMPONENTTYPE_DST_WAVEIN = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 7);
public const int MIXERLINE_COMPONENTTYPE_SRC_ANALOG = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10);
public const int MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 9);
public const int MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 5);
public const int MIXERLINE_COMPONENTTYPE_SRC_DIGITAL = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 1);
public const int MIXERLINE_COMPONENTTYPE_SRC_FIRST = 0x1000;
public const int MIXERLINE_COMPONENTTYPE_SRC_LAST = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10);
public const int MIXERLINE_COMPONENTTYPE_SRC_LINE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 2);
public const int MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 3);
public const int MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 7);
public const int MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 4);
public const int MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 6);
public const int MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 0);
public const int MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 8);
public const int MIXERLINE_LINEF_ACTIVE = 0x1;
public const int MIXERLINE_LINEF_DISCONNECTED = 0x8000;
public const int MIXERLINE_LINEF_SOURCE = unchecked((int)0x80000000);
public const int MIXERLINE_TARGETTYPE_AUX = 5;
public const int MIXERLINE_TARGETTYPE_MIDIIN = 4;
public const int MIXERLINE_TARGETTYPE_MIDIOUT = 3;
public const int MIXERLINE_TARGETTYPE_UNDEFINED = 0;
public const int MIXERLINE_TARGETTYPE_WAVEIN = 2;
public const int MIXERLINE_TARGETTYPE_WAVEOUT = 1;
public const int MIXERR_BASE = 1024;
public const int MIXERR_INVALCONTROL = (MIXERR_BASE + 1);
public const int MIXERR_INVALLINE = (MIXERR_BASE + 0);
public const int MIXERR_INVALVALUE = (MIXERR_BASE + 2);
public const int MIXERR_LASTERROR = (MIXERR_BASE + 2);
public const int MIXER_GETCONTROLDETAILSF_LISTTEXT = 0x1;
public const int MIXER_GETCONTROLDETAILSF_QUERYMASK = 0xF;
public const int MIXER_GETCONTROLDETAILSF_VALUE = 0x0;
public const int MIXER_GETLINECONTROLSF_ALL = 0x0;
public const int MIXER_GETLINECONTROLSF_ONEBYID = 0x1;
public const int MIXER_GETLINECONTROLSF_ONEBYTYPE = 0x2;
public const int MIXER_GETLINECONTROLSF_QUERYMASK = 0xF;
public const int MIXER_GETLINEINFOF_COMPONENTTYPE = 0x3;
public const int MIXER_GETLINEINFOF_DESTINATION = 0x0;
public const int MIXER_GETLINEINFOF_LINEID = 0x2;
public const int MIXER_GETLINEINFOF_QUERYMASK = 0xF;
public const int MIXER_GETLINEINFOF_SOURCE = 0x1;
public const int MIXER_GETLINEINFOF_TARGETTYPE = 0x4;
public const int MIXER_LONG_NAME_CHARS = 64;
public const int MIXER_OBJECTF_AUX = 0x50000000;
public const int MIXER_OBJECTF_HANDLE = unchecked((int)0x80000000);
public const int MIXER_OBJECTF_HMIDIIN = (MIXER_OBJECTF_HANDLE | MIXER_OBJECTF_MIDIIN);
public const int MIXER_OBJECTF_HMIDIOUT = (MIXER_OBJECTF_HANDLE | MIXER_OBJECTF_MIDIOUT);
public const int MIXER_OBJECTF_HMIXER = (MIXER_OBJECTF_HANDLE | MIXER_OBJECTF_MIXER);
public const int MIXER_OBJECTF_HWAVEIN = (MIXER_OBJECTF_HANDLE | MIXER_OBJECTF_WAVEIN);
public const int MIXER_OBJECTF_HWAVEOUT = (MIXER_OBJECTF_HANDLE | MIXER_OBJECTF_WAVEOUT);
public const int MIXER_OBJECTF_MIDIIN = 0x40000000;
public const int MIXER_OBJECTF_MIDIOUT = 0x30000000;
public const int MIXER_OBJECTF_MIXER = 0x0;
public const int MIXER_OBJECTF_WAVEIN = 0x20000000;
public const int MIXER_OBJECTF_WAVEOUT = 0x10000000;
public const int MIXER_SETCONTROLDETAILSF_CUSTOM = 0x1;
public const int MIXER_SETCONTROLDETAILSF_QUERYMASK = 0xF;
public const int MIXER_SETCONTROLDETAILSF_VALUE = 0x0;
public const int MIXER_SHORT_NAME_CHARS = 16;
public const int MMIOERR_BASE = 256;
public const int MMIOERR_CANNOTCLOSE = (MMIOERR_BASE + 4);
public const int MMIOERR_CANNOTEXPAND = (MMIOERR_BASE + 8);
public const int MMIOERR_CANNOTOPEN = (MMIOERR_BASE + 3);
public const int MMIOERR_CANNOTREAD = (MMIOERR_BASE + 5);
public const int MMIOERR_CANNOTSEEK = (MMIOERR_BASE + 7);
public const int MMIOERR_CANNOTWRITE = (MMIOERR_BASE + 6);
public const int MMIOERR_CHUNKNOTFOUND = (MMIOERR_BASE + 9);
public const int MMIOERR_FILENOTFOUND = (MMIOERR_BASE + 1);
public const int MMIOERR_OUTOFMEMORY = (MMIOERR_BASE + 2);
public const int MMIOERR_UNBUFFERED = (MMIOERR_BASE + 10);
public const int MMIOM_CLOSE = 4;
public const int MMIOM_OPEN = 3;
public const int MMIOM_READ = MMIO_READ;
public const int MMIOM_RENAME = 6;
public const int MMIOM_SEEK = 2;
public const int MMIOM_USER = 0x8000;
public const int MMIOM_WRITE = MMIO_WRITE;
public const int MMIOM_WRITEFLUSH = 5;
public const int MMIO_ALLOCBUF = 0x10000;
public const int MMIO_COMPAT = 0x0;
public const int MMIO_CREATE = 0x1000;
public const int MMIO_CREATELIST = 0x40;
public const int MMIO_CREATERIFF = 0x20;
public const int MMIO_DEFAULTBUFFER = 8192;
public const int MMIO_DELETE = 0x200;
public const int MMIO_DENYNONE = 0x40;
public const int MMIO_DENYREAD = 0x30;
public const int MMIO_DENYWRITE = 0x20;
public const int MMIO_DIRTY = 0x10000000;
public const int MMIO_EMPTYBUF = 0x10;
public const int MMIO_EXCLUSIVE = 0x10;
public const int MMIO_EXIST = 0x4000;
public const int MMIO_FHOPEN = 0x10;
public const int MMIO_FINDCHUNK = 0x10;
public const int MMIO_FINDLIST = 0x40;
public const int MMIO_FINDPROC = 0x40000;
public const int MMIO_FINDRIFF = 0x20;
public const int MMIO_GETTEMP = 0x20000;
public const int MMIO_INSTALLPROC = 0x10000;
public const int MMIO_OPEN_VALID = 0x3FFFF;
public const int MMIO_PARSE = 0x100;
public const int MMIO_PUBLICPROC = 0x10000000;
public const int MMIO_READ = 0x0;
public const int MMIO_READWRITE = 0x2;
public const int MMIO_REMOVEPROC = 0x20000;
public const int MMIO_RWMODE = 0x3;
public const int MMIO_SHAREMODE = 0x70;
public const int MMIO_TOUPPER = 0x10;
public const int MMIO_UNICODEPROC = 0x1000000;
public const int MMIO_VALIDPROC = 0x11070000;
public const int MMIO_WRITE = 0x1;
public const int MMSYSERR_ALLOCATED = (MMSYSERR_BASE + 4);
public const int MMSYSERR_BADDEVICEID = (MMSYSERR_BASE + 2);
public const int MMSYSERR_BADERRNUM = (MMSYSERR_BASE + 9);
public const int MMSYSERR_BASE = 0;
public const int MMSYSERR_ERROR = (MMSYSERR_BASE + 1);
public const int MMSYSERR_HANDLEBUSY = (MMSYSERR_BASE + 12);
public const int MMSYSERR_INVALFLAG = (MMSYSERR_BASE + 10);
public const int MMSYSERR_INVALHANDLE = (MMSYSERR_BASE + 5);
public const int MMSYSERR_INVALIDALIAS = (MMSYSERR_BASE + 13);
public const int MMSYSERR_INVALPARAM = (MMSYSERR_BASE + 11);
public const int MMSYSERR_LASTERROR = (MMSYSERR_BASE + 13);
public const int MMSYSERR_NODRIVER = (MMSYSERR_BASE + 6);
public const int MMSYSERR_NOERROR = 0;
public const int MMSYSERR_NOMEM = (MMSYSERR_BASE + 7);
public const int MMSYSERR_NOTENABLED = (MMSYSERR_BASE + 3);
public const int MMSYSERR_NOTSUPPORTED = (MMSYSERR_BASE + 8);
public const int MM_ADLIB = 9;
public const int MM_JOY1BUTTONDOWN = 0x3B5;
public const int MM_JOY1BUTTONUP = 0x3B7;
public const int MM_JOY1MOVE = 0x3A0;
public const int MM_JOY1ZMOVE = 0x3A2;
public const int MM_JOY2BUTTONDOWN = 0x3B6;
public const int MM_JOY2BUTTONUP = 0x3B8;
public const int MM_JOY2MOVE = 0x3A1;
public const int MM_JOY2ZMOVE = 0x3A3;
public const int MM_MCINOTIFY = 0x3B9;
public const int MM_MCISIGNAL = 0x3CB;
public const int MM_MCISYSTEM_STRING = 0x3CA;
public const int MM_MICROSOFT = 1;
public const int MM_MIDI_MAPPER = 1;
public const int MM_MIM_CLOSE = 0x3C2;
public const int MM_MIM_DATA = 0x3C3;
public const int MM_MIM_ERROR = 0x3C5;
public const int MM_MIM_LONGDATA = 0x3C4;
public const int MM_MIM_LONGERROR = 0x3C6;
public const int MM_MIM_MOREDATA = 0x3CC;
public const int MM_MIM_OPEN = 0x3C1;
public const int MM_MOM_CLOSE = 0x3C8;
public const int MM_MOM_DONE = 0x3C9;
public const int MM_MOM_OPEN = 0x3C7;
public const int MM_MOM_POSITIONCB = 0x3CA;
public const int MM_MPU401_MIDIIN = 11;
public const int MM_MPU401_MIDIOUT = 10;
public const int MM_PC_JOYSTICK = 12;
public const int MM_SNDBLST_MIDIIN = 4;
public const int MM_SNDBLST_MIDIOUT = 3;
public const int MM_SNDBLST_SYNTH = 5;
public const int MM_SNDBLST_WAVEIN = 7;
public const int MM_SNDBLST_WAVEOUT = 6;
public const int MM_WAVE_MAPPER = 2;
public const int MM_WIM_CLOSE = 0x3BF;
public const int MM_WIM_DATA = 0x3C0;
public const int MM_WIM_OPEN = 0x3BE;
public const int MM_WOM_CLOSE = 0x3BC;
public const int MM_WOM_DONE = 0x3BD;
public const int MM_WOM_OPEN = 0x3BB;
public const int MOD_FMSYNTH = 4;
public const int MOD_MAPPER = 5;
public const int MOD_MIDIPORT = 1;
public const int MOD_SQSYNTH = 3;
public const int MOD_SYNTH = 2;
public const int MOM_CLOSE = MM_MOM_CLOSE;
public const int MOM_DONE = MM_MOM_DONE;
public const int MOM_OPEN = MM_MOM_OPEN;
public const int MOM_POSITIONCB = MM_MOM_POSITIONCB;
public const int NEWTRANSPARENT = 3;
public const int QUERYROPSUPPORT = 40;
public const int SEEK_CUR = 1;
public const int SEEK_END = 2;
public const int SEEK_SET = 0;
public const int SELECTDIB = 41;
public const int SND_ALIAS = 0x10000;
public const int SND_ALIAS_ID = 0x110000;
public const int SND_ALIAS_START = 0;
public const int SND_APPLICATION = 0x80;
public const int SND_ASYNC = 0x1;
public const int SND_FILENAME = 0x20000;
public const int SND_LOOP = 0x8;
public const int SND_MEMORY = 0x4;
public const int SND_NODEFAULT = 0x2;
public const int SND_NOSTOP = 0x10;
public const int SND_NOWAIT = 0x2000;
public const int SND_PURGE = 0x40;
public const int SND_RESERVED = unchecked((int)0xFF000000);
public const int SND_RESOURCE = 0x40004;
public const int SND_SYNC = 0x0;
public const int SND_TYPE_MASK = 0x170007;
public const int SND_VALID = 0x1F;
public const int SND_VALIDFLAGS = 0x17201F;
public const int TIMERR_BASE = 96;
public const int TIMERR_NOCANDO = (TIMERR_BASE + 1);
public const int TIMERR_NOERROR = (0);
public const int TIMERR_STRUCT = (TIMERR_BASE + 33);
public const int TIME_BYTES = 0x4;
public const int TIME_MIDI = 0x10;
public const int TIME_MS = 0x1;
public const int TIME_ONESHOT = 0;
public const int TIME_PERIODIC = 1;
public const int TIME_SAMPLES = 0x2;
public const int TIME_SMPTE = 0x8;
public const int WAVECAPS_LRVOLUME = 0x8;
public const int WAVECAPS_PITCH = 0x1;
public const int WAVECAPS_PLAYBACKRATE = 0x2;
public const int WAVECAPS_SYNC = 0x10;
public const int WAVECAPS_VOLUME = 0x4;
public const int WAVERR_BADFORMAT = (WAVERR_BASE + 0);
public const int WAVERR_BASE = 32;
public const int WAVERR_LASTERROR = (WAVERR_BASE + 3);
public const int WAVERR_STILLPLAYING = (WAVERR_BASE + 1);
public const int WAVERR_SYNC = (WAVERR_BASE + 3);
public const int WAVERR_UNPREPARED = (WAVERR_BASE + 2);
public const int WAVE_ALLOWSYNC = 0x2;
public const int WAVE_FORMAT_1M08 = 0x1;
public const int WAVE_FORMAT_1M16 = 0x4;
public const int WAVE_FORMAT_1S08 = 0x2;
public const int WAVE_FORMAT_1S16 = 0x8;
public const int WAVE_FORMAT_2M08 = 0x10;
public const int WAVE_FORMAT_2M16 = 0x40;
public const int WAVE_FORMAT_2S08 = 0x20;
public const int WAVE_FORMAT_2S16 = 0x80;
public const int WAVE_FORMAT_4M08 = 0x100;
public const int WAVE_FORMAT_4M16 = 0x400;
public const int WAVE_FORMAT_4S08 = 0x200;
public const int WAVE_FORMAT_4S16 = 0x800;
public const int WAVE_FORMAT_DIRECT = 0x8;
public const int WAVE_FORMAT_DIRECT_QUERY = (WAVE_FORMAT_QUERY | WAVE_FORMAT_DIRECT);
public const int WAVE_FORMAT_PCM = 1;
public const int WAVE_FORMAT_QUERY = 0x1;
public const int WAVE_INVALIDFORMAT = 0x0;
public const int WAVE_MAPPED = 0x4;
public const int WAVE_MAPPER = -1;
public const int WAVE_VALID = 0x3;
public const int WHDR_BEGINLOOP = 0x4;
public const int WHDR_DONE = 0x1;
public const int WHDR_ENDLOOP = 0x8;
public const int WHDR_INQUEUE = 0x10;
public const int WHDR_PREPARED = 0x2;
public const int WHDR_VALID = 0x1F;
public const int WIM_CLOSE = MM_WIM_CLOSE;
public const int WIM_DATA = MM_WIM_DATA;
public const int WIM_OPEN = MM_WIM_OPEN;
public const int WOM_CLOSE = MM_WOM_CLOSE;
public const int WOM_DONE = MM_WOM_DONE;
public const int WOM_OPEN = MM_WOM_OPEN;
public const string CFSEPCHAR = "+";
}
}


using System;
using System.Runtime.InteropServices;
using HANDLE = System.IntPtr;
using HWND = System.IntPtr;
using HDC = System.IntPtr;
namespace Win32
{
public struct XFORM
{
public double eM11;
public double
eM12;
public double eM21;
public double
eM22;
public double eDx;
public double
eDy;
}
public struct BITMAP
{
public
int bmType;
public int bmWidth;
public int
bmHeight;
public int bmWidthBytes;
public short
bmPlanes;
public short bmBitsPixel;
public int
bmBits;
}
public struct RGBTRIPLE
{
public byte rgbtBlue;
public byte
rgbtGreen;
public byte rgbtRed;
}
public struct
RGBQUAD
{
public byte rgbBlue;
public
byte rgbGreen;
public byte rgbRed;
public byte
rgbReserved;
}
public struct BITMAPCOREHEADER
{
public int bcSize;
public short
bcWidth;
public short bcHeight;
public short
bcPlanes;
public short bcBitCount;
}
public
struct BITMAPINFOHEADER
{
public int
biSize;
public int biWidth;
public int
biHeight;
public short biPlanes;
public short
biBitCount;
public int biCompression;
public int
biSizeImage;
public int biXPelsPerMeter;
public
int biYPelsPerMeter;
public int biClrUsed;
public
int biClrImportant;
}
public struct BITMAPINFO
{
public BITMAPINFOHEADER
bmiHeader;
public RGBQUAD bmiColors;
}
public
struct BITMAPCOREINFO
{
public BITMAPCOREHEADER
bmciHeader;
public RGBTRIPLE
bmciColors;
}
public struct BITMAPFILEHEADER
{
public short bfType;
public int
bfSize;
public short bfReserved1;
public short
bfReserved2;
public int bfOffBits;
}
public
struct HANDLETABLE
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst=1)]
public int objectHandle;
}
public struct METARECORD
{
public int rdSize;
public short
rdFunction;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=1)]
public short rdParm;
}
public struct METAFILEPICT
{
public int mm;
public int
xExt;
public int yExt;
public HANDLE
hMF;
}
public struct METAHEADER
{
public short mtType;
public short
mtHeaderSize;
public short mtVersion;
public int
mtSize;
public short mtNoObjects;
public int
mtMaxRecord;
public short
mtNoParameters;
}
public struct ENHMETARECORD
{
public int iType;
public int
nSize;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=1)] public
int dParm;
}
public struct ENHMETAHEADER
{
public int iType;
public int
nSize;
public RECT rclBounds;
public RECT
rclFrame;
public int dSignature;
public int
nVersion;
public int nBytes;
public int
nRecords;
public short nHandles;
public short
sReserved;
public int nDescription;
public int
offDescription;
public int nPalEntries;
public
SIZE szlDevice;
public SIZE
szlMillimeters;
}
public struct TEXTMETRIC
{
public int tmHeight;
public int
tmAscent;
public int tmDescent;
public int
tmInternalLeading;
public int
tmExternalLeading;
public int
tmAveCharWidth;
public int tmMaxCharWidth;
public
int tmWeight;
public int tmOverhang;
public int
tmDigitizedAspectX;
public int
tmDigitizedAspectY;
public byte
tmFirstChar;
public byte tmLastChar;
public byte
tmDefaultChar;
public byte tmBreakChar;
public
byte tmItalic;
public byte tmUnderlined;
public
byte tmStruckOut;
public byte
tmPitchAndFamily;
public byte
tmCharSet;
}
public struct NEWTEXTMETRIC
{
public int tmHeight;
public int
tmAscent;
public int tmDescent;
public int
tmInternalLeading;
public int
tmExternalLeading;
public int
tmAveCharWidth;
public int tmMaxCharWidth;
public
int tmWeight;
public int tmOverhang;
public int
tmDigitizedAspectX;
public int
tmDigitizedAspectY;
public byte
tmFirstChar;
public byte tmLastChar;
public byte
tmDefaultChar;
public byte tmBreakChar;
public
byte tmItalic;
public byte tmUnderlined;
public
byte tmStruckOut;
public byte
tmPitchAndFamily;
public byte tmCharSet;
public
int ntmFlags;
public int ntmSizeEM;
public int
ntmCellHeight;
public int ntmAveWidth;
}
public
struct PELARRAY
{
public int
paXCount;
public int paYCount;
public int
paXExt;
public int paYExt;
public short
paRGBs;
}
public struct LOGBRUSH
{
public int lbStyle;
public int
lbColor;
public int lbHatch;
}
public struct
LOGPEN
{
public int lopnStyle;
public
POINT lopnWidth;
public int lopnColor;
}
public
struct EXTLOGPEN
{
public int
elpPenStyle;
public int elpWidth;
public int
elpBrushStyle;
public int elpColor;
public int
elpHatch;
public int
elpNumEntries;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=1)]
public int elpStyleEntry;
}
public struct PALETTEENTRY
{
public byte peRed;
public byte
peGreen;
public byte peBlue;
public byte
peFlags;
}
public struct LOGPALETTE
{
public short palVersion;
public short
palNumEntries;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=1)]
public PALETTEENTRY palPalEntry;
}
public struct LOGFONT
{
public int lfHeight;
public int
lfWidth;
public int lfEscapement;
public int
lfOrientation;
public int lfWeight;
public byte
lfItalic;
public byte lfUnderline;
public byte
lfStrikeOut;
public byte lfCharSet;
public byte
lfOutPrecision;
public byte
lfClipPrecision;
public byte lfQuality;
public
byte lfPitchAndFamily;
[MarshalAs(UnmanagedType.ByValArray,
SizeConst=GDI.LF_FACESIZE)] public byte[] lfFaceName;
}
public struct NONCLIENTMETRICS
{
public int cbSize;
public int
iBorderWidth;
public int iScrollWidth;
public int
iScrollHeight;
public int iCaptionWidth;
public
int iCaptionHeight;
public LOGFONT
lfCaptionFont;
public int iSMCaptionWidth;
public
int iSMCaptionHeight;
public LOGFONT
lfSMCaptionFont;
public int iMenuWidth;
public int
iMenuHeight;
public LOGFONT lfMenuFont;
public
LOGFONT lfStatusFont;
public LOGFONT
lfMessageFont;
}
public struct ENUMLOGFONT
{
public LOGFONT
elfLogFont;
[MarshalAs(UnmanagedType.ByValArray,
SizeConst=GDI.LF_FULLFACESIZE)] public byte[] elfFullName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=GDI.LF_FACESIZE)]
public byte[] elfStyle;
}
public struct PANOSE
{
public int ulculture;
public byte
bFamilyType;
public byte bSerifStyle;
public byte
bWeight;
public byte bProportion;
public byte
bContrast;
public byte bStrokeVariation;
public
byte bArmStyle;
public byte bLetterform;
public
byte bMidline;
public byte bXHeight;
}
public
struct EXTLOGFONT
{
public LOGFONT
elfLogFont;
[MarshalAs(UnmanagedType.ByValArray,
SizeConst=GDI.LF_FULLFACESIZE)] public byte[] elfFullName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=GDI.LF_FACESIZE)]
public byte[] elfStyle;
public int
elfVersion;
public int elfStyleSize;
public int
elfMatch;
public int
elfReserved;
[MarshalAs(UnmanagedType.ByValArray,
SizeConst=GDI.ELF_VENDOR_SIZE)] public byte[] elfVendorId;
public int elfCulture;
public PANOSE
elfPanose;
}
public struct DEVMODE
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=32)]
public string dmDeviceName;
public short
dmSpecVersion;
public short
dmDriverVersion;
public short dmSize;
public short
dmDriverExtra;
public int dmFields;
public short
dmOrientation;
public short dmPaperSize;
public
short dmPaperLength;
public short
dmPaperWidth;
public short dmScale;
public short
dmCopies;
public short dmDefaultSource;
public
short dmPrintQuality;
public short dmColor;
public
short dmDuplex;
public short dmYResolution;
public
short dmTTOption;
public short
dmCollate;
[MarshalAs(UnmanagedType.ByValTStr,
SizeConst=GDI.CCHFORMNAME)] public string dmFormName;
public
short dmUnusedPadding;
public int
dmBitsPerPel;
public int dmPelsWidth;
public int
dmPelsHeight;
public int dmDisplayFlags;
public
int dmDisplayFrequency;
}
public struct RGNDATAHEADER
{
public int dwSize;
public int
iType;
public int nCount;
public int
nRgnSize;
public RECT rcBound;
}
public struct
RGNDATA
{
public RGNDATAHEADER
rdh;
public byte Buffer;
}
public struct ABC
{
public int abcA;
public int
abcB;
public int abcC;
}
public struct ABCFLOAT
{
public double abcfA;
public double
abcfB;
public double abcfC;
}
public struct
OUTLINETEXTMETRIC
{
public int
otmSize;
public TEXTMETRIC otmTextMetrics;
public
byte otmFiller;
public PANOSE
otmPanoseNumber;
public int otmfsSelection;
public
int otmfsType;
public int
otmsCharSlopeRise;
public int
otmsCharSlopeRun;
public int
otmItalicAngle;
public int otmEMSquare;
public int
otmAscent;
public int otmDescent;
public int
otmLineGap;
public int otmsCapEmHeight;
public int
otmsXHeight;
public RECT otmrcFontBox;
public int
otmMacAscent;
public int otmMacDescent;
public int
otmMacLineGap;
public int otmusMinimumPPEM;
public
POINT otmptSubscriptSize;
public POINT
otmptSubscriptOffset;
public POINT
otmptSuperscriptSize;
public POINT
otmptSuperscriptOffset;
public int
otmsStrikeoutSize;
public int
otmsStrikeoutPosition;
public int
otmsUnderscorePosition;
public int
otmsUnderscoreSize;
public string
otmpFamilyName;
public string otmpFaceName;
public
string otmpStyleName;
public string
otmpFullName;
}
public struct POLYTEXT
{
public int x;
public int
y;
public int n;
public string
lpStr;
public int uiFlags;
public RECT
rcl;
public int pdx;
}
public struct FIXED
{
public short fract;
public short
Value;
}
public struct MAT2
{
public
FIXED eM11;
public FIXED eM12;
public FIXED
eM21;
public FIXED eM22;
}
public struct
GLYPHMETRICS
{
public int
gmBlackBoxX;
public int gmBlackBoxY;
public POINT
gmptGlyphOrigin;
public short gmCellIncX;
public
short gmCellIncY;
}
public struct POINTFX
{
public FIXED x;
public FIXED
y;
}
public struct TTPOLYCURVE
{
public short wType;
public short
cpfx;
public POINTFX apfx;
}
public struct
TTPOLYGONHEADER
{
public int cb;
public
int dwType;
public POINTFX pfxStart;
}
public
struct RASTERIZER_STATUS
{
public short
nSize;
public short wFlags;
public short
nLanguageID;
}
public struct COLORADJUSTMENT
{
public short caSize;
public short
caFlags;
public short caIlluminantIndex;
public
short caRedGamma;
public short
caGreenGamma;
public short caBlueGamma;
public
short caReferenceBlack;
public short
caReferenceWhite;
public short caContrast;
public
short caBrightness;
public short
caColorfulness;
public short
caRedGreenTint;
}
public struct DOCINFO
{
public int cbSize;
public string
lpszDocName;
public string lpszOutput;
}
public
struct KERNINGPAIR
{
public short
wFirst;
public short wSecond;
public int
iKernAmount;
}
public struct BITMAPV4HEADER
{
public int bV4Size;
public int
bV4Width;
public int bV4Height;
public short
bV4Planes;
public short bV4BitCount;
public int
bV4V4Compression;
public int bV4SizeImage;
public
int bV4XPelsPerMeter;
public int
bV4YPelsPerMeter;
public int bV4ClrUsed;
public
int bV4ClrImportant;
public int bV4RedMask;
public
int bV4GreenMask;
public int bV4BlueMask;
public
int bV4AlphaMask;
public int bV4CSType;
public int
bV4Endpoints;
public int bV4GammaRed;
public int
bV4GammaGreen;
public int
bV4GammaBlue;
}
public struct FONTSIGNATURE
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst=4)]
public int fsUsb;
[MarshalAs(UnmanagedType.ByValArray,
SizeConst=2)] public int fsCsb;
}
public struct CHARSETINFO
{
public int ciCharset;
public int
ciACP;
public FONTSIGNATURE fs;
}
public struct
LOCALESIGNATURE
{
[MarshalAs(UnmanagedType.ByValArray,
SizeConst=4)] public int
lsUsb;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=2)] public
int lsCsbDefault;
[MarshalAs(UnmanagedType.ByValArray,
SizeConst=2)] public int lsCsbSupported;
}
public struct
NEWTEXTMETRICEX
{
public NEWTEXTMETRIC
ntmTm;
public FONTSIGNATURE
ntmFontSig;
}
public struct ENUMLOGFONTEX
{
public LOGFONT
elfLogFont;
[MarshalAs(UnmanagedType.ByValArray,
SizeConst=GDI.LF_FULLFACESIZE)] public byte[] elfFullName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=GDI.LF_FACESIZE)]
public byte[] elfStyle;
[MarshalAs(UnmanagedType.ByValArray,
SizeConst=GDI.LF_FACESIZE)] public byte[] elfScript;
}
public
struct GCP_RESULTS
{
public int
lStructSize;
public string lpOutString;
public int
lpOrder;
public int lpDX;
public int
lpCaretPos;
public string lpClass;
public string
lpGlyphs;
public int nGlyphs;
public int
nMaxFit;
}
public struct CIEXYZ
{
public int ciexyzX;
public int
ciexyzY;
public int ciexyzZ;
}
public struct
CIEXYZTRIPLE
{
public CIEXYZ
ciexyzRed;
public CIEXYZ ciexyzGreen;
public
CIEXYZ ciexyBlue;
}
public struct LOGCOLORSPACE
{
public int lcsSignature;
public int
lcsVersion;
public int lcsSize;
public int
lcsCSType;
public int lcsIntent;
public
CIEXYZTRIPLE lcsEndPoints;
public int
lcsGammaRed;
public int lcsGammaGreen;
public int
lcsGammaBlue;
[MarshalAs(UnmanagedType.ByValTStr,
SizeConst=Kernel.MAX_PATH)] public string lcsFileName;
}
public struct PIXELFORMATDESCRIPTOR
{
public short nSize;
public short
nVersion;
public int dwFlags;
public byte
iPixelType;
public byte cColorBits;
public byte
cRedBits;
public byte cRedShift;
public byte
cGreenBits;
public byte cGreenShift;
public byte
cBlueBits;
public byte cBlueShift;
public byte
cAlphaBits;
public byte cAlphaShift;
public byte
cAccumBits;
public byte cAccumRedBits;
public byte
cAccumGreenBits;
public byte
cAccumBlueBits;
public byte
cAccumAlphaBits;
public byte cDepthBits;
public
byte cStencilBits;
public byte cAuxBuffers;
public
byte iLayerType;
public byte bReserved;
public int
dwLayerMask;
public int dwVisibleMask;
public int
dwDamageMask;
}
 public abstract class
GDI
{
[DllImport("gdi32")] public static extern int
AbortDoc(HDC hdc);
[DllImport("gdi32")] public static extern int
AbortPath(HDC hdc);
[DllImport("gdi32")] public static extern int
AddFontResource(string lpFileName);
[DllImport("gdi32")] public
static extern int AngleArc(HDC hdc, int x, int y, int dwRadius, double
eStartAngle, double eSweepAngle);
[DllImport("gdi32")] public
static extern int AnimatePalette(HANDLE hPalette, int wStartIndex, int
wNumEntries, PALETTEENTRY[]
lpPaletteColors);
[DllImport("gdi32")] public static extern int
Arc(HDC hdc, int X1, int Y1, int X2, int Y2, int X3, int Y3, int X4, int
Y4);
[DllImport("gdi32")] public static extern int ArcTo(HDC hdc,
int X1, int Y1, int X2, int Y2, int X3, int Y3, int X4, int
Y4);
[DllImport("gdi32")] public static extern int BeginPath(HDC
hdc);
[DllImport("gdi32")] public static extern int BitBlt(HDC
hDestDC, int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc,
int dwRop);
[DllImport("gdi32")] public static extern int
CancelDC(HDC hdc);
[DllImport("gdi32")] public static extern int
CheckColorsInGamut(HDC hdc, IntPtr lpv, IntPtr lpv2, int
dw);
[DllImport("gdi32")] public static extern int
ChoosePixelFormat(HWND hdc, ref PIXELFORMATDESCRIPTOR
pPixelFormatDescriptor);
[DllImport("gdi32")] public static
extern int Chord(HDC hdc, int X1, int Y1, int X2, int Y2, int X3, int Y3, int
X4, int Y4);
[DllImport("gdi32")] public static extern int
CloseEnhMetaFile(HDC hdc);
[DllImport("gdi32")] public static
extern int CloseFigure(HDC hdc);
[DllImport("gdi32")] public
static extern int CloseMetaFile(HANDLE hMF);
[DllImport("gdi32")]
public static extern int ColorMatchToTarget(HDC hdc, HWND hdc2, int
dw);
[DllImport("gdi32")] public static extern int
CombineRgn(HANDLE hDestRgn, HANDLE hSrcRgn1, HANDLE hSrcRgn2, int
nCombineMode);
[DllImport("gdi32")] public static extern int
CombineTransform(ref XFORM lpxformResult, ref XFORM lpxform1, ref XFORM
lpxform2);
[DllImport("gdi32")] public static extern int
CopyEnhMetaFile(HANDLE hemfSrc, string
lpszFile);
[DllImport("gdi32")] public static extern int
CopyMetaFile(HANDLE hMF, string lpFileName);
[DllImport("gdi32")]
public static extern int CreateBitmap(int nWidth, int nHeight, int nPlanes, int
nBitCount, IntPtr lpBits);
[DllImport("gdi32")] public static
extern int CreateBitmapIndirect(ref BITMAP
lpBitmap);
[DllImport("gdi32")] public static extern int
CreateBrushIndirect(ref LOGBRUSH
lpLogBrush);
[DllImport("gdi32")] public static extern int
CreateColorSpace(ref LOGCOLORSPACE
lplogcolorspace);
[DllImport("gdi32")] public static extern int
CreateCompatibleBitmap(HDC hdc, int nWidth, int
nHeight);
[DllImport("gdi32")] public static extern int
CreateCompatibleDC(HDC hdc);
[DllImport("gdi32")] public static
extern int CreateDC(string lpDriverName, string lpDeviceName, string lpOutput,
ref DEVMODE lpInitData);
[DllImport("gdi32")] public static
extern int CreateDIBPatternBrush(HANDLE hPackedDIB, int
wUsage);
[DllImport("gdi32")] public static extern int
CreateDIBPatternBrushPt(IntPtr lpPackedDIB, int
iUsage);
[DllImport("gdi32")] public static extern int
CreateDIBSection(HWND hdc, ref BITMAPINFO pBitmapInfo, int un, ref IntPtr
lplpVoid, HANDLE handle, int dw);
[DllImport("gdi32")] public
static extern int CreateDIBitmap(HDC hdc, ref BITMAPINFOHEADER lpInfoHeader, int
dwUsage, IntPtr lpInitBits, ref BITMAPINFO lpInitInfo, int
wUsage);
[DllImport("gdi32")] public static extern int
CreateDiscardableBitmap(HDC hdc, int nWidth, int
nHeight);
[DllImport("gdi32")] public static extern int
CreateEllipticRgn(int X1, int Y1, int X2, int
Y2);
[DllImport("gdi32")] public static extern int
CreateEllipticRgnIndirect(ref RECT lpRect);
[DllImport("gdi32")]
public static extern int CreateEnhMetaFile(HWND hdcRef, string lpFileName, ref
RECT lpRect, string lpDescription);
[DllImport("gdi32")] public
static extern int CreateFont(HANDLE h, int W, int E, int O, int W2, int I, int
u, int S, int C, int OP, int CP, int Q, int PAF, string
F);
[DllImport("gdi32")] public static extern int
CreateFontIndirect(ref LOGFONT lpLogFont);
[DllImport("gdi32")]
public static extern int CreateHalftonePalette(HDC
hdc);
[DllImport("gdi32")] public static extern int
CreateHatchBrush(int nIndex, int crColor);
[DllImport("gdi32")]
public static extern int CreateIC(string lpDriverName, string lpDeviceName,
string lpOutput, ref DEVMODE lpInitData);
[DllImport("gdi32")]
public static extern int CreateMetaFile(string
lpString);
[DllImport("gdi32")] public static extern int
CreatePalette(ref LOGPALETTE lpLogPalette);
[DllImport("gdi32")]
public static extern int CreatePatternBrush(HANDLE
hBitmap);
[DllImport("gdi32")] public static extern int
CreatePen(int nPenStyle, int nWidth, int
crColor);
[DllImport("gdi32")] public static extern int
CreatePenIndirect(ref LOGPEN lpLogPen);
[DllImport("gdi32")]
public static extern int CreatePolyPolygonRgn(ref POINT lpPoint, ref int
lpPolyCounts, int nCount, int
nPolyFillMode);
[DllImport("gdi32")] public static extern int
CreatePolygonRgn(ref POINT lpPoint, int nCount, int
nPolyFillMode);
[DllImport("gdi32")] public static extern int
CreateRectRgn(int X1, int Y1, int X2, int
Y2);
[DllImport("gdi32")] public static extern int
CreateRectRgnIndirect(ref RECT lpRect);
[DllImport("gdi32")]
public static extern int CreateRoundRectRgn(int X1, int Y1, int X2, int Y2, int
X3, int Y3);
[DllImport("gdi32")] public static extern int
CreateScalableFontResource(int fHidden, string lpszResourceFile, string
lpszFontFile, string lpszCurrentPath);
[DllImport("gdi32")]
public static extern int CreateSolidBrush(int
crColor);
[DllImport("gdi32")] public static extern int
DPtoLP(HDC hdc, ref POINT lpPoint, int
nCount);
[DllImport("gdi32")] public static extern int
DeleteColorSpace(HANDLE hcolorspace);
[DllImport("gdi32")] public
static extern int DeleteDC(HDC hdc);
[DllImport("gdi32")] public
static extern int DeleteEnhMetaFile(HANDLE
hemf);
[DllImport("gdi32")] public static extern int
DeleteMetaFile(HANDLE hMF);
[DllImport("gdi32")] public static
extern int DeleteObject(HANDLE hObject);
[DllImport("gdi32")]
public static extern int DescribePixelFormat(HWND hdc, int n, int un, ref
PIXELFORMATDESCRIPTOR
lpPixelFormatDescriptor);
[DllImport("gdi32")] public static
extern int DrawEscape(HDC hdc, int nEscape, int cbInput, string
lpszInData);
[DllImport("gdi32")] public static extern int
Ellipse(HDC hdc, int X1, int Y1, int X2, int
Y2);
[DllImport("gdi32")] public static extern int EndDoc(HDC
hdc);
[DllImport("gdi32")] public static extern int EndPage(HDC
hdc);
[DllImport("gdi32")] public static extern int EndPath(HDC
hdc);
[DllImport("gdi32")] public static extern int
EnumEnhMetaFile(HDC hdc, HANDLE hemf, ref int lpEnhMetaFunc, IntPtr lpData, ref
RECT lpRect);
[DllImport("gdi32")] public static extern int
EnumFontFamilies(HDC hdc, string lpszFamily, ref int lpEnumFontFamProc, int
lParam);
[DllImport("gdi32")] public static extern int
EnumFontFamiliesEx(HDC hdc, ref LOGFONT lpLogFont, ref int lpEnumFontProc, int
lParam, int dw);
[DllImport("gdi32")] public static extern int
EnumFonts(HWND hdc, string lpsz, ref int lpFontEnumProc, int
lParam);
[DllImport("gdi32")] public static extern int
EnumICMProfiles(HDC hdc, int icmEnumProc, int
lParam);
[DllImport("gdi32")] public static extern int
EnumMetaFile(HWND hdc, HANDLE hMetafile, ref int lpMFEnumProc, int
lParam);
[DllImport("gdi32")] public static extern int
EnumObjects(HWND hdc, int n, ref int lpGOBJEnumProc, IntPtr
lpVoid);
[DllImport("gdi32")] public static extern int
EqualRgn(HANDLE hSrcRgn1, HANDLE hSrcRgn2);
[DllImport("gdi32")]
public static extern int Escape(HDC hdc, int nEscape, int nCount, string
lpInData, IntPtr lpOutData);
[DllImport("gdi32")] public static
extern int ExcludeClipRect(HDC hdc, int X1, int Y1, int X2, int
Y2);
[DllImport("gdi32")] public static extern int
ExtCreatePen(int dwPenStyle, int dwWidth, ref LOGBRUSH lplb, int dwStyleCount,
ref int lpStyle);
[DllImport("gdi32")] public static extern int
ExtCreateRegion(ref XFORM lpXform, int nCount, ref RGNDATA
lpRgnData);
[DllImport("gdi32")] public static extern int
ExtEscape(HDC hdc, int nEscape, int cbInput, string lpszInData, int cbOutput,
string lpszOutData);
[DllImport("gdi32")] public static extern
int ExtFloodFill(HDC hdc, int x, int y, int crColor, int
wFillType);
[DllImport("gdi32")] public static extern int
ExtSelectClipRgn(HDC hdc, HANDLE hRgn, int
fnMode);
[DllImport("gdi32")] public static extern int
ExtTextOut(HDC hdc, int x, int y, int wOptions, ref RECT lpRect, string
lpString, int nCount, ref int lpDx);
[DllImport("gdi32")] public
static extern int FillPath(HDC hdc);
[DllImport("gdi32")] public
static extern int FillRgn(HDC hdc, HANDLE hRgn, HANDLE
hBrush);
[DllImport("gdi32")] public static extern int
FixBrushOrgEx(HWND hdc, int n1, int n2, ref POINT
lpPoint);
[DllImport("gdi32")] public static extern int
FlattenPath(HDC hdc);
[DllImport("gdi32")] public static extern
int FloodFill(HDC hdc, int x, int y, int
crColor);
[DllImport("gdi32")] public static extern int
FrameRgn(HDC hdc, HANDLE hRgn, HANDLE hBrush, int nWidth, int
nHeight);
[DllImport("gdi32")] public static extern int
GdiComment(HDC hdc, int cbSize, Byte
lpData);
[DllImport("gdi32")] public static extern int
GdiFlush();
[DllImport("gdi32")] public static extern int
GdiGetBatchLimit();
[DllImport("gdi32")] public static extern int
GdiSetBatchLimit(int dwLimit);
[DllImport("gdi32")] public static
extern int GetArcDirection(HDC hdc);
[DllImport("gdi32")] public
static extern int GetAspectRatioFilterEx(HDC hdc, ref SIZE
lpAspectRatio);
[DllImport("gdi32")] public static extern int
GetBitmapBits(HANDLE hBitmap, int dwCount, IntPtr
lpBits);
[DllImport("gdi32")] public static extern int
GetBitmapDimensionEx(HANDLE hBitmap, ref SIZE
lpDimension);
[DllImport("gdi32")] public static extern int
GetBkColor(HDC hdc);
[DllImport("gdi32")] public static extern
int GetBkMode(HDC hdc);
[DllImport("gdi32")] public static extern
int GetBoundsRect(HDC hdc, ref RECT lprcBounds, int
flags);
[DllImport("gdi32")] public static extern int
GetBrushOrgEx(HWND hdc, ref POINT lpPoint);
[DllImport("gdi32")]
public static extern int GetCharABCWidths(HDC hdc, int uFirstChar, int
uLastChar, ref ABC lpabc);
[DllImport("gdi32")] public static
extern int GetCharABCWidthsFloat(HDC hdc, int iFirstChar, int iLastChar, ref
ABCFLOAT lpABCF);
[DllImport("gdi32")] public static extern int
GetCharWidth(HDC hdc, int wFirstChar, int wLastChar, int[]
lpBuffer);
[DllImport("gdi32")] public static extern int
GetCharWidth32(HDC hdc, int iFirstChar, int iLastChar, int[]
lpBuffer);
[DllImport("gdi32")] public static extern int
GetCharWidthFloat(HDC hdc, int iFirstChar, int iLastChar, double[]
pxBuffer);
[DllImport("gdi32")] public static extern int
GetCharacterPlacement(HDC hdc, string lpsz, int n1, int n2, ref GCP_RESULTS
lpGcpResults, int dw);
[DllImport("gdi32")] public static extern
int GetClipBox(HDC hdc, ref RECT lpRect);
[DllImport("gdi32")]
public static extern int GetClipRgn(HDC hdc, HANDLE
hRgn);
[DllImport("gdi32")] public static extern int
GetColorAdjustment(HDC hdc, ref COLORADJUSTMENT
lpca);
[DllImport("gdi32")] public static extern int
GetColorSpace(HDC hdc);
[DllImport("gdi32")] public static extern
int GetCurrentObject(HDC hdc, int
uObjectType);
[DllImport("gdi32")] public static extern int
GetCurrentPositionEx(HDC hdc, ref POINT
lpPoint);
[DllImport("gdi32")] public static extern int
GetDCOrgEx(HDC hdc, ref POINT lpPoint);
[DllImport("gdi32")]
public static extern int GetDIBColorTable(HWND hdc, int un1, int un2, ref
RGBQUAD pRGBQuad);
[DllImport("gdi32")] public static extern int
GetDIBits(int aHDC, HANDLE hBitmap, int nStartScan, int nNumScans, IntPtr
lpBits, ref BITMAPINFO lpBI, int wUsage);
[DllImport("gdi32")]
public static extern int GetDeviceCaps(HDC hdc, int
nIndex);
[DllImport("gdi32")] public static extern int
GetDeviceGammaRamp(HDC hdc, IntPtr lpv);
[DllImport("gdi32")]
public static extern int GetEnhMetaFile(string
lpszMetaFile);
[DllImport("gdi32")] public static extern int
GetEnhMetaFileBits(HANDLE hemf, int cbBuffer, Byte
lpbBuffer);
[DllImport("gdi32")] public static extern int
GetEnhMetaFileDescription(HANDLE hemf, int cchBuffer, string
lpszDescription);
[DllImport("gdi32")] public static extern int
GetEnhMetaFileHeader(HANDLE hemf, int cbBuffer, ref ENHMETAHEADER
lpemh);
[DllImport("gdi32")] public static extern int
GetEnhMetaFilePaletteEntries(HANDLE hemf, int cEntries, ref PALETTEENTRY
lppe);
[DllImport("gdi32")] public static extern int
GetFontData(HDC hdc, int dwTable, int dwOffset, IntPtr lpvBuffer, int
cbData);
[DllImport("gdi32")] public static extern int
GetFontLanguageInfo(HDC hdc);
[DllImport("gdi32")] public static
extern int GetGlyphOutline(HDC hdc, int uChar, int fuFormat, ref GLYPHMETRICS
lpgm, int cbBuffer, IntPtr lpBuffer, ref MAT2
lpmat2);
[DllImport("gdi32")] public static extern int
GetGraphicsMode(HDC hdc);
[DllImport("gdi32")] public static
extern int GetICMProfile(HDC hdc, int dw, string
lpStr);
[DllImport("gdi32")] public static extern int
GetKerningPairs(HDC hdc, int cPairs, ref KERNINGPAIR
lpkrnpair);
[DllImport("gdi32")] public static extern int
GetLogColorSpace(HANDLE hcolorspace, ref LOGCOLORSPACE lplogcolorspace, int
dw);
[DllImport("gdi32")] public static extern int GetMapMode(HDC
hdc);
[DllImport("gdi32")] public static extern int
GetMetaFile(string lpFileName);
[DllImport("gdi32")] public
static extern int GetMetaFileBitsEx(HANDLE hMF, int nSize, IntPtr
lpvData);
[DllImport("gdi32")] public static extern int
GetMetaRgn(HDC hdc, HANDLE hRgn);
[DllImport("gdi32")] public
static extern int GetMiterLimit(HDC hdc, double
peLimit);
[DllImport("gdi32")] public static extern int
GetNearestColor(HDC hdc, int crColor);
[DllImport("gdi32")]
public static extern int GetNearestPaletteIndex(HANDLE hPalette, int
crColor);
[DllImport("gdi32")] public static extern int
GetObject(HANDLE hObject, int nCount, IntPtr
lpObject);
[DllImport("gdi32")] public static extern int
GetObjectType(HANDLE hgdiobj);
[DllImport("gdi32")] public static
extern int GetOutlineTextMetrics(HDC hdc, int cbData, ref OUTLINETEXTMETRIC
lpotm);
[DllImport("gdi32")] public static extern int
GetPaletteEntries(HANDLE hPalette, int wStartIndex, int wNumEntries, ref
PALETTEENTRY lpPaletteEntries);
[DllImport("gdi32")] public
static extern int GetPath(HDC hdc, ref POINT lpPoint, Byte lpTypes, int
nSize);
[DllImport("gdi32")] public static extern int
GetPixel(HDC hdc, int x, int y);
[DllImport("gdi32")] public
static extern int GetPixelFormat(HWND hdc);
[DllImport("gdi32")]
public static extern int GetPolyFillMode(HDC
hdc);
[DllImport("gdi32")] public static extern int GetROP2(HDC
hdc);
[DllImport("gdi32")] public static extern int
GetRasterizerCaps(ref RASTERIZER_STATUS lpraststat, int
cb);
[DllImport("gdi32")] public static extern int
GetRegionData(HANDLE hRgn, int dwCount, ref RGNDATA
lpRgnData);
[DllImport("gdi32")] public static extern int
GetRgnBox(HANDLE hRgn, ref RECT lpRect);
[DllImport("gdi32")]
public static extern int GetStockObject(int
nIndex);
[DllImport("gdi32")] public static extern int
GetStretchBltMode(HDC hdc);
[DllImport("gdi32")] public static
extern int GetSystemPaletteEntries(HDC hdc, int wStartIndex, int wNumEntries,
ref PALETTEENTRY lpPaletteEntries);
[DllImport("gdi32")] public
static extern int GetSystemPaletteUse(HDC
hdc);
[DllImport("gdi32")] public static extern int
GetTextAlign(HDC hdc);
[DllImport("gdi32")] public static extern
int GetTextCharacterExtra(HDC hdc);
[DllImport("gdi32")] public
static extern int GetTextCharset(HDC hdc);
[DllImport("gdi32")]
public static extern int GetTextCharsetInfo(HDC hdc, ref FONTSIGNATURE lpSig,
int dwFlags);
[DllImport("gdi32")] public static extern int
GetTextColor(HDC hdc);
[DllImport("gdi32")] public static extern
int GetTextExtentExPoint(HDC hdc, string lpszStr, int cchString, int nMaxExtent,
ref int lpnFit, int alpDx, ref SIZE lpSize);
[DllImport("gdi32")]
public static extern int GetTextExtentPoint(HDC hdc, string lpszString, int
cbString, ref SIZE lpSize);
[DllImport("gdi32")] public static
extern int GetTextExtentPoint32(HDC hdc, string lpsz, int cbString, ref SIZE
lpSize);
[DllImport("gdi32")] public static extern int
GetTextFace(HDC hdc, int nCount, string
lpFacename);
[DllImport("gdi32")] public static extern int
GetTextMetrics(HDC hdc, ref TEXTMETRIC
lpMetrics);
[DllImport("gdi32")] public static extern int
GetViewportExtEx(HDC hdc, ref SIZE lpSize);
[DllImport("gdi32")]
public static extern int GetViewportOrgEx(HDC hdc, ref POINT
lpPoint);
[DllImport("gdi32")] public static extern int
GetWinMetaFileBits(HANDLE hemf, int cbBuffer, Byte lpbBuffer, int fnMapMode,
HWND hdcRef);
[DllImport("gdi32")] public static extern int
GetWindowExtEx(HDC hdc, ref SIZE lpSize);
[DllImport("gdi32")]
public static extern int GetWindowOrgEx(HDC hdc, ref POINT
lpPoint);
[DllImport("gdi32")] public static extern int
GetWorldTransform(HDC hdc, ref XFORM
lpXform);
[DllImport("gdi32")] public static extern int
IntersectClipRect(HDC hdc, int X1, int Y1, int X2, int
Y2);
[DllImport("gdi32")] public static extern int InvertRgn(HDC
hdc, HANDLE hRgn);
[DllImport("gdi32")] public static extern int
LPtoDP(HDC hdc, ref POINT lpPoint, int
nCount);
[DllImport("gdi32")] public static extern int
LineDDA(int n1, int n2, int n3, int n4, ref int lpLineDDAProc, int
lParam);
[DllImport("gdi32")] public static extern int LineTo(HDC
hdc, int x, int y);
[DllImport("gdi32")] public static extern int
MaskBlt(HWND hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HWND
hdcSrc, int nXSrc, int nYSrc, HANDLE hbmMask, int xMask, int yMask, int
dwRop);
[DllImport("gdi32")] public static extern int
ModifyWorldTransform(HDC hdc, ref XFORM lpXform, int
iMode);
[DllImport("gdi32")] public static extern int
MoveToEx(HDC hdc, int x, int y, ref POINT
lpPoint);
[DllImport("gdi32")] public static extern int
OffsetClipRgn(HDC hdc, int x, int y);
[DllImport("gdi32")] public
static extern int OffsetRgn(HANDLE hRgn, int x, int
y);
[DllImport("gdi32")] public static extern int
OffsetViewportOrgEx(HDC hdc, int nX, int nY, ref POINT
lpPoint);
[DllImport("gdi32")] public static extern int
OffsetWindowOrgEx(HDC hdc, int nX, int nY, ref POINT
lpPoint);
[DllImport("gdi32")] public static extern int
PaintRgn(HDC hdc, HANDLE hRgn);
[DllImport("gdi32")] public
static extern int PatBlt(HDC hdc, int x, int y, int nWidth, int nHeight, int
dwRop);
[DllImport("gdi32")] public static extern int
PathToRegion(HDC hdc);
[DllImport("gdi32")] public static extern
int Pie(HDC hdc, int X1, int Y1, int X2, int Y2, int X3, int Y3, int X4, int
Y4);
[DllImport("gdi32")] public static extern int
PlayEnhMetaFile(HDC hdc, HANDLE hemf, ref RECT
lpRect);
[DllImport("gdi32")] public static extern int
PlayEnhMetaFileRecord(HDC hdc, ref HANDLETABLE lpHandletable, ref ENHMETARECORD
lpEnhMetaRecord, int nHandles);
[DllImport("gdi32")] public
static extern int PlayMetaFile(HDC hdc, HANDLE
hMF);
[DllImport("gdi32")] public static extern int
PlayMetaFileRecord(HDC hdc, ref HANDLETABLE lpHandletable, ref METARECORD
lpMetaRecord, int nHandles);
[DllImport("gdi32")] public static
extern int PlgBlt(HWND hdcDest, ref POINT lpPoint, HWND hdcSrc, int nXSrc, int
nYSrc, int nWidth, int nHeight, HANDLE hbmMask, int xMask, int
yMask);
[DllImport("gdi32")] public static extern int
PolyBezier(HDC hdc, ref POINT lppt, int
cPoints);
[DllImport("gdi32")] public static extern int
PolyBezierTo(HDC hdc, ref POINT lppt, int
cCount);
[DllImport("gdi32")] public static extern int
PolyDraw(HDC hdc, ref POINT lppt, Byte lpbTypes, int
cCount);
[DllImport("gdi32")] public static extern int
PolyPolygon(HDC hdc, ref POINT lpPoint, ref int lpPolyCounts, int
nCount);
[DllImport("gdi32")] public static extern int
PolyPolyline(HDC hdc, ref POINT lppt, ref int lpdwPolyPoints, int
cCount);
[DllImport("gdi32")] public static extern int
PolyTextOut(HDC hdc, ref POLYTEXT pptxt, int
cStrings);
[DllImport("gdi32")] public static extern int
Polygon(HDC hdc, ref POINT lpPoint, int
nCount);
[DllImport("gdi32")] public static extern int
Polyline(HDC hdc, ref POINT lpPoint, int
nCount);
[DllImport("gdi32")] public static extern int
PolylineTo(HDC hdc, ref POINT lppt, int
cCount);
[DllImport("gdi32")] public static extern int
PtInRegion(HANDLE hRgn, int x, int y);
[DllImport("gdi32")]
public static extern int PtVisible(HDC hdc, int x, int
y);
[DllImport("gdi32")] public static extern int
RealizePalette(HDC hdc);
[DllImport("gdi32")] public static
extern int RectInRegion(HANDLE hRgn, ref RECT
lpRect);
[DllImport("gdi32")] public static extern int
RectVisible(HDC hdc, ref RECT lpRect);
[DllImport("gdi32")]
public static extern int Rectangle(HDC hdc, int X1, int Y1, int X2, int
Y2);
[DllImport("gdi32")] public static extern int
RemoveFontResource(string lpFileName);
[DllImport("gdi32")]
public static extern int ResetDC(HDC hdc, ref DEVMODE
lpInitData);
[DllImport("gdi32")] public static extern int
ResizePalette(HANDLE hPalette, int
nNumEntries);
[DllImport("gdi32")] public static extern int
RestoreDC(HDC hdc, int nSavedDC);
[DllImport("gdi32")] public
static extern int RoundRect(HDC hdc, int X1, int Y1, int X2, int Y2, int X3, int
Y3);
[DllImport("gdi32")] public static extern int SaveDC(HDC
hdc);
[DllImport("gdi32")] public static extern int
ScaleViewportExtEx(HDC hdc, int nXnum, int nXdenom, int nYnum, int nYdenom, ref
SIZE lpSize);
[DllImport("gdi32")] public static extern int
ScaleWindowExtEx(HDC hdc, int nXnum, int nXdenom, int nYnum, int nYdenom, ref
SIZE lpSize);
[DllImport("gdi32")] public static extern int
SelectClipPath(HDC hdc, int iMode);
[DllImport("gdi32")] public
static extern int SelectClipRgn(HDC hdc, HANDLE
hRgn);
[DllImport("gdi32")] public static extern int
SelectObject(HDC hdc, HANDLE hObject);
[DllImport("gdi32")]
public static extern int SelectPalette(HDC hdc, HANDLE hPalette, int
bForceBackground);
[DllImport("gdi32")] public static extern int
SetAbortProc(HWND hdc, ref int lpAbortProc);
[DllImport("gdi32")]
public static extern int SetArcDirection(HDC hdc, int
ArcDirection);
[DllImport("gdi32")] public static extern int
SetBitmapBits(HANDLE hBitmap, int dwCount, IntPtr
lpBits);
[DllImport("gdi32")] public static extern int
SetBitmapDimensionEx(HANDLE hbm, int nX, int nY, ref SIZE
lpSize);
[DllImport("gdi32")] public static extern int
SetBkColor(HDC hdc, int crColor);
[DllImport("gdi32")] public
static extern int SetBkMode(HDC hdc, int
nBkMode);
[DllImport("gdi32")] public static extern int
SetBoundsRect(HDC hdc, ref RECT lprcBounds, int
flags);
[DllImport("gdi32")] public static extern int
SetBrushOrgEx(HDC hdc, int nXOrg, int nYOrg, ref POINT
lppt);
[DllImport("gdi32")] public static extern int
SetColorAdjustment(HDC hdc, ref COLORADJUSTMENT
lpca);
[DllImport("gdi32")] public static extern int
SetColorSpace(HDC hdc, HANDLE hcolorspace);
[DllImport("gdi32")]
public static extern int SetDIBColorTable(HWND hdc, int un1, int un2, ref
RGBQUAD pcRGBQuad);
[DllImport("gdi32")] public static extern int
SetDIBits(HDC hdc, HANDLE hBitmap, int nStartScan, int nNumScans, IntPtr lpBits,
ref BITMAPINFO lpBI, int wUsage);
[DllImport("gdi32")] public
static extern int SetDIBitsToDevice(HDC hdc, int x, int y, int dx, int dy, int
SrcX, int SrcY, int Scan, int NumScans, IntPtr Bits, BITMAPINFO BitsInfo, int
wUsage);
[DllImport("gdi32")] public static extern int
SetDeviceGammaRamp(HDC hdc, IntPtr lpv);
[DllImport("gdi32")]
public static extern int SetEnhMetaFileBits(int cbBuffer, Byte
lpData);
[DllImport("gdi32")] public static extern int
SetGraphicsMode(HDC hdc, int iMode);
[DllImport("gdi32")] public
static extern int SetICMMode(HDC hdc, int
n);
[DllImport("gdi32")] public static extern int
SetICMProfile(HDC hdc, string lpStr);
[DllImport("gdi32")] public
static extern int SetMapMode(HDC hdc, int
nMapMode);
[DllImport("gdi32")] public static extern int
SetMapperFlags(HDC hdc, int dwFlag);
[DllImport("gdi32")] public
static extern int SetMetaFileBitsEx(int nSize, Byte
lpData);
[DllImport("gdi32")] public static extern int
SetMetaRgn(HDC hdc);
[DllImport("gdi32")] public static extern
int SetMiterLimit(HDC hdc, double eNewLimit, double
peOldLimit);
[DllImport("gdi32")] public static extern int
SetPaletteEntries(HANDLE hPalette, int wStartIndex, int wNumEntries, ref
PALETTEENTRY lpPaletteEntries);
[DllImport("gdi32")] public
static extern int SetPixel(HDC hdc, int x, int y, int
crColor);
[DllImport("gdi32")] public static extern int
SetPixelFormat(HWND hdc, int n, ref PIXELFORMATDESCRIPTOR
pcPixelFormatDescriptor);
[DllImport("gdi32")] public static
extern int SetPixelV(HDC hdc, int x, int y, int
crColor);
[DllImport("gdi32")] public static extern int
SetPolyFillMode(HDC hdc, int nPolyFillMode);
[DllImport("gdi32")]
public static extern int SetROP2(HDC hdc, int
nDrawMode);
[DllImport("gdi32")] public static extern int
SetRectRgn(HANDLE hRgn, int X1, int Y1, int X2, int
Y2);
[DllImport("gdi32")] public static extern int
SetStretchBltMode(HDC hdc, int
nStretchMode);
[DllImport("gdi32")] public static extern int
SetSystemPaletteUse(HDC hdc, int wUsage);
[DllImport("gdi32")]
public static extern int SetTextAlign(HDC hdc, int
wFlags);
[DllImport("gdi32")] public static extern int
SetTextCharacterExtra(HDC hdc, int
nCharExtra);
[DllImport("gdi32")] public static extern int
SetTextColor(HDC hdc, int crColor);
[DllImport("gdi32")] public
static extern int SetTextJustification(HDC hdc, int nBreakExtra, int
nBreakCount);
[DllImport("gdi32")] public static extern int
SetViewportExtEx(HDC hdc, int nX, int nY, ref SIZE
lpSize);
[DllImport("gdi32")] public static extern int
SetViewportOrgEx(HDC hdc, int nX, int nY, ref POINT
lpPoint);
[DllImport("gdi32")] public static extern int
SetWinMetaFileBits(int cbBuffer, Byte lpbBuffer, HWND hdcRef, ref METAFILEPICT
lpmfp);
[DllImport("gdi32")] public static extern int
SetWindowExtEx(HDC hdc, int nX, int nY, ref SIZE
lpSize);
[DllImport("gdi32")] public static extern int
SetWindowOrgEx(HDC hdc, int nX, int nY, ref POINT
lpPoint);
[DllImport("gdi32")] public static extern int
SetWorldTransform(HDC hdc, ref XFORM
lpXform);
[DllImport("gdi32")] public static extern int
StartDoc(HDC hdc, ref DOCINFO lpdi);
[DllImport("gdi32")] public
static extern int StartPage(HDC hdc);
[DllImport("gdi32")] public
static extern int StretchBlt(HDC hdc, int x, int y, int nWidth, int nHeight,
HANDLE hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, int
dwRop);
[DllImport("gdi32")] public static extern int
StretchDIBits(HDC hdc, int x, int y, int dx, int dy, int SrcX, int SrcY, int
wSrcWidth, int wSrcHeight, IntPtr lpBits, ref BITMAPINFO lpBitsInfo, int wUsage,
int dwRop);
[DllImport("gdi32")] public static extern int
StrokeAndFillPath(HDC hdc);
[DllImport("gdi32")] public static
extern int StrokePath(HDC hdc);
[DllImport("gdi32")] public
static extern int SwapBuffers(HWND hdc);
[DllImport("gdi32")]
public static extern int TextOut(HDC hdc, int x, int y, string lpString, int
nCount);
[DllImport("gdi32")] public static extern int
TranslateCharsetInfo(int lpSrc, ref CHARSETINFO lpcs, int
dwFlags);
[DllImport("gdi32")] public static extern int
UnrealizeObject(HANDLE hObject);
[DllImport("gdi32")] public
static extern int UpdateColors(HDC hdc);
[DllImport("gdi32")]
public static extern int WidenPath(HDC hdc);
public const int ABSOLUTE = 1;
public const int AD_CLOCKWISE = 2;
public const int AD_COUNTERCLOCKWISE = 1;
public const int ALTERNATE = 1;
public const int ANSI_CHARSET = 0;
public const int ANSI_FIXED_FONT = 11;
public const int ANSI_VAR_FONT = 12;
public const int ARABIC_CHARSET = 178;
public const int ASPECTX = 40;
public const int ASPECTXY = 44;
public const int ASPECTY = 42;
public const int ASPECT_FILTERING = 0x1;
public const int AbortDocC = 2;
public const int BALTIC_CHARSET = 186;
public const int BANDINFO = 24;
public const int BEGIN_PATH = 4096;
public const int BITSPIXEL = 12;
public const int BI_RGB = 0;
public const int BI_RLE4 = 2;
public const int BI_RLE8 = 1;
public const int BI_bitfields = 3;
public const int BKMODE_LAST = 2;
public const int BLACKNESS = 0x42;
public const int BLACKONWHITE = 1;
public const int BLACK_BRUSH = 4;
public const int BLACK_PEN = 7;
public const int BS_DIBPATTERN = 5;
public const int BS_DIBPATTERN8X8 = 8;
public const int BS_DIBPATTERNPT = 6;
public const int BS_HATCHED = 2;
public const int BS_HOLLOW = BS_NULL;
public const int BS_INDEXED = 4;
public const int BS_NULL = 1;
public const int BS_PATTERN = 3;
public const int BS_PATTERN8X8 = 7;
public const int BS_SOLID = 0;
public const int CA_LOG_FILTER = 0x2;
public const int CA_NEGATIVE = 0x1;
public const int CBM_CREATEDIB = 0x2;
public const int CBM_INIT = 0x4;
public const int CCHDEVICENAME = 32;
public const int CCHFORMNAME = 32;
public const int CC_CHORD = 4;
public const int CC_CIRCLES = 1;
public const int CC_ELLIPSES = 8;
public const int CC_INTERIORS = 128;
public const int CC_NONE = 0;
public const int CC_PIE = 2;
public const int CC_ROUNDRECT = 256;
public const int CC_STYLED = 32;
public const int CC_WIDE = 16;
public const int CC_WIDESTYLED = 64;
public const int CHINESEBIG5_CHARSET = 136;
public const int CLIPCAPS = 36;
public const int CLIP_CHARACTER_PRECIS = 1;
public const int CLIP_DEFAULT_PRECIS = 0;
public const int CLIP_EMBEDDED = 128;
public const int CLIP_LH_ANGLES = 16;
public const int CLIP_MASK = 0xF;
public const int CLIP_STROKE_PRECIS = 2;
public const int CLIP_TO_PATH = 4097;
public const int CLIP_TT_ALWAYS = 32;
public const int CLOSECHANNEL = 4112;
public const int CLR_INVALID = 0xFFFF;
public const int COLORONCOLOR = 3;
public const int COLORRES = 108;
public const int COLOR_ADJ_MAX = 100;
public const int COLOR_ADJ_MIN = -100;
public const int COMPLEXREGION = 3;
public const int CP_NONE = 0;
public const int CP_RECTANGLE = 1;
public const int CP_REGION = 2;
public const int CURVECAPS = 28;
public const int DCBA_FACEDOWNCENTER = 0x101;
public const int DCBA_FACEDOWNLEFT = 0x102;
public const int DCBA_FACEDOWNNONE = 0x100;
public const int DCBA_FACEDOWNRIGHT = 0x103;
public const int DCBA_FACEUPCENTER = 0x1;
public const int DCBA_FACEUPLEFT = 0x2;
public const int DCBA_FACEUPNONE = 0x0;
public const int DCBA_FACEUPRIGHT = 0x3;
public const int DCB_ACCUMULATE = 0x2;
public const int DCB_DIRTY = DCB_ACCUMULATE;
public const int DCB_DISABLE = 0x8;
public const int DCB_ENABLE = 0x4;
public const int DCB_RESET = 0x1;
public const int DCB_SET = (DCB_RESET | DCB_ACCUMULATE);
public const int DCTT_BITMAP = 0x1;
public const int DCTT_DOWNLOAD = 0x2;
public const int DCTT_DOWNLOAD_OUTLINE = 0x8;
public const int DCTT_SUBDEV = 0x4;
public const int DC_BINADJUST = 19;
public const int DC_BINNAMES = 12;
public const int DC_BINS = 6;
public const int DC_COLLATE = 22;
public const int DC_COPIES = 18;
public const int DC_DATATYPE_PRODUCED = 21;
public const int DC_DRIVER = 11;
public const int DC_DUPLEX = 7;
public const int DC_EMF_COMPLIANT = 20;
public const int DC_ENUMRESOLUTIONS = 13;
public const int DC_EXTRA = 9;
public const int DC_FIELDS = 1;
public const int DC_FILEDEPENDENCIES = 14;
public const int DC_MAXEXTENT = 5;
public const int DC_MINEXTENT = 4;
public const int DC_ORIENTATION = 17;
public const int DC_PAPERNAMES = 16;
public const int DC_PAPERS = 2;
public const int DC_PAPERSIZE = 3;
public const int DC_SIZE = 8;
public const int DC_TRUETYPE = 15;
public const int DC_VERSION = 10;
public const int DEFAULT_CHARSET = 1;
public const int DEFAULT_GUI_FONT = 17;
public const int DEFAULT_PALETTE = 15;
public const int DEFAULT_PITCH = 0;
public const int DEFAULT_QUALITY = 0;
public const int DEVICEDATA = 19;
public const int DEVICE_DEFAULT_FONT = 14;
public const int DEVICE_FONTTYPE = 0x2;
public const int DIB_PAL_COLORS = 1;
public const int DIB_PAL_INDICES = 2;
public const int DIB_PAL_LOGINDICES = 4;
public const int DIB_PAL_PHYSINDICES = 2;
public const int DIB_RGB_COLORS = 0;
public const int DKGRAY_BRUSH = 3;
public const int DMBIN_AUTO = 7;
public const int DMBIN_CASSETTE = 14;
public const int DMBIN_ENVELOPE = 5;
public const int DMBIN_ENVMANUAL = 6;
public const int DMBIN_FIRST = DMBIN_UPPER;
public const int DMBIN_LARGECAPACITY = 11;
public const int DMBIN_LARGEFMT = 10;
public const int DMBIN_LAST = DMBIN_CASSETTE;
public const int DMBIN_LOWER = 2;
public const int DMBIN_MANUAL = 4;
public const int DMBIN_MIDDLE = 3;
public const int DMBIN_ONLYONE = 1;
public const int DMBIN_SMALLFMT = 9;
public const int DMBIN_TRACTOR = 8;
public const int DMBIN_UPPER = 1;
public const int DMBIN_USER = 256;
public const int DMCOLLATE_FALSE = 0;
public const int DMCOLLATE_TRUE = 1;
public const int DMCOLOR_COLOR = 2;
public const int DMCOLOR_MONOCHROME = 1;
public const int DMDITHER_COARSE = 2;
public const int DMDITHER_FINE = 3;
public const int DMDITHER_GRAYSCALE = 5;
public const int DMDITHER_LINEART = 4;
public const int DMDITHER_NONE = 1;
public const int DMDITHER_USER = 256;
public const int DMDUP_HORIZONTAL = 3;
public const int DMDUP_SIMPLEX = 1;
public const int DMDUP_VERTICAL = 2;
public const int DMICMMETHOD_DEVICE = 4;
public const int DMICMMETHOD_DRIVER = 3;
public const int DMICMMETHOD_NONE = 1;
public const int DMICMMETHOD_SYSTEM = 2;
public const int DMICMMETHOD_USER = 256;
public const int DMICM_COLORMETRIC = 3;
public const int DMICM_CONTRAST = 2;
public const int DMICM_SATURATE = 1;
public const int DMICM_USER = 256;
public const int DMMEDIA_GLOSSY = 2;
public const int DMMEDIA_STANDARD = 1;
public const int DMMEDIA_TRANSPARENCY = 3;
public const int DMMEDIA_USER = 256;
public const int DMORIENT_LANDSCAPE = 2;
public const int DMORIENT_PORTRAIT = 1;
public const int DMPAPER_10X11 = 45;
public const int DMPAPER_10X14 = 16;
public const int DMPAPER_11X17 = 17;
public const int DMPAPER_15X11 = 46;
public const int DMPAPER_9X11 = 44;
public const int DMPAPER_A2 = 66;
public const int DMPAPER_A3 = 8;
public const int DMPAPER_A3_EXTRA = 63;
public const int DMPAPER_A3_EXTRA_TRANSVERSE = 68;
public const int DMPAPER_A3_TRANSVERSE = 67;
public const int DMPAPER_A4 = 9;
public const int DMPAPER_A4SMALL = 10;
public const int DMPAPER_A4_EXTRA = 53;
public const int DMPAPER_A4_PLUS = 60;
public const int DMPAPER_A4_TRANSVERSE = 55;
public const int DMPAPER_A5 = 11;
public const int DMPAPER_A5_EXTRA = 64;
public const int DMPAPER_A5_TRANSVERSE = 61;
public const int DMPAPER_A_PLUS = 57;
public const int DMPAPER_B4 = 12;
public const int DMPAPER_B5 = 13;
public const int DMPAPER_B5_EXTRA = 65;
public const int DMPAPER_B5_TRANSVERSE = 62;
public const int DMPAPER_B_PLUS = 58;
public const int DMPAPER_CSHEET = 24;
public const int DMPAPER_DSHEET = 25;
public const int DMPAPER_ENV_10 = 20;
public const int DMPAPER_ENV_11 = 21;
public const int DMPAPER_ENV_12 = 22;
public const int DMPAPER_ENV_14 = 23;
public const int DMPAPER_ENV_9 = 19;
public const int DMPAPER_ENV_B4 = 33;
public const int DMPAPER_ENV_B5 = 34;
public const int DMPAPER_ENV_B6 = 35;
public const int DMPAPER_ENV_C3 = 29;
public const int DMPAPER_ENV_C4 = 30;
public const int DMPAPER_ENV_C5 = 28;
public const int DMPAPER_ENV_C6 = 31;
public const int DMPAPER_ENV_C65 = 32;
public const int DMPAPER_ENV_DL = 27;
public const int DMPAPER_ENV_INVITE = 47;
public const int DMPAPER_ENV_ITALY = 36;
public const int DMPAPER_ENV_MONARCH = 37;
public const int DMPAPER_ENV_PERSONAL = 38;
public const int DMPAPER_ESHEET = 26;
public const int DMPAPER_EXECUTIVE = 7;
public const int DMPAPER_FANFOLD_LGL_GERMAN = 41;
public const int DMPAPER_FANFOLD_STD_GERMAN = 40;
public const int DMPAPER_FANFOLD_US = 39;
public const int DMPAPER_FIRST = DMPAPER_LETTER;
public const int DMPAPER_FOLIO = 14;
public const int DMPAPER_ISO_B4 = 42;
public const int DMPAPER_JAPANESE_POSTCARD = 43;
public const int DMPAPER_LAST = DMPAPER_FANFOLD_LGL_GERMAN;
public const int DMPAPER_LEDGER = 4;
public const int DMPAPER_LEGAL = 5;
public const int DMPAPER_LEGAL_EXTRA = 51;
public const int DMPAPER_LETTER = 1;
public const int DMPAPER_LETTERSMALL = 2;
public const int DMPAPER_LETTER_EXTRA = 50;
public const int DMPAPER_LETTER_EXTRA_TRANSVERSE = 56;
public const int DMPAPER_LETTER_PLUS = 59;
public const int DMPAPER_LETTER_TRANSVERSE = 54;
public const int DMPAPER_NOTE = 18;
public const int DMPAPER_QUARTO = 15;
public const int DMPAPER_RESERVED_48 = 48;
public const int DMPAPER_RESERVED_49 = 49;
public const int DMPAPER_STATEMENT = 6;
public const int DMPAPER_TABLOID = 3;
public const int DMPAPER_TABLOID_EXTRA = 52;
public const int DMPAPER_USER = 256;
public const int DMRES_DRAFT = (-1);
public const int DMRES_HIGH = (-4);
public const int DMRES_LOW = (-2);
public const int DMRES_MEDIUM = (-3);
public const int DMTT_BITMAP = 1;
public const int DMTT_DOWNLOAD = 2;
public const int DMTT_DOWNLOAD_OUTLINE = 4;
public const int DMTT_SUBDEV = 3;
public const int DM_COLLATE = 0x8000;
public const int DM_COLOR = 0x800;
public const int DM_COPIES = 0x100;
public const int DM_COPY = 2;
public const int DM_DEFAULTSOURCE = 0x200;
public const int DM_DITHERTYPE = 0x10000000;
public const int DM_DUPLEX = 0x1000;
public const int DM_FORMNAME = 0x10000;
public const int DM_GRAYSCALE = 0x1;
public const int DM_ICMINTENT = 0x4000000;
public const int DM_ICMMETHOD = 0x2000000;
public const int DM_INTERLACED = 0x2;
public const int DM_IN_BUFFER = DM_MODIFY;
public const int DM_IN_PROMPT = DM_PROMPT;
public const int DM_MEDIATYPE = 0x8000000;
public const int DM_MODIFY = 8;
public const int DM_ORIENTATION = 0x1;
public const int DM_OUT_BUFFER = DM_COPY;
public const int DM_OUT_DEFAULT = DM_UPDATE;
public const int DM_PAPERLENGTH = 0x4;
public const int DM_PAPERSIZE = 0x2;
public const int DM_PAPERWIDTH = 0x8;
public const int DM_PRINTQUALITY = 0x400;
public const int DM_PROMPT = 4;
public const int DM_RESERVED1 = 0x800000;
public const int DM_RESERVED2 = 0x1000000;
public const int DM_SCALE = 0x10;
public const int DM_SPECVERSION = 0x320;
public const int DM_TTOPTION = 0x4000;
public const int DM_UPDATE = 1;
public const int DM_YRESOLUTION = 0x2000;
public const int DOWNLOADFACE = 514;
public const int DOWNLOADHEADER = 4111;
public const int DRAFTMODE = 7;
public const int DRAFT_QUALITY = 1;
public const int DRAWPATTERNRECT = 25;
public const int DRIVERVERSION = 0;
public const int DSTINVERT = 0x550009;
public const int DT_CHARSTREAM = 4;
public const int DT_DISPFILE = 6;
public const int DT_METAFILE = 5;
public const int DT_PLOTTER = 0;
public const int DT_RASCAMERA = 3;
public const int DT_RASDISPLAY = 1;
public const int DT_RASPRINTER = 2;
public const int EASTEUROPE_CHARSET = 238;
public const int ELF_CULTURE_LATIN = 0;
public const int ELF_VENDOR_SIZE = 4;
public const int ELF_VERSION = 0;
public const int ENABLEDUPLEX = 28;
public const int ENABLEPAIRKERNING = 769;
public const int ENABLERELATIVEWIDTHS = 768;
public const int ENCAPSULATED_POSTSCRIPT = 4116;
public const int END_PATH = 4098;
public const int ENHMETA_SIGNATURE = 0x464D4520;
public const int ENHMETA_STOCK_OBJECT = unchecked((int)0x80000000);
public const int ENUMPAPERBINS = 31;
public const int ENUMPAPERMETRICS = 34;
public const int EPSPRINTING = 33;
public const int ERROR = 0;
public const int ETO_CLIPPED = 4;
public const int ETO_GRAYED = 1;
public const int ETO_OPAQUE = 2;
public const int EXT_DEVICE_CAPS = 4099;
public const int EndDocC = 11;
public const int ExtTextOutC = 512;
public const int FF_DECORATIVE = 80;
public const int FF_DONTCARE = 0;
public const int FF_MODERN = 48;
public const int FF_ROMAN = 16;
public const int FF_SCRIPT = 64;
public const int FF_SWISS = 32;
public const int FIXED_PITCH = 1;
public const int FLI_GLYPHS = 0x40000;
public const int FLI_MASK = 0x103B;
public const int FLOODFILLBORDER = 0;
public const int FLOODFILLSURFACE = 1;
public const int FLUSHOUTPUT = 6;
public const int FONTMAPPER_MAX = 10;
public const int FS_ARABIC = 0x40;
public const int FS_BALTIC = 0x80;
public const int FS_CHINESESIMP = 0x40000;
public const int FS_CHINESETRAD = 0x100000;
public const int FS_CYRILLIC = 0x4;
public const int FS_GREEK = 0x8;
public const int FS_HEBREW = 0x20;
public const int FS_JISJAPAN = 0x20000;
public const int FS_JOHAB = 0x200000;
public const int FS_LATIN1 = 0x1;
public const int FS_LATIN2 = 0x2;
public const int FS_SYMBOL = unchecked((int)0x80000000);
public const int FS_THAI = 0x10000;
public const int FS_TURKISH = 0x10;
public const int FS_WANSUNG = 0x80000;
public const int FW_BLACK = FW_HEAVY;
public const int FW_BOLD = 700;
public const int FW_DEMIBOLD = FW_SEMIBOLD;
public const int FW_DONTCARE = 0;
public const int FW_EXTRABOLD = 800;
public const int FW_EXTRALIGHT = 200;
public const int FW_HEAVY = 900;
public const int FW_LIGHT = 300;
public const int FW_MEDIUM = 500;
public const int FW_NORMAL = 400;
public const int FW_REGULAR = FW_NORMAL;
public const int FW_SEMIBOLD = 600;
public const int FW_THIN = 100;
public const int FW_ULTRABOLD = FW_EXTRABOLD;
public const int FW_ULTRALIGHT = FW_EXTRALIGHT;
public const int GCPCLASS_ARABIC = 2;
public const int GCPCLASS_HEBREW = 2;
public const int GCPCLASS_LATIN = 1;
public const int GCPCLASS_LATINNUMBER = 5;
public const int GCPCLASS_LATINNUMERICSEPARATOR = 7;
public const int GCPCLASS_LATINNUMERICTERMINATOR = 6;
public const int GCPCLASS_LOCALNUMBER = 4;
public const int GCPCLASS_NEUTRAL = 3;
public const int GCPCLASS_NUMERICSEPARATOR = 8;
public const int GCPCLASS_PREBOUNDLTR = 0x40;
public const int GCPCLASS_PREBOUNDRTL = 0x80;
public const int GCP_CLASSIN = 0x80000;
public const int GCP_DBCS = 0x1;
public const int GCP_DIACRITIC = 0x100;
public const int GCP_DISPLAYZWG = 0x400000;
public const int GCP_ERROR = 0x8000;
public const int GCP_GLYPHSHAPE = 0x10;
public const int GCP_JUSTIFY = 0x10000;
public const int GCP_JUSTIFYIN = 0x200000;
public const int GCP_KASHIDA = 0x400;
public const int GCP_LIGATE = 0x20;
public const int GCP_MAXEXTENT = 0x100000;
public const int GCP_NEUTRALOVERRIDE = 0x2000000;
public const int GCP_NODIACRITICS = 0x20000;
public const int GCP_NUMERICOVERRIDE = 0x1000000;
public const int GCP_NUMERICSLATIN = 0x4000000;
public const int GCP_NUMERICSLOCAL = 0x8000000;
public const int GCP_REORDER = 0x2;
public const int GCP_SYMSWAPOFF = 0x800000;
public const int GCP_USEKERNING = 0x8;
public const int GDI_ERROR = 0xFFFF;
public const int GETCOLORTABLE = 5;
public const int GETDEVICEUNITS = 42;
public const int GETEXTENDEDTEXTMETRICS = 256;
public const int GETEXTENTTABLE = 257;
public const int GETFACENAME = 513;
public const int GETPAIRKERNTABLE = 258;
public const int GETPENWIDTH = 16;
public const int GETPHYSPAGESIZE = 12;
public const int GETPRINTINGOFFSET = 13;
public const int GETSCALINGFACTOR = 14;
public const int GETSETPAPERBINS = 29;
public const int GETSETPAPERMETRICS = 35;
public const int GETSETPRINTORIENT = 30;
public const int GETSETSCREENPARAMS = 3072;
public const int GETTECHNOLGY = 20;
public const int GETTECHNOLOGY = 20;
public const int GETTRACKKERNTABLE = 259;
public const int GETVECTORBRUSHSIZE = 27;
public const int GETVECTORPENSIZE = 26;
public const int GGO_BITMAP = 1;
public const int GGO_GLYPH_INDEX = 0x80;
public const int GGO_GRAY2_BITMAP = 4;
public const int GGO_GRAY4_BITMAP = 5;
public const int GGO_GRAY8_BITMAP = 6;
public const int GGO_METRICS = 0;
public const int GGO_NATIVE = 2;
public const int GM_ADVANCED = 2;
public const int GM_COMPATIBLE = 1;
public const int GM_LAST = 2;
public const int GRAY_BRUSH = 2;
public const int GREEK_CHARSET = 161;
public const int HALFTONE = 4;
public const int HANGEUL_CHARSET = 129;
public const int HEBREW_CHARSET = 177;
public const int HGDI_ERROR = 0xFFFF;
public const int HOLLOW_BRUSH = NULL_BRUSH;
public const int HORZRES = 8;
public const int HORZSIZE = 4;
public const int HS_API_MAX = 25;
public const int HS_BDIAGONAL = 3;
public const int HS_BDIAGONAL1 = 7;
public const int HS_CROSS = 4;
public const int HS_DENSE1 = 9;
public const int HS_DENSE2 = 10;
public const int HS_DENSE3 = 11;
public const int HS_DENSE4 = 12;
public const int HS_DENSE5 = 13;
public const int HS_DENSE6 = 14;
public const int HS_DENSE7 = 15;
public const int HS_DENSE8 = 16;
public const int HS_DIAGCROSS = 5;
public const int HS_DITHEREDBKCLR = 24;
public const int HS_DITHEREDCLR = 20;
public const int HS_DITHEREDTEXTCLR = 22;
public const int HS_FDIAGONAL = 2;
public const int HS_FDIAGONAL1 = 6;
public const int HS_HALFTONE = 18;
public const int HS_HORIZONTAL = 0;
public const int HS_NOSHADE = 17;
public const int HS_SOLID = 8;
public const int HS_SOLIDBKCLR = 23;
public const int HS_SOLIDCLR = 19;
public const int HS_SOLIDTEXTCLR = 21;
public const int HS_VERTICAL = 1;
public const int ICM_OFF = 1;
public const int ICM_ON = 2;
public const int ICM_QUERY = 3;
public const int ILLUMINANT_A = 1;
public const int ILLUMINANT_B = 2;
public const int ILLUMINANT_C = 3;
public const int ILLUMINANT_D50 = 4;
public const int ILLUMINANT_D55 = 5;
public const int ILLUMINANT_D65 = 6;
public const int ILLUMINANT_D75 = 7;
public const int ILLUMINANT_DAYLIGHT = ILLUMINANT_C;
public const int ILLUMINANT_DEVICE_DEFAULT = 0;
public const int ILLUMINANT_F2 = 8;
public const int ILLUMINANT_FLUORESCENT = ILLUMINANT_F2;
public const int ILLUMINANT_MAX_INDEX = ILLUMINANT_F2;
public const int ILLUMINANT_NTSC = ILLUMINANT_C;
public const int ILLUMINANT_TUNGSTEN = ILLUMINANT_A;
public const int JOHAB_CHARSET = 130;
public const int LC_INTERIORS = 128;
public const int LC_MARKER = 4;
public const int LC_NONE = 0;
public const int LC_POLYLINE = 2;
public const int LC_POLYMARKER = 8;
public const int LC_STYLED = 32;
public const int LC_WIDE = 16;
public const int LC_WIDESTYLED = 64;
public const int LF_FACESIZE = 32;
public const int LF_FULLFACESIZE = 64;
public const int LINECAPS = 30;
public const int LOGPIXELSX = 88;
public const int LOGPIXELSY = 90;
public const int LTGRAY_BRUSH = 1;
public const int MAC_CHARSET = 77;
public const int MAXSTRETCHBLTMODE = 4;
public const int MERGECOPY = 0xC000CA;
public const int MERGEPAINT = 0xBB0226;
public const int META_ANIMATEPALETTE = 0x436;
public const int META_ARC = 0x817;
public const int META_BITBLT = 0x922;
public const int META_CHORD = 0x830;
public const int META_CREATEBRUSHINDIRECT = 0x2FC;
public const int META_CREATEFONTINDIRECT = 0x2FB;
public const int META_CREATEPALETTE = 0xF7;
public const int META_CREATEPATTERNBRUSH = 0x1F9;
public const int META_CREATEPENINDIRECT = 0x2FA;
public const int META_CREATEREGION = 0x6FF;
public const int META_DELETEOBJECT = 0x1F0;
public const int META_DIBBITBLT = 0x940;
public const int META_DIBCREATEPATTERNBRUSH = 0x142;
public const int META_DIBSTRETCHBLT = 0xB41;
public const int META_ELLIPSE = 0x418;
public const int META_ESCAPE = 0x626;
public const int META_EXCLUDECLIPRECT = 0x415;
public const int META_EXTFLOODFILL = 0x548;
public const int META_EXTTEXTOUT = 0xA32;
public const int META_FILLREGION = 0x228;
public const int META_FLOODFILL = 0x419;
public const int META_FRAMEREGION = 0x429;
public const int META_INTERSECTCLIPRECT = 0x416;
public const int META_INVERTREGION = 0x12A;
public const int META_LINETO = 0x213;
public const int META_MOVETO = 0x214;
public const int META_OFFSETCLIPRGN = 0x220;
public const int META_OFFSETVIEWPORTORG = 0x211;
public const int META_OFFSETWINDOWORG = 0x20F;
public const int META_PAINTREGION = 0x12B;
public const int META_PATBLT = 0x61D;
public const int META_PIE = 0x81A;
public const int META_POLYGON = 0x324;
public const int META_POLYLINE = 0x325;
public const int META_POLYPOLYGON = 0x538;
public const int META_REALIZEPALETTE = 0x35;
public const int META_RECTANGLE = 0x41B;
public const int META_RESIZEPALETTE = 0x139;
public const int META_RESTOREDC = 0x127;
public const int META_ROUNDRECT = 0x61C;
public const int META_SAVEDC = 0x1E;
public const int META_SCALEVIEWPORTEXT = 0x412;
public const int META_SCALEWINDOWEXT = 0x410;
public const int META_SELECTCLIPREGION = 0x12C;
public const int META_SELECTOBJECT = 0x12D;
public const int META_SELECTPALETTE = 0x234;
public const int META_SETBKCOLOR = 0x201;
public const int META_SETBKMODE = 0x102;
public const int META_SETDIBTODEV = 0xD33;
public const int META_SETMAPMODE = 0x103;
public const int META_SETMAPPERFLAGS = 0x231;
public const int META_SETPALENTRIES = 0x37;
public const int META_SETPIXEL = 0x41F;
public const int META_SETPOLYFILLMODE = 0x106;
public const int META_SETRELABS = 0x105;
public const int META_SETROP2 = 0x104;
public const int META_SETSTRETCHBLTMODE = 0x107;
public const int META_SETTEXTALIGN = 0x12E;
public const int META_SETTEXTCHAREXTRA = 0x108;
public const int META_SETTEXTCOLOR = 0x209;
public const int META_SETTEXTJUSTIFICATION = 0x20A;
public const int META_SETVIEWPORTEXT = 0x20E;
public const int META_SETVIEWPORTORG = 0x20D;
public const int META_SETWINDOWEXT = 0x20C;
public const int META_SETWINDOWORG = 0x20B;
public const int META_STRETCHBLT = 0xB23;
public const int META_STRETCHDIB = 0xF43;
public const int META_TEXTOUT = 0x521;
public const int MFCOMMENT = 15;
public const int MM_ANISOTROPIC = 8;
public const int MM_HIENGLISH = 5;
public const int MM_HIMETRIC = 3;
public const int MM_ISOTROPIC = 7;
public const int MM_LOENGLISH = 4;
public const int MM_LOMETRIC = 2;
public const int MM_MAX = MM_ANISOTROPIC;
public const int MM_MAX_FIXEDSCALE = MM_TWIPS;
public const int MM_MIN = MM_TEXT;
public const int MM_TEXT = 1;
public const int MM_TWIPS = 6;
public const int MONO_FONT = 8;
public const int MOUSETRAILS = 39;
public const int MWT_IDENTITY = 1;
public const int MWT_LEFTMULTIPLY = 2;
public const int MWT_MAX = MWT_RIGHTMULTIPLY;
public const int MWT_MIN = MWT_IDENTITY;
public const int MWT_RIGHTMULTIPLY = 3;
public const int NEWFRAME = 1;
public const int NEXTBAND = 3;
public const int NOTSRCCOPY = 0x330008;
public const int NOTSRCERASE = 0x1100A6;
public const int NTM_BOLD = 0x20;
public const int NTM_ITALIC = 0x1;
public const int NTM_REGULAR = 0x40;
public const int NULLREGION = 1;
public const int NULL_BRUSH = 5;
public const int NULL_PEN = 8;
public const int NUMBRUSHES = 16;
public const int NUMCOLORS = 24;
public const int NUMFONTS = 22;
public const int NUMMARKERS = 20;
public const int NUMPENS = 18;
public const int NUMRESERVED = 106;
public const int OBJ_BITMAP = 7;
public const int OBJ_BRUSH = 2;
public const int OBJ_DC = 3;
public const int OBJ_ENHMETADC = 12;
public const int OBJ_ENHMETAFILE = 13;
public const int OBJ_EXTPEN = 11;
public const int OBJ_FONT = 6;
public const int OBJ_MEMDC = 10;
public const int OBJ_METADC = 4;
public const int OBJ_METAFILE = 9;
public const int OBJ_PAL = 5;
public const int OBJ_PEN = 1;
public const int OBJ_REGION = 8;
public const int OEM_CHARSET = 255;
public const int OEM_FIXED_FONT = 10;
public const int OPAQUE = 2;
public const int OPENCHANNEL = 4110;
public const int OUT_CHARACTER_PRECIS = 2;
public const int OUT_DEFAULT_PRECIS = 0;
public const int OUT_DEVICE_PRECIS = 5;
public const int OUT_OUTLINE_PRECIS = 8;
public const int OUT_RASTER_PRECIS = 6;
public const int OUT_STRING_PRECIS = 1;
public const int OUT_STROKE_PRECIS = 3;
public const int OUT_TT_ONLY_PRECIS = 7;
public const int OUT_TT_PRECIS = 4;
public const int PANOSE_COUNT = 10;
public const int PAN_ANY = 0;
public const int PAN_ARMSTYLE_INDEX = 6;
public const int PAN_BENT_ARMS_DOUBLE_SERIF = 11;
public const int PAN_BENT_ARMS_HORZ = 7;
public const int PAN_BENT_ARMS_SINGLE_SERIF = 10;
public const int PAN_BENT_ARMS_VERT = 9;
public const int PAN_BENT_ARMS_WEDGE = 8;
public const int PAN_CONTRAST_HIGH = 8;
public const int PAN_CONTRAST_INDEX = 4;
public const int PAN_CONTRAST_LOW = 4;
public const int PAN_CONTRAST_MEDIUM = 6;
public const int PAN_CONTRAST_MEDIUM_HIGH = 7;
public const int PAN_CONTRAST_MEDIUM_LOW = 5;
public const int PAN_CONTRAST_NONE = 2;
public const int PAN_CONTRAST_VERY_HIGH = 9;
public const int PAN_CONTRAST_VERY_LOW = 3;
public const int PAN_CULTURE_LATIN = 0;
public const int PAN_FAMILYTYPE_INDEX = 0;
public const int PAN_FAMILY_DECORATIVE = 4;
public const int PAN_FAMILY_PICTORIAL = 5;
public const int PAN_FAMILY_SCRIPT = 3;
public const int PAN_FAMILY_TEXT_DISPLAY = 2;
public const int PAN_LETTERFORM_INDEX = 7;
public const int PAN_LETT_NORMAL_BOXED = 4;
public const int PAN_LETT_NORMAL_CONTACT = 2;
public const int PAN_LETT_NORMAL_FLATTENED = 5;
public const int PAN_LETT_NORMAL_OFF_CENTER = 7;
public const int PAN_LETT_NORMAL_ROUNDED = 6;
public const int PAN_LETT_NORMAL_SQUARE = 8;
public const int PAN_LETT_NORMAL_WEIGHTED = 3;
public const int PAN_LETT_OBLIQUE_BOXED = 11;
public const int PAN_LETT_OBLIQUE_CONTACT = 9;
public const int PAN_LETT_OBLIQUE_FLATTENED = 12;
public const int PAN_LETT_OBLIQUE_OFF_CENTER = 14;
public const int PAN_LETT_OBLIQUE_ROUNDED = 13;
public const int PAN_LETT_OBLIQUE_SQUARE = 15;
public const int PAN_LETT_OBLIQUE_WEIGHTED = 10;
public const int PAN_MIDLINE_CONSTANT_POINTED = 9;
public const int PAN_MIDLINE_CONSTANT_SERIFED = 10;
public const int PAN_MIDLINE_CONSTANT_TRIMMED = 8;
public const int PAN_MIDLINE_HIGH_POINTED = 6;
public const int PAN_MIDLINE_HIGH_SERIFED = 7;
public const int PAN_MIDLINE_HIGH_TRIMMED = 5;
public const int PAN_MIDLINE_INDEX = 8;
public const int PAN_MIDLINE_LOW_POINTED = 12;
public const int PAN_MIDLINE_LOW_SERIFED = 13;
public const int PAN_MIDLINE_LOW_TRIMMED = 11;
public const int PAN_MIDLINE_STANDARD_POINTED = 3;
public const int PAN_MIDLINE_STANDARD_SERIFED = 4;
public const int PAN_MIDLINE_STANDARD_TRIMMED = 2;
public const int PAN_NO_FIT = 1;
public const int PAN_PROPORTION_INDEX = 3;
public const int PAN_PROP_CONDENSED = 6;
public const int PAN_PROP_EVEN_WIDTH = 4;
public const int PAN_PROP_EXPANDED = 5;
public const int PAN_PROP_MODERN = 3;
public const int PAN_PROP_MONOSPACED = 9;
public const int PAN_PROP_OLD_STYLE = 2;
public const int PAN_PROP_VERY_CONDENSED = 8;
public const int PAN_PROP_VERY_EXPANDED = 7;
public const int PAN_SERIFSTYLE_INDEX = 1;
public const int PAN_SERIF_BONE = 8;
public const int PAN_SERIF_COVE = 2;
public const int PAN_SERIF_EXAGGERATED = 9;
public const int PAN_SERIF_FLARED = 14;
public const int PAN_SERIF_NORMAL_SANS = 11;
public const int PAN_SERIF_OBTUSE_COVE = 3;
public const int PAN_SERIF_OBTUSE_SANS = 12;
public const int PAN_SERIF_OBTUSE_SQUARE_COVE = 5;
public const int PAN_SERIF_PERP_SANS = 13;
public const int PAN_SERIF_ROUNDED = 15;
public const int PAN_SERIF_SQUARE = 6;
public const int PAN_SERIF_SQUARE_COVE = 4;
public const int PAN_SERIF_THIN = 7;
public const int PAN_SERIF_TRIANGLE = 10;
public const int PAN_STRAIGHT_ARMS_DOUBLE_SERIF = 6;
public const int PAN_STRAIGHT_ARMS_HORZ = 2;
public const int PAN_STRAIGHT_ARMS_SINGLE_SERIF = 5;
public const int PAN_STRAIGHT_ARMS_VERT = 4;
public const int PAN_STRAIGHT_ARMS_WEDGE = 3;
public const int PAN_STROKEVARIATION_INDEX = 5;
public const int PAN_STROKE_GRADUAL_DIAG = 2;
public const int PAN_STROKE_GRADUAL_HORZ = 5;
public const int PAN_STROKE_GRADUAL_TRAN = 3;
public const int PAN_STROKE_GRADUAL_VERT = 4;
public const int PAN_STROKE_INSTANT_VERT = 8;
public const int PAN_STROKE_RAPID_HORZ = 7;
public const int PAN_STROKE_RAPID_VERT = 6;
public const int PAN_WEIGHT_BLACK = 10;
public const int PAN_WEIGHT_BOLD = 8;
public const int PAN_WEIGHT_BOOK = 5;
public const int PAN_WEIGHT_DEMI = 7;
public const int PAN_WEIGHT_HEAVY = 9;
public const int PAN_WEIGHT_INDEX = 2;
public const int PAN_WEIGHT_LIGHT = 3;
public const int PAN_WEIGHT_MEDIUM = 6;
public const int PAN_WEIGHT_NORD = 11;
public const int PAN_WEIGHT_THIN = 4;
public const int PAN_WEIGHT_VERY_LIGHT = 2;
public const int PAN_XHEIGHT_CONSTANT_LARGE = 4;
public const int PAN_XHEIGHT_CONSTANT_SMALL = 2;
public const int PAN_XHEIGHT_CONSTANT_STD = 3;
public const int PAN_XHEIGHT_DUCKING_LARGE = 7;
public const int PAN_XHEIGHT_DUCKING_SMALL = 5;
public const int PAN_XHEIGHT_DUCKING_STD = 6;
public const int PAN_XHEIGHT_INDEX = 9;
public const int PASSTHROUGH = 19;
public const int PATCOPY = 0xF00021;
public const int PATINVERT = 0x5A0049;
public const int PATPAINT = 0xFB0A09;
public const int PC_EXPLICIT = 0x2;
public const int PC_INTERIORS = 128;
public const int PC_NOCOLLAPSE = 0x4;
public const int PC_NONE = 0;
public const int PC_POLYGON = 1;
public const int PC_RECTANGLE = 2;
public const int PC_RESERVED = 0x1;
public const int PC_SCANLINE = 8;
public const int PC_STYLED = 32;
public const int PC_TRAPEZOID = 4;
public const int PC_WIDE = 16;
public const int PC_WIDESTYLED = 64;
public const int PC_WINDPOLYGON = 4;
public const int PDEVICESIZE = 26;
public const int PHYSICALHEIGHT = 111;
public const int PHYSICALOFFSETX = 112;
public const int PHYSICALOFFSETY = 113;
public const int PHYSICALWIDTH = 110;
public const int PLANES = 14;
public const int POLYFILL_LAST = 2;
public const int POLYGONALCAPS = 32;
public const int POSTSCRIPT_DATA = 37;
public const int POSTSCRIPT_IGNORE = 38;
public const int POSTSCRIPT_PASSTHROUGH = 4115;
public const int PROOF_QUALITY = 2;
public const int PR_JOBSTATUS = 0x0;
public const int PS_ALTERNATE = 8;
public const int PS_COSMETIC = 0x0;
public const int PS_DASH = 1;
public const int PS_DASHDOT = 3;
public const int PS_DASHDOTDOT = 4;
public const int PS_DOT = 2;
public const int PS_ENDCAP_FLAT = 0x200;
public const int PS_ENDCAP_MASK = 0xF00;
public const int PS_ENDCAP_ROUND = 0x0;
public const int PS_ENDCAP_SQUARE = 0x100;
public const int PS_GEOMETRIC = 0x10000;
public const int PS_INSIDEFRAME = 6;
public const int PS_JOIN_BEVEL = 0x1000;
public const int PS_JOIN_MASK = 0xF000;
public const int PS_JOIN_MITER = 0x2000;
public const int PS_JOIN_ROUND = 0x0;
public const int PS_NULL = 5;
public const int PS_SOLID = 0;
public const int PS_STYLE_MASK = 0xF;
public const int PS_TYPE_MASK = 0xF0000;
public const int PS_USERSTYLE = 7;
public const int PT_BEZIERTO = 0x4;
public const int PT_CLOSEFIGURE = 0x1;
public const int PT_LINETO = 0x2;
public const int PT_MOVETO = 0x6;
public const int QUERYESCSUPPORT = 8;
public const int R2_BLACK = 1;
public const int R2_COPYPEN = 13;
public const int R2_LAST = 16;
public const int R2_MASKNOTPEN = 3;
public const int R2_MASKPEN = 9;
public const int R2_MASKPENNOT = 5;
public const int R2_MERGENOTPEN = 12;
public const int R2_MERGEPEN = 15;
public const int R2_MERGEPENNOT = 14;
public const int R2_NOP = 11;
public const int R2_NOT = 6;
public const int R2_NOTCOPYPEN = 4;
public const int R2_NOTMASKPEN = 8;
public const int R2_NOTMERGEPEN = 2;
public const int R2_NOTXORPEN = 10;
public const int R2_WHITE = 16;
public const int R2_XORPEN = 7;
public const int RASTERCAPS = 38;
public const int RASTER_FONTTYPE = 0x1;
public const int RC_BANDING = 2;
public const int RC_BIGFONT = 0x400;
public const int RC_BITBLT = 1;
public const int RC_BITMAP64 = 8;
public const int RC_DEVBITS = 0x8000;
public const int RC_DIBTODEV = 0x200;
public const int RC_DI_BITMAP = 0x80;
public const int RC_FLOODFILL = 0x1000;
public const int RC_GDI20_OUTPUT = 0x10;
public const int RC_GDI20_STATE = 0x20;
public const int RC_NONE = 0;
public const int RC_OP_DX_OUTPUT = 0x4000;
public const int RC_PALETTE = 0x100;
public const int RC_SAVEBITMAP = 0x40;
public const int RC_SCALING = 4;
public const int RC_STRETCHBLT = 0x800;
public const int RC_STRETCHDIB = 0x2000;
public const int RDH_RECTANGLES = 1;
public const int REFERENCE_BLACK_MAX = 4000;
public const int REFERENCE_BLACK_MIN = 0;
public const int REFERENCE_WHITE_MAX = 10000;
public const int REFERENCE_WHITE_MIN = 6000;
public const int RELATIVE = 2;
public const int RESTORE_CTM = 4100;
public const int RGB_GAMMA_MAX = 65000;
public const int RGB_GAMMA_MIN = 2500;
public const int RGN_AND = 1;
public const int RGN_COPY = 5;
public const int RGN_DIFF = 4;
public const int RGN_MAX = RGN_COPY;
public const int RGN_MIN = RGN_AND;
public const int RGN_OR = 2;
public const int RGN_XOR = 3;
public const int RUSSIAN_CHARSET = 204;
public const int SAVE_CTM = 4101;
public const int SCALINGFACTORX = 114;
public const int SCALINGFACTORY = 115;
public const int SELECTPAPERSOURCE = 18;
public const int SETABORTPROC = 9;
public const int SETALLJUSTVALUES = 771;
public const int SETCHARSET = 772;
public const int SETCOLORTABLE = 4;
public const int SETCOPYCOUNT = 17;
public const int SETDIBSCALING = 32;
public const int SETKERNTRACK = 770;
public const int SETLINECAP = 21;
public const int SETLINEJOIN = 22;
public const int SET_ARC_DIRECTION = 4102;
public const int SET_BACKGROUND_COLOR = 4103;
public const int SET_BOUNDS = 4109;
public const int SET_CLIP_BOX = 4108;
public const int SET_MIRROR_MODE = 4110;
public const int SET_POLY_MODE = 4104;
public const int SET_SCREEN_ANGLE = 4105;
public const int SET_SPREAD = 4106;
public const int SHIFTJIS_CHARSET = 128;
public const int SIMPLEREGION = 2;
public const int SIZEPALETTE = 104;
public const int SP_APPABORT = (-2);
public const int SP_ERROR = (-1);
public const int SP_NOTREPORTED = 0x4000;
public const int SP_OUTOFDISK = (-4);
public const int SP_OUTOFMEMORY = (-5);
public const int SP_USERABORT = (-3);
public const int SRCAND = 0x8800C6;
public const int SRCCOPY = 0xCC0020;
public const int SRCERASE = 0x440328;
public const int SRCINVERT = 0x660046;
public const int SRCPAINT = 0xEE0086;
public const int STOCK_LAST = 16;
public const int STRETCH_ANDSCANS = 1;
public const int STRETCH_DELETESCANS = 3;
public const int STRETCH_HALFTONE = 4;
public const int STRETCH_ORSCANS = 2;
public const int SYMBOL_CHARSET = 2;
public const int SYSPAL_ERROR = 0;
public const int SYSPAL_NOSTATIC = 2;
public const int SYSPAL_STATIC = 1;
public const int SYSTEM_FIXED_FONT = 16;
public const int SYSTEM_FONT = 13;
public const int SetMiterLimitC = 23;
public const int StartDocC = 10;
public const int StretchBltC = 2048;
public const int TA_BASELINE = 24;
public const int TA_BOTTOM = 8;
public const int TA_CENTER = 6;
public const int TA_LEFT = 0;
public const int TA_MASK = (TA_BASELINE + TA_CENTER + TA_UPDATECP);
public const int TA_NOUPDATECP = 0;
public const int TA_RIGHT = 2;
public const int TA_TOP = 0;
public const int TA_UPDATECP = 1;
public const int TCI_SRCCHARSET = 1;
public const int TCI_SRCCODEPAGE = 2;
public const int TCI_SRCFONTSIG = 3;
public const int TC_CP_STROKE = 0x4;
public const int TC_CR_90 = 0x8;
public const int TC_CR_ANY = 0x10;
public const int TC_EA_DOUBLE = 0x200;
public const int TC_IA_ABLE = 0x400;
public const int TC_OP_CHARACTER = 0x1;
public const int TC_OP_STROKE = 0x2;
public const int TC_RA_ABLE = 0x2000;
public const int TC_RESERVED = 0x8000;
public const int TC_SA_CONTIN = 0x100;
public const int TC_SA_DOUBLE = 0x40;
public const int TC_SA_INTEGER = 0x80;
public const int TC_SCROLLBLT = 0x10000;
public const int TC_SF_X_YINDEP = 0x20;
public const int TC_SO_ABLE = 0x1000;
public const int TC_UA_ABLE = 0x800;
public const int TC_VA_ABLE = 0x4000;
public const int TECHNOLOGY = 2;
public const int TEXTCAPS = 34;
public const int THAI_CHARSET = 222;
public const int TMPF_DEVICE = 0x8;
public const int TMPF_FIXED_PITCH = 0x1;
public const int TMPF_TRUETYPE = 0x4;
public const int TMPF_VECTOR = 0x2;
public const int TRANSFORM_CTM = 4107;
public const int TRANSPARENT = 1;
public const int TRUETYPE_FONTTYPE = 0x4;
public const int TT_AVAILABLE = 0x1;
public const int TT_ENABLED = 0x2;
public const int TT_POLYGON_TYPE = 24;
public const int TT_PRIM_LINE = 1;
public const int TT_PRIM_QSPLINE = 2;
public const int TURKISH_CHARSET = 162;
public const int VARIABLE_PITCH = 2;
public const int VERTRES = 10;
public const int VERTSIZE = 6;
public const int VTA_BASELINE = TA_BASELINE;
public const int VTA_BOTTOM = TA_RIGHT;
public const int VTA_CENTER = TA_CENTER;
public const int VTA_LEFT = TA_BOTTOM;
public const int VTA_RIGHT = TA_TOP;
public const int VTA_TOP = TA_LEFT;
public const int WHITENESS = 0xFF0062;
public const int WHITEONBLACK = 2;
public const int WHITE_BRUSH = 0;
public const int WHITE_PEN = 6;
public const int WINDING = 2;
}
}


using System;
namespace Win32
{
public abstract class ERROR
{
public const int CACHE_E_FIRST = unchecked((int) 0x80040170);
public const int CACHE_E_LAST = unchecked((int) 0x8004017F);
public const int CACHE_E_NOCACHE_UPDATED = unchecked((int) 0x80040170);
public const int CACHE_S_FIRST = 0x40170;
public const int CACHE_S_FORMATETC_NOTSUPPORTED = 0x40170;
public const int CACHE_S_LAST = 0x4017F;
public const int CACHE_S_SAMECACHE = 0x40171;
public const int CACHE_S_SOMECACHES_NOTUPDATED = 0x40172;
public const int CLASSFACTORY_E_FIRST = unchecked((int) 0x80040110);
public const int CLASSFACTORY_E_LAST = unchecked((int) 0x8004011F);
public const int CLASSFACTORY_S_FIRST = 0x40110;
public const int CLASSFACTORY_S_LAST = 0x4011F;
public const int CLASS_E_CLASSNOTAVAILABLE = unchecked((int) 0x80040111);
public const int CLASS_E_NOAGGREGATION = unchecked((int) 0x80040110);
public const int CLIENTSITE_E_FIRST = unchecked((int) 0x80040190);
public const int CLIENTSITE_E_LAST = unchecked((int) 0x8004019F);
public const int CLIENTSITE_S_FIRST = 0x40190;
public const int CLIENTSITE_S_LAST = 0x4019F;
public const int CLIPBRD_E_BAD_DATA = unchecked((int) 0x800401D3);
public const int CLIPBRD_E_CANT_CLOSE = unchecked((int) 0x800401D4);
public const int CLIPBRD_E_CANT_EMPTY = unchecked((int) 0x800401D1);
public const int CLIPBRD_E_CANT_OPEN = unchecked((int) 0x800401D0);
public const int CLIPBRD_E_CANT_SET = unchecked((int) 0x800401D2);
public const int CLIPBRD_E_FIRST = unchecked((int) 0x800401D0);
public const int CLIPBRD_E_LAST = unchecked((int) 0x800401DF);
public const int CLIPBRD_S_FIRST = 0x401D0;
public const int CLIPBRD_S_LAST = 0x401DF;
public const int CONVERT10_E_FIRST = unchecked((int) 0x800401C0);
public const int CONVERT10_E_LAST = unchecked((int) 0x800401CF);
public const int CONVERT10_E_OLESTREAM_BITMAP_TO_DIB = unchecked((int) 0x800401C3);
public const int CONVERT10_E_OLESTREAM_FMT = unchecked((int) 0x800401C2);
public const int CONVERT10_E_OLESTREAM_GET = unchecked((int) 0x800401C0);
public const int CONVERT10_E_OLESTREAM_PUT = unchecked((int) 0x800401C1);
public const int CONVERT10_E_STG_DIB_TO_BITMAP = unchecked((int) 0x800401C6);
public const int CONVERT10_E_STG_FMT = unchecked((int) 0x800401C4);
public const int CONVERT10_E_STG_NO_STD_STREAM = unchecked((int) 0x800401C5);
public const int CONVERT10_S_FIRST = 0x401C0;
public const int CONVERT10_S_LAST = 0x401CF;
public const int CONVERT10_S_NO_PRESENTATION = 0x401C0;
public const int CO_E_ALREADYINITIALIZED = unchecked((int) 0x800401F1);
public const int CO_E_APPDIDNTREG = unchecked((int) 0x800401FE);
public const int CO_E_APPNOTFOUND = unchecked((int) 0x800401F5);
public const int CO_E_APPSINGLEUSE = unchecked((int) 0x800401F6);
public const int CO_E_BAD_PATH = unchecked((int) 0x80080004);
public const int CO_E_CANTDETERMINECLASS = unchecked((int) 0x800401F2);
public const int CO_E_CLASSSTRING = unchecked((int) 0x800401F3);
public const int CO_E_CLASS_CREATE_FAILED = unchecked((int) 0x80080001);
public const int CO_E_DLLNOTFOUND = unchecked((int) 0x800401F8);
public const int CO_E_ERRORINAPP = unchecked((int) 0x800401F7);
public const int CO_E_ERRORINDLL = unchecked((int) 0x800401F9);
public const int CO_E_FIRST = unchecked((int) 0x800401F0);
public const int CO_E_IIDSTRING = unchecked((int) 0x800401F4);
public const int CO_E_INIT_CLASS_CACHE = unchecked((int) 0x80004009);
public const int CO_E_INIT_MEMORY_ALLOCATOR = unchecked((int) 0x80004008);
public const int CO_E_INIT_ONLY_SINGLE_THREADED = unchecked((int) 0x80004012);
public const int CO_E_INIT_RPC_CHANNEL = unchecked((int) 0x8000400A);
public const int CO_E_INIT_SCM_EXEC_FAILURE = unchecked((int) 0x80004011);
public const int CO_E_INIT_SCM_FILE_MAPPING_EXISTS = unchecked((int) 0x8000400F);
public const int CO_E_INIT_SCM_MAP_VIEW_OF_FILE = unchecked((int) 0x80004010);
public const int CO_E_INIT_SCM_MUTEX_EXISTS = unchecked((int) 0x8000400E);
public const int CO_E_INIT_SHARED_ALLOCATOR = unchecked((int) 0x80004007);
public const int CO_E_INIT_TLS = unchecked((int) 0x80004006);
public const int CO_E_INIT_TLS_CHANNEL_CONTROL = unchecked((int) 0x8000400C);
public const int CO_E_INIT_TLS_SET_CHANNEL_CONTROL = unchecked((int) 0x8000400B);
public const int CO_E_INIT_UNACCEPTED_USER_ALLOCATOR = unchecked((int) 0x8000400D);
public const int CO_E_LAST = unchecked((int) 0x800401FF);
public const int CO_E_NOTINITIALIZED = unchecked((int) 0x800401F0);
public const int CO_E_OBJISREG = unchecked((int) 0x800401FC);
public const int CO_E_OBJNOTCONNECTED = unchecked((int) 0x800401FD);
public const int CO_E_OBJNOTREG = unchecked((int) 0x800401FB);
public const int CO_E_OBJSRV_RPC_FAILURE = unchecked((int) 0x80080006);
public const int CO_E_RELEASED = unchecked((int) 0x800401FF);
public const int CO_E_SCM_ERROR = unchecked((int) 0x80080002);
public const int CO_E_SCM_RPC_FAILURE = unchecked((int) 0x80080003);
public const int CO_E_SERVER_EXEC_FAILURE = unchecked((int) 0x80080005);
public const int CO_E_SERVER_STOPPING = unchecked((int) 0x80080008);
public const int CO_E_WRONGOSFORAPP = unchecked((int) 0x800401FA);
public const int CO_S_FIRST = 0x401F0;
public const int CO_S_LAST = 0x401FF;
public const int DATA_E_FIRST = unchecked((int) 0x80040130);
public const int DATA_E_LAST = unchecked((int) 0x8004013F);
public const int DATA_S_FIRST = 0x40130;
public const int DATA_S_LAST = 0x4013F;
public const int DATA_S_SAMEFORMATETC = 0x40130;
public const int DISP_E_ARRAYISLOCKED = unchecked((int) 0x8002000D);
public const int DISP_E_BADCALLEE = unchecked((int) 0x80020010);
public const int DISP_E_BADINDEX = unchecked((int) 0x8002000B);
public const int DISP_E_BADPARAMCOUNT = unchecked((int) 0x8002000E);
public const int DISP_E_BADVARTYPE = unchecked((int) 0x80020008);
public const int DISP_E_EXCEPTION = unchecked((int) 0x80020009);
public const int DISP_E_MEMBERNOTFOUND = unchecked((int) 0x80020003);
public const int DISP_E_NONAMEDARGS = unchecked((int) 0x80020007);
public const int DISP_E_NOTACOLLECTION = unchecked((int) 0x80020011);
public const int DISP_E_OVERFLOW = unchecked((int) 0x8002000A);
public const int DISP_E_PARAMNOTFOUND = unchecked((int) 0x80020004);
public const int DISP_E_PARAMNOTOPTIONAL = unchecked((int) 0x8002000F);
public const int DISP_E_TYPEMISMATCH = unchecked((int) 0x80020005);
public const int DISP_E_UNKNOWNINTERFACE = unchecked((int) 0x80020001);
public const int DISP_E_UNKNOWNLCID = unchecked((int) 0x8002000C);
public const int DISP_E_UNKNOWNNAME = unchecked((int) 0x80020006);
public const int DRAGDROP_E_ALREADYREGISTERED = unchecked((int) 0x80040101);
public const int DRAGDROP_E_FIRST = unchecked((int) 0x80040100);
public const int DRAGDROP_E_INVALIDHWND = unchecked((int) 0x80040102);
public const int DRAGDROP_E_LAST = unchecked((int) 0x8004010F);
public const int DRAGDROP_E_NOTREGISTERED = unchecked((int) 0x80040100);
public const int DRAGDROP_S_CANCEL = 0x40101;
public const int DRAGDROP_S_DROP = 0x40100;
public const int DRAGDROP_S_FIRST = 0x40100;
public const int DRAGDROP_S_LAST = 0x4010F;
public const int DRAGDROP_S_USEDEFAULTCURSORS = 0x40102;
public const int DV_E_CLIPFORMAT = unchecked((int) 0x8004006A);
public const int DV_E_DVASPECT = unchecked((int) 0x8004006B);
public const int DV_E_DVTARGETDEVICE = unchecked((int) 0x80040065);
public const int DV_E_DVTARGETDEVICE_SIZE = unchecked((int) 0x8004006C);
public const int DV_E_FORMATETC = unchecked((int) 0x80040064);
public const int DV_E_LINDEX = unchecked((int) 0x80040068);
public const int DV_E_NOIVIEWOBJECT = unchecked((int) 0x8004006D);
public const int DV_E_STATDATA = unchecked((int) 0x80040067);
public const int DV_E_STGMEDIUM = unchecked((int) 0x80040066);
public const int DV_E_TYMED = unchecked((int) 0x80040069);
public const int ENUM_E_FIRST = unchecked((int) 0x800401B0);
public const int ENUM_E_LAST = unchecked((int) 0x800401BF);
public const int ENUM_S_FIRST = 0x401B0;
public const int ENUM_S_LAST = 0x401BF;
public const int EPT_S_CANT_CREATE = 1899;
public const int EPT_S_CANT_PERFORM_OP = 1752;
public const int EPT_S_INVALID_ENTRY = 1751;
public const int EPT_S_NOT_REGISTERED = 1753;
public const int ERROR_ACCESS_DENIED = 5;
public const int ERROR_ACCOUNT_DISABLED = 1331;
public const int ERROR_ACCOUNT_EXPIRED = 1793;
public const int ERROR_ACCOUNT_RESTRICTION = 1327;
public const int ERROR_ADAP_HDW_ERR = 57;
public const int ERROR_ALIAS_EXISTS = 1379;
public const int ERROR_ALLOTTED_SPACE_EXCEEDED = 1344;
public const int ERROR_ALREADY_ASSIGNED = 85;
public const int ERROR_ALREADY_EXISTS = 183;
public const int ERROR_ALREADY_RUNNING_LKG = 1074;
public const int ERROR_ALREADY_WAITING = 1904;
public const int ERROR_ARENA_TRASHED = 7;
public const int ERROR_ARITHMETIC_OVERFLOW = 534;
public const int ERROR_ATOMIC_LOCKS_NOT_SUPPORTED = 174;
public const int ERROR_AUTODATASEG_EXCEEDS_64k = 199;
public const int ERROR_BADDB = 1009;
public const int ERROR_BADKEY = 1010;
public const int ERROR_BAD_ARGUMENTS = 160;
public const int ERROR_BAD_COMMAND = 22;
public const int ERROR_BAD_DESCRIPTOR_FORMAT = 1361;
public const int ERROR_BAD_DEVICE = 1200;
public const int ERROR_BAD_DEV_TYPE = 66;
public const int ERROR_BAD_DRIVER = 2001;
public const int ERROR_BAD_DRIVER_LEVEL = 119;
public const int ERROR_BAD_ENVIRONMENT = 10;
public const int ERROR_BAD_EXE_FORMAT = 193;
public const int ERROR_BAD_FORMAT = 11;
public const int ERROR_BAD_IMPERSONATION_LEVEL = 1346;
public const int ERROR_BAD_INHERITANCE_ACL = 1340;
public const int ERROR_BAD_LENGTH = 24;
public const int ERROR_BAD_LOGON_SESSION_STATE = 1365;
public const int ERROR_BAD_NETPATH = 53;
public const int ERROR_BAD_NET_NAME = 67;
public const int ERROR_BAD_NET_RESP = 58;
public const int ERROR_BAD_PATHNAME = 161;
public const int ERROR_BAD_PIPE = 230;
public const int ERROR_BAD_PROFILE = 1206;
public const int ERROR_BAD_PROVIDER = 1204;
public const int ERROR_BAD_REM_ADAP = 60;
public const int ERROR_BAD_THREADID_ADDR = 159;
public const int ERROR_BAD_TOKEN_TYPE = 1349;
public const int ERROR_BAD_UNIT = 20;
public const int ERROR_BAD_USERNAME = 2202;
public const int ERROR_BAD_VALIDATION_CLASS = 1348;
public const int ERROR_BEGINNING_OF_MEDIA = 1102;
public const int ERROR_BOOT_ALREADY_ACCEPTED = 1076;
public const int ERROR_BROKEN_PIPE = 109;
public const int ERROR_BUFFER_OVERFLOW = 111;
public const int ERROR_BUSY = 170;
public const int ERROR_BUSY_DRIVE = 142;
public const int ERROR_BUS_RESET = 1111;
public const int ERROR_CALL_NOT_IMPLEMENTED = 120;
public const int ERROR_CANCEL_VIOLATION = 173;
public const int ERROR_CANNOT_COPY = 266;
public const int ERROR_CANNOT_FIND_WND_CLASS = 1407;
public const int ERROR_CANNOT_IMPERSONATE = 1368;
public const int ERROR_CANNOT_MAKE = 82;
public const int ERROR_CANNOT_OPEN_PROFILE = 1205;
public const int ERROR_CANTOPEN = 1011;
public const int ERROR_CANTREAD = 1012;
public const int ERROR_CANTWRITE = 1013;
public const int ERROR_CANT_ACCESS_DOMAIN_INFO = 1351;
public const int ERROR_CANT_DISABLE_MANDATORY = 1310;
public const int ERROR_CANT_OPEN_ANONYMOUS = 1347;
public const int ERROR_CAN_NOT_COMPLETE = 1003;
public const int ERROR_CAN_NOT_DEL_LOCAL_WINS = 4001;
public const int ERROR_CHILD_MUST_BE_VOLATILE = 1021;
public const int ERROR_CHILD_NOT_COMPLETE = 129;
public const int ERROR_CHILD_WINDOW_MENU = 1436;
public const int ERROR_CIRCULAR_DEPENDENCY = 1059;
public const int ERROR_CLASS_ALREADY_EXISTS = 1410;
public const int ERROR_CLASS_DOES_NOT_EXIST = 1411;
public const int ERROR_CLASS_HAS_WINDOWS = 1412;
public const int ERROR_CLIPBOARD_NOT_OPEN = 1418;
public const int ERROR_CLIPPING_NOT_SUPPORTED = 2005;
public const int ERROR_CONNECTION_UNAVAIL = 1201;
public const int ERROR_CONTROL_ID_NOT_FOUND = 1421;
public const int ERROR_COUNTER_TIMEOUT = 1121;
public const int ERROR_CRC = 23;
public const int ERROR_CURRENT_DIRECTORY = 16;
public const int ERROR_DATABASE_DOES_NOT_EXIST = 1065;
public const int ERROR_DC_NOT_FOUND = 1425;
public const int ERROR_DEPENDENT_SERVICES_RUNNING = 1051;
public const int ERROR_DESTROY_OBJECT_OF_OTHER_THREAD = 1435;
public const int ERROR_DEVICE_ALREADY_REMEMBERED = 1202;
public const int ERROR_DEVICE_IN_USE = 2404;
public const int ERROR_DEVICE_NOT_PARTITIONED = 1107;
public const int ERROR_DEV_NOT_EXIST = 55;
public const int ERROR_DIRECTORY = 267;
public const int ERROR_DIRECT_ACCESS_HANDLE = 130;
public const int ERROR_DIR_NOT_EMPTY = 145;
public const int ERROR_DIR_NOT_ROOT = 144;
public const int ERROR_DISCARDED = 157;
public const int ERROR_DISK_CHANGE = 107;
public const int ERROR_DISK_CORRUPT = 1393;
public const int ERROR_DISK_FULL = 112;
public const int ERROR_DISK_OPERATION_FAILED = 1127;
public const int ERROR_DISK_RECALIBRATE_FAILED = 1126;
public const int ERROR_DISK_RESET_FAILED = 1128;
public const int ERROR_DLL_INIT_FAILED = 1114;
public const int ERROR_DOMAIN_EXISTS = 1356;
public const int ERROR_DOMAIN_LIMIT_EXCEEDED = 1357;
public const int ERROR_DOMAIN_TRUST_INCONSISTENT = 1810;
public const int ERROR_DRIVE_LOCKED = 108;
public const int ERROR_DUPLICATE_SERVICE_NAME = 1078;
public const int ERROR_DUP_DOMAINNAME = 1221;
public const int ERROR_DUP_NAME = 52;
public const int ERROR_DYNLINK_FROM_INVALID_RING = 196;
public const int ERROR_EAS_DIDNT_FIT = 275;
public const int ERROR_EAS_NOT_SUPPORTED = 282;
public const int ERROR_EA_ACCESS_DENIED = 994;
public const int ERROR_EA_FILE_CORRUPT = 276;
public const int ERROR_EA_LIST_INCONSISTENT = 255;
public const int ERROR_EA_TABLE_FULL = 277;
public const int ERROR_END_OF_MEDIA = 1100;
public const int ERROR_ENVVAR_NOT_FOUND = 203;
public const int ERROR_EOM_OVERFLOW = 1129;
public const int ERROR_EVENTLOG_CANT_START = 1501;
public const int ERROR_EVENTLOG_FILE_CHANGED = 1503;
public const int ERROR_EVENTLOG_FILE_CORRUPT = 1500;
public const int ERROR_EXCEPTION_IN_SERVICE = 1064;
public const int ERROR_EXCL_SEM_ALREADY_OWNED = 101;
public const int ERROR_EXE_MARKED_INVALID = 192;
public const int ERROR_EXTENDED_ERROR = 1208;
public const int ERROR_FAILED_SERVICE_CONTROLLER_CONNECT = 1063;
public const int ERROR_FAIL_I24 = 83;
public const int ERROR_FILEMARK_DETECTED = 1101;
public const int ERROR_FILENAME_EXCED_RANGE = 206;
public const int ERROR_FILE_CORRUPT = 1392;
public const int ERROR_FILE_EXISTS = 80;
public const int ERROR_FILE_INVALID = 1006;
public const int ERROR_FILE_NOT_FOUND = 2;
public const int ERROR_FLOPPY_BAD_REGISTERS = 1125;
public const int ERROR_FLOPPY_ID_MARK_NOT_FOUND = 1122;
public const int ERROR_FLOPPY_UNKNOWN_ERROR = 1124;
public const int ERROR_FLOPPY_WRONG_CYLINDER = 1123;
public const int ERROR_FULLSCREEN_MODE = 1007;
public const int ERROR_FULL_BACKUP = 4004;
public const int ERROR_GENERIC_NOT_MAPPED = 1360;
public const int ERROR_GEN_FAILURE = 31;
public const int ERROR_GROUP_EXISTS = 1318;
public const int ERROR_HANDLE_DISK_FULL = 39;
public const int ERROR_HANDLE_EOF = 38;
public const int ERROR_HOOK_NEEDS_HMOD = 1428;
public const int ERROR_HOOK_NOT_INSTALLED = 1431;
public const int ERROR_HOTKEY_ALREADY_REGISTERED = 1409;
public const int ERROR_HOTKEY_NOT_REGISTERED = 1419;
public const int ERROR_HWNDS_HAVE_DIFF_PARENT = 1441;
public const int ERROR_ILL_FORMED_PASSWORD = 1324;
public const int ERROR_INC_BACKUP = 4003;
public const int ERROR_INFLOOP_IN_RELOC_CHAIN = 202;
public const int ERROR_INSUFFICIENT_BUFFER = 122;
public const int ERROR_INTERNAL_DB_CORRUPTION = 1358;
public const int ERROR_INTERNAL_DB_ERROR = 1383;
public const int ERROR_INTERNAL_ERROR = 1359;
public const int ERROR_INVALID_ACCEL_HANDLE = 1403;
public const int ERROR_INVALID_ACCESS = 12;
public const int ERROR_INVALID_ACCOUNT_NAME = 1315;
public const int ERROR_INVALID_ACL = 1336;
public const int ERROR_INVALID_ADDRESS = 487;
public const int ERROR_INVALID_AT_INTERRUPT_TIME = 104;
public const int ERROR_INVALID_BLOCK = 9;
public const int ERROR_INVALID_BLOCK_LENGTH = 1106;
public const int ERROR_INVALID_CATEGORY = 117;
public const int ERROR_INVALID_COMBOBOX_MESSAGE = 1422;
public const int ERROR_INVALID_COMPUTERNAME = 1210;
public const int ERROR_INVALID_CURSOR_HANDLE = 1402;
public const int ERROR_INVALID_DATA = 13;
public const int ERROR_INVALID_DATATYPE = 1804;
public const int ERROR_INVALID_DOMAINNAME = 1212;
public const int ERROR_INVALID_DOMAIN_ROLE = 1354;
public const int ERROR_INVALID_DOMAIN_STATE = 1353;
public const int ERROR_INVALID_DRIVE = 15;
public const int ERROR_INVALID_DWP_HANDLE = 1405;
public const int ERROR_INVALID_EA_HANDLE = 278;
public const int ERROR_INVALID_EA_NAME = 254;
public const int ERROR_INVALID_EDIT_HEIGHT = 1424;
public const int ERROR_INVALID_ENVIRONMENT = 1805;
public const int ERROR_INVALID_EVENTNAME = 1211;
public const int ERROR_INVALID_EVENT_COUNT = 151;
public const int ERROR_INVALID_EXE_SIGNATURE = 191;
public const int ERROR_INVALID_FILTER_PROC = 1427;
public const int ERROR_INVALID_FLAGS = 1004;
public const int ERROR_INVALID_FLAG_NUMBER = 186;
public const int ERROR_INVALID_FORM_NAME = 1902;
public const int ERROR_INVALID_FORM_SIZE = 1903;
public const int ERROR_INVALID_FUNCTION = 1;
public const int ERROR_INVALID_GROUPNAME = 1209;
public const int ERROR_INVALID_GROUP_ATTRIBUTES = 1345;
public const int ERROR_INVALID_GW_COMMAND = 1443;
public const int ERROR_INVALID_HANDLE = 6;
public const int ERROR_INVALID_HOOK_FILTER = 1426;
public const int ERROR_INVALID_HOOK_HANDLE = 1404;
public const int ERROR_INVALID_ICON_HANDLE = 1414;
public const int ERROR_INVALID_ID_AUTHORITY = 1343;
public const int ERROR_INVALID_INDEX = 1413;
public const int ERROR_INVALID_LB_MESSAGE = 1432;
public const int ERROR_INVALID_LEVEL = 124;
public const int ERROR_INVALID_LIST_FORMAT = 153;
public const int ERROR_INVALID_LOGON_HOURS = 1328;
public const int ERROR_INVALID_LOGON_TYPE = 1367;
public const int ERROR_INVALID_MEMBER = 1388;
public const int ERROR_INVALID_MENU_HANDLE = 1401;
public const int ERROR_INVALID_MESSAGE = 1002;
public const int ERROR_INVALID_MESSAGEDEST = 1218;
public const int ERROR_INVALID_MESSAGENAME = 1217;
public const int ERROR_INVALID_MINALLOCSIZE = 195;
public const int ERROR_INVALID_MODULETYPE = 190;
public const int ERROR_INVALID_MSGBOX_STYLE = 1438;
public const int ERROR_INVALID_NAME = 123;
public const int ERROR_INVALID_NETNAME = 1214;
public const int ERROR_INVALID_ORDINAL = 182;
public const int ERROR_INVALID_OWNER = 1307;
public const int ERROR_INVALID_PARAMETER = 87;
public const int ERROR_INVALID_PASSWORD = 86;
public const int ERROR_INVALID_PASSWORDNAME = 1216;
public const int ERROR_INVALID_PIXEL_FORMAT = 2000;
public const int ERROR_INVALID_PRIMARY_GROUP = 1308;
public const int ERROR_INVALID_PRINTER_COMMAND = 1803;
public const int ERROR_INVALID_PRINTER_NAME = 1801;
public const int ERROR_INVALID_PRINTER_STATE = 1906;
public const int ERROR_INVALID_PRIORITY = 1800;
public const int ERROR_INVALID_SCROLLBAR_RANGE = 1448;
public const int ERROR_INVALID_SECURITY_DESCR = 1338;
public const int ERROR_INVALID_SEGDPL = 198;
public const int ERROR_INVALID_SEGMENT_NUMBER = 180;
public const int ERROR_INVALID_SEPARATOR_FILE = 1799;
public const int ERROR_INVALID_SERVER_STATE = 1352;
public const int ERROR_INVALID_SERVICENAME = 1213;
public const int ERROR_INVALID_SERVICE_ACCOUNT = 1057;
public const int ERROR_INVALID_SERVICE_CONTROL = 1052;
public const int ERROR_INVALID_SERVICE_LOCK = 1071;
public const int ERROR_INVALID_SHARENAME = 1215;
public const int ERROR_INVALID_SHOWWIN_COMMAND = 1449;
public const int ERROR_INVALID_SID = 1337;
public const int ERROR_INVALID_SIGNAL_NUMBER = 209;
public const int ERROR_INVALID_SPI_VALUE = 1439;
public const int ERROR_INVALID_STACKSEG = 189;
public const int ERROR_INVALID_STARTING_CODESEG = 188;
public const int ERROR_INVALID_SUB_AUTHORITY = 1335;
public const int ERROR_INVALID_TARGET_HANDLE = 114;
public const int ERROR_INVALID_THREAD_ID = 1444;
public const int ERROR_INVALID_TIME = 1901;
public const int ERROR_INVALID_USER_BUFFER = 1784;
public const int ERROR_INVALID_VERIFY_SWITCH = 118;
public const int ERROR_INVALID_WINDOW_HANDLE = 1400;
public const int ERROR_INVALID_WINDOW_STYLE = 2002;
public const int ERROR_INVALID_WORKSTATION = 1329;
public const int ERROR_IOPL_NOT_ENABLED = 197;
public const int ERROR_IO_DEVICE = 1117;
public const int ERROR_IO_INCOMPLETE = 996;
public const int ERROR_IO_PENDING = 997;
public const int ERROR_IRQ_BUSY = 1119;
public const int ERROR_IS_JOINED = 134;
public const int ERROR_IS_JOIN_PATH = 147;
public const int ERROR_IS_JOIN_TARGET = 133;
public const int ERROR_IS_SUBSTED = 135;
public const int ERROR_IS_SUBST_PATH = 146;
public const int ERROR_IS_SUBST_TARGET = 149;
public const int ERROR_ITERATED_DATA_EXCEEDS_64k = 194;
public const int ERROR_JOIN_TO_JOIN = 138;
public const int ERROR_JOIN_TO_SUBST = 140;
public const int ERROR_JOURNAL_HOOK_SET = 1430;
public const int ERROR_KEY_DELETED = 1018;
public const int ERROR_KEY_HAS_CHILDREN = 1020;
public const int ERROR_LABEL_TOO_LONG = 154;
public const int ERROR_LAST_ADMIN = 1322;
public const int ERROR_LB_WITHOUT_TABSTOPS = 1434;
public const int ERROR_LISTBOX_ID_NOT_FOUND = 1416;
public const int ERROR_LM_CROSS_ENCRYPTION_REQUIRED = 1390;
public const int ERROR_LOCAL_USER_SESSION_KEY = 1303;
public const int ERROR_LOCKED = 212;
public const int ERROR_LOCK_FAILED = 167;
public const int ERROR_LOCK_VIOLATION = 33;
public const int ERROR_LOGON_FAILURE = 1326;
public const int ERROR_LOGON_NOT_GRANTED = 1380;
public const int ERROR_LOGON_SESSION_COLLISION = 1366;
public const int ERROR_LOGON_SESSION_EXISTS = 1363;
public const int ERROR_LOGON_TYPE_NOT_GRANTED = 1385;
public const int ERROR_LOG_FILE_FULL = 1502;
public const int ERROR_LUIDS_EXHAUSTED = 1334;
public const int ERROR_MAPPED_ALIGNMENT = 1132;
public const int ERROR_MAX_THRDS_REACHED = 164;
public const int ERROR_MEDIA_CHANGED = 1110;
public const int ERROR_MEMBERS_PRIMARY_GROUP = 1374;
public const int ERROR_MEMBER_IN_ALIAS = 1378;
public const int ERROR_MEMBER_IN_GROUP = 1320;
public const int ERROR_MEMBER_NOT_IN_ALIAS = 1377;
public const int ERROR_MEMBER_NOT_IN_GROUP = 1321;
public const int ERROR_METAFILE_NOT_SUPPORTED = 2003;
public const int ERROR_META_EXPANSION_TOO_LONG = 208;
public const int ERROR_MOD_NOT_FOUND = 126;
public const int ERROR_MORE_DATA = 234;
public const int ERROR_MORE_WRITES = 1120;
public const int ERROR_MR_MID_NOT_FOUND = 317;
public const int ERROR_NEGATIVE_SEEK = 131;
public const int ERROR_NESTING_NOT_ALLOWED = 215;
public const int ERROR_NETLOGON_NOT_STARTED = 1792;
public const int ERROR_NETNAME_DELETED = 64;
public const int ERROR_NETWORK_ACCESS_DENIED = 65;
public const int ERROR_NETWORK_BUSY = 54;
public const int ERROR_NET_WRITE_FAULT = 88;
public const int ERROR_NOACCESS = 998;
public const int ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT = 1807;
public const int ERROR_NOLOGON_SERVER_TRUST_ACCOUNT = 1809;
public const int ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT = 1808;
public const int ERROR_NONE_MAPPED = 1332;
public const int ERROR_NON_MDICHILD_WINDOW = 1445;
public const int ERROR_NOTIFY_ENUM_DIR = 1022;
public const int ERROR_NOT_ALL_ASSIGNED = 1300;
public const int ERROR_NOT_CHILD_WINDOW = 1442;
public const int ERROR_NOT_CONNECTED = 2250;
public const int ERROR_NOT_CONTAINER = 1207;
public const int ERROR_NOT_DOS_DISK = 26;
public const int ERROR_NOT_ENOUGH_MEMORY = 8;
public const int ERROR_NOT_ENOUGH_QUOTA = 1816;
public const int ERROR_NOT_ENOUGH_SERVER_MEMORY = 1130;
public const int ERROR_NOT_JOINED = 136;
public const int ERROR_NOT_LOCKED = 158;
public const int ERROR_NOT_LOGON_PROCESS = 1362;
public const int ERROR_NOT_OWNER = 288;
public const int ERROR_NOT_READY = 21;
public const int ERROR_NOT_REGISTRY_FILE = 1017;
public const int ERROR_NOT_SAME_DEVICE = 17;
public const int ERROR_NOT_SUBSTED = 137;
public const int ERROR_NOT_SUPPORTED = 50;
public const int ERROR_NO_BROWSER_SERVERS_FOUND = 6118;
public const int ERROR_NO_DATA = 232;
public const int ERROR_NO_DATA_DETECTED = 1104;
public const int ERROR_NO_IMPERSONATION_TOKEN = 1309;
public const int ERROR_NO_INHERITANCE = 1391;
public const int ERROR_NO_LOGON_SERVERS = 1311;
public const int ERROR_NO_LOG_SPACE = 1019;
public const int ERROR_NO_MEDIA_IN_DRIVE = 1112;
public const int ERROR_NO_MORE_FILES = 18;
public const int ERROR_NO_MORE_ITEMS = 259;
public const int ERROR_NO_MORE_SEARCH_HANDLES = 113;
public const int ERROR_NO_NETWORK = 1222;
public const int ERROR_NO_NET_OR_BAD_PATH = 1203;
public const int ERROR_NO_PROC_SLOTS = 89;
public const int ERROR_NO_QUOTAS_FOR_ACCOUNT = 1302;
public const int ERROR_NO_SCROLLBARS = 1447;
public const int ERROR_NO_SECURITY_ON_OBJECT = 1350;
public const int ERROR_NO_SHUTDOWN_IN_PROGRESS = 1116;
public const int ERROR_NO_SIGNAL_SENT = 205;
public const int ERROR_NO_SPOOL_SPACE = 62;
public const int ERROR_NO_SUCH_ALIAS = 1376;
public const int ERROR_NO_SUCH_DOMAIN = 1355;
public const int ERROR_NO_SUCH_GROUP = 1319;
public const int ERROR_NO_SUCH_LOGON_SESSION = 1312;
public const int ERROR_NO_SUCH_MEMBER = 1387;
public const int ERROR_NO_SUCH_PACKAGE = 1364;
public const int ERROR_NO_SUCH_PRIVILEGE = 1313;
public const int ERROR_NO_SUCH_USER = 1317;
public const int ERROR_NO_SYSTEM_MENU = 1437;
public const int ERROR_NO_TOKEN = 1008;
public const int ERROR_NO_TRUST_LSA_SECRET = 1786;
public const int ERROR_NO_TRUST_SAM_ACCOUNT = 1787;
public const int ERROR_NO_UNICODE_TRANSLATION = 1113;
public const int ERROR_NO_USER_SESSION_KEY = 1394;
public const int ERROR_NO_VOLUME_LABEL = 125;
public const int ERROR_NO_WILDCARD_CHARACTERS = 1417;
public const int ERROR_NT_CROSS_ENCRYPTION_REQUIRED = 1386;
public const int ERROR_NULL_LM_PASSWORD = 1304;
public const int ERROR_OPEN_FAILED = 110;
public const int ERROR_OPEN_FILES = 2401;
public const int ERROR_OPERATION_ABORTED = 995;
public const int ERROR_OUTOFMEMORY = 14;
public const int ERROR_OUT_OF_PAPER = 28;
public const int ERROR_OUT_OF_STRUCTURES = 84;
public const int ERROR_PARTITION_FAILURE = 1105;
public const int ERROR_PASSWORD_EXPIRED = 1330;
public const int ERROR_PASSWORD_RESTRICTION = 1325;
public const int ERROR_PATH_BUSY = 148;
public const int ERROR_PATH_NOT_FOUND = 3;
public const int ERROR_PIPE_BUSY = 231;
public const int ERROR_PIPE_CONNECTED = 535;
public const int ERROR_PIPE_LISTENING = 536;
public const int ERROR_PIPE_NOT_CONNECTED = 233;
public const int ERROR_POPUP_ALREADY_ACTIVE = 1446;
public const int ERROR_POSSIBLE_DEADLOCK = 1131;
public const int ERROR_PRINTER_ALREADY_EXISTS = 1802;
public const int ERROR_PRINTER_DELETED = 1905;
public const int ERROR_PRINTER_DRIVER_ALREADY_INSTALLED = 1795;
public const int ERROR_PRINTER_DRIVER_IN_USE = 3001;
public const int ERROR_PRINTQ_FULL = 61;
public const int ERROR_PRINT_CANCELLED = 63;
public const int ERROR_PRINT_MONITOR_ALREADY_INSTALLED = 3006;
public const int ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED = 3005;
public const int ERROR_PRIVATE_DIALOG_INDEX = 1415;
public const int ERROR_PRIVILEGE_NOT_HELD = 1314;
public const int ERROR_PROCESS_ABORTED = 1067;
public const int ERROR_PROC_NOT_FOUND = 127;
public const int ERROR_PUBLIC_ONLY_HOOK = 1429;
public const int ERROR_READ_FAULT = 30;
public const int ERROR_REC_NON_EXISTENT = 4005;
public const int ERROR_REDIRECTOR_HAS_OPEN_HANDLES = 1794;
public const int ERROR_REDIR_PAUSED = 72;
public const int ERROR_REGISTRY_CORRUPT = 1015;
public const int ERROR_REGISTRY_IO_FAILED = 1016;
public const int ERROR_REGISTRY_RECOVERED = 1014;
public const int ERROR_RELOC_CHAIN_XEEDS_SEGLIM = 201;
public const int ERROR_REMOTE_SESSION_LIMIT_EXCEEDED = 1220;
public const int ERROR_REM_NOT_LIST = 51;
public const int ERROR_REQ_NOT_ACCEP = 71;
public const int ERROR_RESOURCE_DATA_NOT_FOUND = 1812;
public const int ERROR_RESOURCE_LANG_NOT_FOUND = 1815;
public const int ERROR_RESOURCE_NAME_NOT_FOUND = 1814;
public const int ERROR_RESOURCE_TYPE_NOT_FOUND = 1813;
public const int ERROR_REVISION_MISMATCH = 1306;
public const int ERROR_RING2SEG_MUST_BE_MOVABLE = 200;
public const int ERROR_RING2_STACK_IN_USE = 207;
public const int ERROR_RPL_NOT_ALLOWED = 4006;
public const int ERROR_RXACT_COMMIT_FAILURE = 1370;
public const int ERROR_RXACT_INVALID_STATE = 1369;
public const int ERROR_SAME_DRIVE = 143;
public const int ERROR_SCREEN_ALREADY_LOCKED = 1440;
public const int ERROR_SECRET_TOO_LONG = 1382;
public const int ERROR_SECTOR_NOT_FOUND = 27;
public const int ERROR_SEEK = 25;
public const int ERROR_SEEK_ON_DEVICE = 132;
public const int ERROR_SEM_IS_SET = 102;
public const int ERROR_SEM_NOT_FOUND = 187;
public const int ERROR_SEM_OWNER_DIED = 105;
public const int ERROR_SEM_TIMEOUT = 121;
public const int ERROR_SEM_USER_LIMIT = 106;
public const int ERROR_SERIAL_NO_DEVICE = 1118;
public const int ERROR_SERVER_DISABLED = 1341;
public const int ERROR_SERVER_HAS_OPEN_HANDLES = 1811;
public const int ERROR_SERVER_NOT_DISABLED = 1342;
public const int ERROR_SERVICE_ALREADY_RUNNING = 1056;
public const int ERROR_SERVICE_CANNOT_ACCEPT_CTRL = 1061;
public const int ERROR_SERVICE_DATABASE_LOCKED = 1055;
public const int ERROR_SERVICE_DEPENDENCY_DELETED = 1075;
public const int ERROR_SERVICE_DEPENDENCY_FAIL = 1068;
public const int ERROR_SERVICE_DISABLED = 1058;
public const int ERROR_SERVICE_DOES_NOT_EXIST = 1060;
public const int ERROR_SERVICE_EXISTS = 1073;
public const int ERROR_SERVICE_LOGON_FAILED = 1069;
public const int ERROR_SERVICE_MARKED_FOR_DELETE = 1072;
public const int ERROR_SERVICE_NEVER_STARTED = 1077;
public const int ERROR_SERVICE_NOT_ACTIVE = 1062;
public const int ERROR_SERVICE_NO_THREAD = 1054;
public const int ERROR_SERVICE_REQUEST_TIMEOUT = 1053;
public const int ERROR_SERVICE_SPECIFIC_ERROR = 1066;
public const int ERROR_SERVICE_START_HANG = 1070;
public const int ERROR_SESSION_CREDENTIAL_CONFLICT = 1219;
public const int ERROR_SETCOUNT_ON_BAD_LB = 1433;
public const int ERROR_SETMARK_DETECTED = 1103;
public const int ERROR_SHARING_BUFFER_EXCEEDED = 36;
public const int ERROR_SHARING_PAUSED = 70;
public const int ERROR_SHARING_VIOLATION = 32;
public const int ERROR_SHUTDOWN_IN_PROGRESS = 1115;
public const int ERROR_SIGNAL_PENDING = 162;
public const int ERROR_SIGNAL_REFUSED = 156;
public const int ERROR_SOME_NOT_MAPPED = 1301;
public const int ERROR_SPECIAL_ACCOUNT = 1371;
public const int ERROR_SPECIAL_GROUP = 1372;
public const int ERROR_SPECIAL_USER = 1373;
public const int ERROR_SPL_NO_ADDJOB = 3004;
public const int ERROR_SPL_NO_STARTDOC = 3003;
public const int ERROR_SPOOL_FILE_NOT_FOUND = 3002;
public const int ERROR_STACK_OVERFLOW = 1001;
public const int ERROR_STATIC_INIT = 4002;
public const int ERROR_SUBST_TO_JOIN = 141;
public const int ERROR_SUBST_TO_SUBST = 139;
public const int ERROR_SUCCESS = 0;
public const int ERROR_SWAPERROR = 999;
public const int ERROR_SYSTEM_TRACE = 150;
public const int ERROR_THREAD_1_INACTIVE = 210;
public const int ERROR_TLW_WITH_WSCHILD = 1406;
public const int ERROR_TOKEN_ALREADY_IN_USE = 1375;
public const int ERROR_TOO_MANY_CMDS = 56;
public const int ERROR_TOO_MANY_CONTEXT_IDS = 1384;
public const int ERROR_TOO_MANY_LUIDS_REQUESTED = 1333;
public const int ERROR_TOO_MANY_MODULES = 214;
public const int ERROR_TOO_MANY_MUXWAITERS = 152;
public const int ERROR_TOO_MANY_NAMES = 68;
public const int ERROR_TOO_MANY_OPEN_FILES = 4;
public const int ERROR_TOO_MANY_POSTS = 298;
public const int ERROR_TOO_MANY_SECRETS = 1381;
public const int ERROR_TOO_MANY_SEMAPHORES = 100;
public const int ERROR_TOO_MANY_SEM_REQUESTS = 103;
public const int ERROR_TOO_MANY_SESS = 69;
public const int ERROR_TOO_MANY_SIDS = 1389;
public const int ERROR_TOO_MANY_TCBS = 155;
public const int ERROR_TRANSFORM_NOT_SUPPORTED = 2004;
public const int ERROR_TRUSTED_DOMAIN_FAILURE = 1788;
public const int ERROR_TRUSTED_RELATIONSHIP_FAILURE = 1789;
public const int ERROR_TRUST_FAILURE = 1790;
public const int ERROR_UNABLE_TO_LOCK_MEDIA = 1108;
public const int ERROR_UNABLE_TO_UNLOAD_MEDIA = 1109;
public const int ERROR_UNEXP_NET_ERR = 59;
public const int ERROR_UNKNOWN_PORT = 1796;
public const int ERROR_UNKNOWN_PRINTER_DRIVER = 1797;
public const int ERROR_UNKNOWN_PRINTPROCESSOR = 1798;
public const int ERROR_UNKNOWN_PRINT_MONITOR = 3000;
public const int ERROR_UNKNOWN_REVISION = 1305;
public const int ERROR_UNRECOGNIZED_MEDIA = 1785;
public const int ERROR_UNRECOGNIZED_VOLUME = 1005;
public const int ERROR_USER_EXISTS = 1316;
public const int ERROR_VC_DISCONNECTED = 240;
public const int ERROR_WAIT_NO_CHILDREN = 128;
public const int ERROR_WINDOW_NOT_COMBOBOX = 1423;
public const int ERROR_WINDOW_NOT_DIALOG = 1420;
public const int ERROR_WINDOW_OF_OTHER_THREAD = 1408;
public const int ERROR_WINS_INTERNAL = 4000;
public const int ERROR_WRITE_FAULT = 29;
public const int ERROR_WRITE_PROTECT = 19;
public const int ERROR_WRONG_DISK = 34;
public const int ERROR_WRONG_PASSWORD = 1323;
public const int E_ABORT = unchecked((int) 0x80004004);
public const int E_ACCESSDENIED = unchecked((int) 0x80070005);
public const int E_FAIL = unchecked((int) 0x80004005);
public const int E_HANDLE = unchecked((int) 0x80070006);
public const int E_INVALIDARG = unchecked((int) 0x80070057);
public const int E_NOINTERFACE = unchecked((int) 0x80004002);
public const int E_NOTIMPL = unchecked((int) 0x80004001);
public const int E_OUTOFMEMORY = unchecked((int) 0x8007000E);
public const int E_POINTER = unchecked((int) 0x80004003);
public const int E_UNEXPECTED = unchecked((int) 0x8000FFFF);
public const int FACILITY_NT_BIT = 0x10000000;
public const int INPLACE_E_FIRST = unchecked((int) 0x800401A0);
public const int INPLACE_E_LAST = unchecked((int) 0x800401AF);
public const int INPLACE_E_NOTOOLSPACE = unchecked((int) 0x800401A1);
public const int INPLACE_E_NOTUNDOABLE = unchecked((int) 0x800401A0);
public const int INPLACE_S_FIRST = 0x401A0;
public const int INPLACE_S_LAST = 0x401AF;
public const int INPLACE_S_TRUNCATED = 0x401A0;
public const int MARSHAL_E_FIRST = unchecked((int) 0x80040120);
public const int MARSHAL_E_LAST = unchecked((int) 0x8004012F);
public const int MARSHAL_S_FIRST = 0x40120;
public const int MARSHAL_S_LAST = 0x4012F;
public const int MEM_E_INVALID_LINK = unchecked((int) 0x80080010);
public const int MEM_E_INVALID_ROOT = unchecked((int) 0x80080009);
public const int MEM_E_INVALID_SIZE = unchecked((int) 0x80080011);
public const int MK_E_CANTOPENFILE = unchecked((int) 0x800401EA);
public const int MK_E_CONNECTMANUALLY = unchecked((int) 0x800401E0);
public const int MK_E_ENUMERATION_FAILED = unchecked((int) 0x800401EF);
public const int MK_E_EXCEEDEDDEADLINE = unchecked((int) 0x800401E1);
public const int MK_E_FIRST = unchecked((int) 0x800401E0);
public const int MK_E_INTERMEDIATEINTERFACENOTSUPPORTED = unchecked((int) 0x800401E7);
public const int MK_E_INVALIDEXTENSION = unchecked((int) 0x800401E6);
public const int MK_E_LAST = unchecked((int) 0x800401EF);
public const int MK_E_MUSTBOTHERUSER = unchecked((int) 0x800401EB);
public const int MK_E_NEEDGENERIC = unchecked((int) 0x800401E2);
public const int MK_E_NOINVERSE = unchecked((int) 0x800401EC);
public const int MK_E_NOOBJECT = unchecked((int) 0x800401E5);
public const int MK_E_NOPREFIX = unchecked((int) 0x800401EE);
public const int MK_E_NOSTORAGE = unchecked((int) 0x800401ED);
public const int MK_E_NOTBINDABLE = unchecked((int) 0x800401E8);
public const int MK_E_NOTBOUND = unchecked((int) 0x800401E9);
public const int MK_E_NO_NORMALIZED = unchecked((int) 0x80080007);
public const int MK_E_SYNTAX = unchecked((int) 0x800401E4);
public const int MK_E_UNAVAILABLE = unchecked((int) 0x800401E3);
public const int MK_S_FIRST = 0x401E0;
public const int MK_S_HIM = 0x401E5;
public const int MK_S_LAST = 0x401EF;
public const int MK_S_ME = 0x401E4;
public const int MK_S_MONIKERALREADYREGISTERED = 0x401E7;
public const int MK_S_REDUCED_TO_SELF = 0x401E2;
public const int MK_S_US = 0x401E6;
public const int NOERROR = 0;
public const int NO_ERROR = 0;
public const int OLEOBJ_E_FIRST = unchecked((int) 0x80040180);
public const int OLEOBJ_E_INVALIDVERB = unchecked((int) 0x80040181);
public const int OLEOBJ_E_LAST = unchecked((int) 0x8004018F);
public const int OLEOBJ_E_NOVERBS = unchecked((int) 0x80040180);
public const int OLEOBJ_S_CANNOT_DOVERB_NOW = 0x40181;
public const int OLEOBJ_S_FIRST = 0x40180;
public const int OLEOBJ_S_INVALIDHWND = 0x40182;
public const int OLEOBJ_S_INVALIDVERB = 0x40180;
public const int OLEOBJ_S_LAST = 0x4018F;
public const int OLE_E_ADVF = unchecked((int) 0x80040001);
public const int OLE_E_ADVISENOTSUPPORTED = unchecked((int) 0x80040003);
public const int OLE_E_BLANK = unchecked((int) 0x80040007);
public const int OLE_E_CANTCONVERT = unchecked((int) 0x80040011);
public const int OLE_E_CANT_BINDTOSOURCE = unchecked((int) 0x8004000A);
public const int OLE_E_CANT_GETMONIKER = unchecked((int) 0x80040009);
public const int OLE_E_CLASSDIFF = unchecked((int) 0x80040008);
public const int OLE_E_ENUM_NOMORE = unchecked((int) 0x80040002);
public const int OLE_E_FIRST = unchecked((int) 0x80040000);
public const int OLE_E_INVALIDHWND = unchecked((int) 0x8004000F);
public const int OLE_E_INVALIDRECT = unchecked((int) 0x8004000D);
public const int OLE_E_LAST = unchecked((int) 0x800400FF);
public const int OLE_E_NOCACHE = unchecked((int) 0x80040006);
public const int OLE_E_NOCONNECTION = unchecked((int) 0x80040004);
public const int OLE_E_NOSTORAGE = unchecked((int) 0x80040012);
public const int OLE_E_NOTRUNNING = unchecked((int) 0x80040005);
public const int OLE_E_NOT_INPLACEACTIVE = unchecked((int) 0x80040010);
public const int OLE_E_OLEVERB = unchecked((int) 0x80040000);
public const int OLE_E_PROMPTSAVECANCELLED = unchecked((int) 0x8004000C);
public const int OLE_E_STATIC = unchecked((int) 0x8004000B);
public const int OLE_E_WRONGCOMPOBJ = unchecked((int) 0x8004000E);
public const int OLE_S_FIRST = 0x40000;
public const int OLE_S_LAST = 0x400FF;
public const int OLE_S_MAC_CLIPFORMAT = 0x40002;
public const int OLE_S_STATIC = 0x40001;
public const int OLE_S_USEREG = 0x40000;
public const int REGDB_E_CLASSNOTREG = unchecked((int) 0x80040154);
public const int REGDB_E_FIRST = unchecked((int) 0x80040150);
public const int REGDB_E_IIDNOTREG = unchecked((int) 0x80040155);
public const int REGDB_E_INVALIDVALUE = unchecked((int) 0x80040153);
public const int REGDB_E_KEYMISSING = unchecked((int) 0x80040152);
public const int REGDB_E_LAST = unchecked((int) 0x8004015F);
public const int REGDB_E_READREGDB = unchecked((int) 0x80040150);
public const int REGDB_E_WRITEREGDB = unchecked((int) 0x80040151);
public const int REGDB_S_FIRST = 0x40150;
public const int REGDB_S_LAST = 0x4015F;
public const int RPC_E_ATTEMPTED_MULTITHREAD = unchecked((int) 0x80010102);
public const int RPC_E_CALL_CANCELED = unchecked((int) 0x80010002);
public const int RPC_E_CALL_REJECTED = unchecked((int) 0x80010001);
public const int RPC_E_CANTCALLOUT_AGAIN = unchecked((int) 0x80010011);
public const int RPC_E_CANTCALLOUT_INASYNCCALL = unchecked((int) 0x80010004);
public const int RPC_E_CANTCALLOUT_INEXTERNALCALL = unchecked((int) 0x80010005);
public const int RPC_E_CANTCALLOUT_ININPUTSYNCCALL = unchecked((int) 0x8001010D);
public const int RPC_E_CANTPOST_INSENDCALL = unchecked((int) 0x80010003);
public const int RPC_E_CANTTRANSMIT_CALL = unchecked((int) 0x8001000A);
public const int RPC_E_CHANGED_MODE = unchecked((int) 0x80010106);
public const int RPC_E_CLIENT_CANTMARSHAL_DATA = unchecked((int) 0x8001000B);
public const int RPC_E_CLIENT_CANTUNMARSHAL_DATA = unchecked((int) 0x8001000C);
public const int RPC_E_CLIENT_DIED = unchecked((int) 0x80010008);
public const int RPC_E_CONNECTION_TERMINATED = unchecked((int) 0x80010006);
public const int RPC_E_DISCONNECTED = unchecked((int) 0x80010108);
public const int RPC_E_FAULT = unchecked((int) 0x80010104);
public const int RPC_E_INVALIDMETHOD = unchecked((int) 0x80010107);
public const int RPC_E_INVALID_CALLDATA = unchecked((int) 0x8001010C);
public const int RPC_E_INVALID_DATA = unchecked((int) 0x8001000F);
public const int RPC_E_INVALID_DATAPACKET = unchecked((int) 0x80010009);
public const int RPC_E_INVALID_PARAMETER = unchecked((int) 0x80010010);
public const int RPC_E_NOT_REGISTERED = unchecked((int) 0x80010103);
public const int RPC_E_OUT_OF_RESOURCES = unchecked((int) 0x80010101);
public const int RPC_E_RETRY = unchecked((int) 0x80010109);
public const int RPC_E_SERVERCALL_REJECTED = unchecked((int) 0x8001010B);
public const int RPC_E_SERVERCALL_RETRYLATER = unchecked((int) 0x8001010A);
public const int RPC_E_SERVERFAULT = unchecked((int) 0x80010105);
public const int RPC_E_SERVER_CANTMARSHAL_DATA = unchecked((int) 0x8001000D);
public const int RPC_E_SERVER_CANTUNMARSHAL_DATA = unchecked((int) 0x8001000E);
public const int RPC_E_SERVER_DIED = unchecked((int) 0x80010007);
public const int RPC_E_SERVER_DIED_DNE = unchecked((int) 0x80010012);
public const int RPC_E_SYS_CALL_FAILED = unchecked((int) 0x80010100);
public const int RPC_E_THREAD_NOT_INIT = unchecked((int) 0x8001010F);
public const int RPC_E_UNEXPECTED = unchecked((int) 0x8001FFFF);
public const int RPC_E_WRONG_THREAD = unchecked((int) 0x8001010E);
public const int RPC_S_ADDRESS_ERROR = 1768;
public const int RPC_S_ALREADY_LISTENING = 1713;
public const int RPC_S_ALREADY_REGISTERED = 1711;
public const int RPC_S_BINDING_HAS_NO_AUTH = 1746;
public const int RPC_S_CALL_FAILED = 1726;
public const int RPC_S_CALL_FAILED_DNE = 1727;
public const int RPC_S_CALL_IN_PROGRESS = 1791;
public const int RPC_S_CANNOT_SUPPORT = 1764;
public const int RPC_S_CANT_CREATE_ENDPOINT = 1720;
public const int RPC_S_DUPLICATE_ENDPOINT = 1740;
public const int RPC_S_ENTRY_ALREADY_EXISTS = 1760;
public const int RPC_S_ENTRY_NOT_FOUND = 1761;
public const int RPC_S_FP_DIV_ZERO = 1769;
public const int RPC_S_FP_OVERFLOW = 1771;
public const int RPC_S_FP_UNDERFLOW = 1770;
public const int RPC_S_GROUP_MEMBER_NOT_FOUND = 1898;
public const int RPC_S_INCOMPLETE_NAME = 1755;
public const int RPC_S_INTERFACE_NOT_FOUND = 1759;
public const int RPC_S_INTERNAL_ERROR = 1766;
public const int RPC_S_INVALID_AUTH_IDENTITY = 1749;
public const int RPC_S_INVALID_BINDING = 1702;
public const int RPC_S_INVALID_BOUND = 1734;
public const int RPC_S_INVALID_ENDPOINT_FORMAT = 1706;
public const int RPC_S_INVALID_NAF_ID = 1763;
public const int RPC_S_INVALID_NAME_SYNTAX = 1736;
public const int RPC_S_INVALID_NETWORK_OPTIONS = 1724;
public const int RPC_S_INVALID_NET_ADDR = 1707;
public const int RPC_S_INVALID_OBJECT = 1900;
public const int RPC_S_INVALID_RPC_PROTSEQ = 1704;
public const int RPC_S_INVALID_STRING_BINDING = 1700;
public const int RPC_S_INVALID_STRING_UUID = 1705;
public const int RPC_S_INVALID_TAG = 1733;
public const int RPC_S_INVALID_TIMEOUT = 1709;
public const int RPC_S_INVALID_VERS_OPTION = 1756;
public const int RPC_S_MAX_CALLS_TOO_SMALL = 1742;
public const int RPC_S_NAME_SERVICE_UNAVAILABLE = 1762;
public const int RPC_S_NOTHING_TO_EXPORT = 1754;
public const int RPC_S_NOT_ALL_OBJS_UNEXPORTED = 1758;
public const int RPC_S_NOT_LISTENING = 1715;
public const int RPC_S_NO_BINDINGS = 1718;
public const int RPC_S_NO_CALL_ACTIVE = 1725;
public const int RPC_S_NO_CONTEXT_AVAILABLE = 1765;
public const int RPC_S_NO_ENDPOINT_FOUND = 1708;
public const int RPC_S_NO_ENTRY_NAME = 1735;
public const int RPC_S_NO_MORE_BINDINGS = 1806;
public const int RPC_S_NO_MORE_MEMBERS = 1757;
public const int RPC_S_NO_PROTSEQS = 1719;
public const int RPC_S_NO_PROTSEQS_REGISTERED = 1714;
public const int RPC_S_OBJECT_NOT_FOUND = 1710;
public const int RPC_S_OUT_OF_RESOURCES = 1721;
public const int RPC_S_PROCNUM_OUT_OF_RANGE = 1745;
public const int RPC_S_PROTOCOL_ERROR = 1728;
public const int RPC_S_PROTSEQ_NOT_FOUND = 1744;
public const int RPC_S_PROTSEQ_NOT_SUPPORTED = 1703;
public const int RPC_S_SERVER_TOO_BUSY = 1723;
public const int RPC_S_SERVER_UNAVAILABLE = 1722;
public const int RPC_S_STRING_TOO_LONG = 1743;
public const int RPC_S_TYPE_ALREADY_REGISTERED = 1712;
public const int RPC_S_UNKNOWN_AUTHN_LEVEL = 1748;
public const int RPC_S_UNKNOWN_AUTHN_SERVICE = 1747;
public const int RPC_S_UNKNOWN_AUTHN_TYPE = 1741;
public const int RPC_S_UNKNOWN_AUTHZ_SERVICE = 1750;
public const int RPC_S_UNKNOWN_IF = 1717;
public const int RPC_S_UNKNOWN_MGR_TYPE = 1716;
public const int RPC_S_UNSUPPORTED_NAME_SYNTAX = 1737;
public const int RPC_S_UNSUPPORTED_TRANS_SYN = 1730;
public const int RPC_S_UNSUPPORTED_TYPE = 1732;
public const int RPC_S_UUID_NO_ADDRESS = 1739;
public const int RPC_S_WRONG_KIND_OF_BINDING = 1701;
public const int RPC_S_ZERO_DIVIDE = 1767;
public const int RPC_X_BAD_STUB_DATA = 1783;
public const int RPC_X_BYTE_COUNT_TOO_SMALL = 1782;
public const int RPC_X_ENUM_VALUE_OUT_OF_RANGE = 1781;
public const int RPC_X_NO_MORE_ENTRIES = 1772;
public const int RPC_X_NULL_REF_POINTER = 1780;
public const int RPC_X_SS_CANNOT_GET_CALL_HANDLE = 1779;
public const int RPC_X_SS_CHAR_TRANS_OPEN_FAIL = 1773;
public const int RPC_X_SS_CHAR_TRANS_SHORT_FILE = 1774;
public const int RPC_X_SS_CONTEXT_DAMAGED = 1777;
public const int RPC_X_SS_HANDLES_MISMATCH = 1778;
public const int RPC_X_SS_IN_NULL_CONTEXT = 1775;
public const int SEVERITY_ERROR = 1;
public const int SEVERITY_SUCCESS = 0;
public const int STG_E_ABNORMALAPIEXIT = unchecked((int) 0x800300FA);
public const int STG_E_ACCESSDENIED = unchecked((int) 0x80030005);
public const int STG_E_CANTSAVE = unchecked((int) 0x80030103);
public const int STG_E_DISKISWRITEPROTECTED = unchecked((int) 0x80030013);
public const int STG_E_EXTANTMARSHALLINGS = unchecked((int) 0x80030108);
public const int STG_E_FILEALREADYEXISTS = unchecked((int) 0x80030050);
public const int STG_E_FILENOTFOUND = unchecked((int) 0x80030002);
public const int STG_E_INSUFFICIENTMEMORY = unchecked((int) 0x80030008);
public const int STG_E_INUSE = unchecked((int) 0x80030100);
public const int STG_E_INVALIDFLAG = unchecked((int) 0x800300FF);
public const int STG_E_INVALIDFUNCTION = unchecked((int) 0x80030001);
public const int STG_E_INVALIDHANDLE = unchecked((int) 0x80030006);
public const int STG_E_INVALIDHEADER = unchecked((int) 0x800300FB);
public const int STG_E_INVALIDNAME = unchecked((int) 0x800300FC);
public const int STG_E_INVALIDPARAMETER = unchecked((int) 0x80030057);
public const int STG_E_INVALIDPOINTER = unchecked((int) 0x80030009);
public const int STG_E_LOCKVIOLATION = unchecked((int) 0x80030021);
public const int STG_E_MEDIUMFULL = unchecked((int) 0x80030070);
public const int STG_E_NOMOREFILES = unchecked((int) 0x80030012);
public const int STG_E_NOTCURRENT = unchecked((int) 0x80030101);
public const int STG_E_NOTFILEBASEDSTORAGE = unchecked((int) 0x80030107);
public const int STG_E_OLDDLL = unchecked((int) 0x80030105);
public const int STG_E_OLDFORMAT = unchecked((int) 0x80030104);
public const int STG_E_PATHNOTFOUND = unchecked((int) 0x80030003);
public const int STG_E_READFAULT = unchecked((int) 0x8003001E);
public const int STG_E_REVERTED = unchecked((int) 0x80030102);
public const int STG_E_SEEKERROR = unchecked((int) 0x80030019);
public const int STG_E_SHAREREQUIRED = unchecked((int) 0x80030106);
public const int STG_E_SHAREVIOLATION = unchecked((int) 0x80030020);
public const int STG_E_TOOMANYOPENFILES = unchecked((int) 0x80030004);
public const int STG_E_UNIMPLEMENTEDFUNCTION = unchecked((int) 0x800300FE);
public const int STG_E_UNKNOWN = unchecked((int) 0x800300FD);
public const int STG_E_WRITEFAULT = unchecked((int) 0x8003001D);
public const int STG_S_CONVERTED = unchecked((int) 0x30200);
public const int S_FALSE = 0x1;
public const int S_OK = 0x0;
public const int TYPE_E_AMBIGUOUSNAME = unchecked((int) 0x8002802C);
public const int TYPE_E_BADMODULEKIND = unchecked((int) 0x800288BD);
public const int TYPE_E_BUFFERTOOSMALL = unchecked((int) 0x80028016);
public const int TYPE_E_CANTCREATETMPFILE = unchecked((int) 0x80028CA3);
public const int TYPE_E_CANTLOADLIBRARY = unchecked((int) 0x80029C4A);
public const int TYPE_E_CIRCULARTYPE = unchecked((int) 0x80029C84);
public const int TYPE_E_DLLFUNCTIONNOTFOUND = unchecked((int) 0x8002802F);
public const int TYPE_E_DUPLICATEID = unchecked((int) 0x800288C6);
public const int TYPE_E_ELEMENTNOTFOUND = unchecked((int) 0x8002802B);
public const int TYPE_E_INCONSISTENTPROPFUNCS = unchecked((int) 0x80029C83);
public const int TYPE_E_INVALIDID = unchecked((int) 0x800288CF);
public const int TYPE_E_INVALIDSTATE = unchecked((int) 0x80028029);
public const int TYPE_E_INVDATAREAD = unchecked((int) 0x80028018);
public const int TYPE_E_IOERROR = unchecked((int) 0x80028CA2);
public const int TYPE_E_LIBNOTREGISTERED = unchecked((int) 0x8002801D);
public const int TYPE_E_NAMECONFLICT = unchecked((int) 0x8002802D);
public const int TYPE_E_OUTOFBOUNDS = unchecked((int) 0x80028CA1);
public const int TYPE_E_QUALIFIEDNAMEDISALLOWED = unchecked((int) 0x80028028);
public const int TYPE_E_REGISTRYACCESS = unchecked((int) 0x8002801C);
public const int TYPE_E_SIZETOOBIG = unchecked((int) 0x800288C5);
public const int TYPE_E_TYPEMISMATCH = unchecked((int) 0x80028CA0);
public const int TYPE_E_UNDEFINEDTYPE = unchecked((int) 0x80028027);
public const int TYPE_E_UNKNOWNLCID = unchecked((int) 0x8002802E);
public const int TYPE_E_UNSUPFORMAT = unchecked((int) 0x80028019);
public const int TYPE_E_WRONGTYPEKIND = unchecked((int) 0x8002802A);
public const int VIEW_E_DRAW = unchecked((int) 0x80040140);
public const int VIEW_E_FIRST = unchecked((int) 0x80040140);
public const int VIEW_E_LAST = unchecked((int) 0x8004014F);
public const int VIEW_S_ALREADY_FROZEN = 0x40140;
public const int VIEW_S_FIRST = 0x40140;
public const int VIEW_S_LAST = 0x4014F;
}
}


全部類別轉成DLL檔
一、批次檔 加入如下：
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\csc.exe /target:library /out:OldWin32.dll Kernel.cs User.cs Win32.cs Shell.cs NetApi.cs GDI.cs Multimedia.cs ErrorCodes.cs
二、執行產生「OldWin32.dll 」檔。
三、使用時，加入專案的「參考」。
四、程式碼加入： using Win32;
五、範例： (傳回磁碟空間資訊)
using System;
using
System.Windows.Forms;
using System.Runtime.InteropServices;
using Win32;
namespace
DefaultNamespace
{
/// <summary>
/// Description of
MainForm.
/// </summary>
public class MainForm :
System.Windows.Forms.Form
{
private
System.Windows.Forms.Button button1;
private
System.Windows.Forms.RichTextBox richTextBox1;
public
MainForm()
{
//
// The
InitializeComponent() call is required for Windows Forms designer
support.
//
InitializeComponent();

//
//
TODO: Add constructor code after the InitializeComponent()
call.
//
}

[STAThread]
public
static void Main(string[]
args)
{
Application.Run(new
MainForm());
}

#region Windows
Forms Designer generated code
///
<summary>
/// This method is required for Windows Forms
designer support.
/// Do not change the method contents inside
the source code editor. The Forms designer might
/// not be able
to load this method if it was changed manually.
///
</summary>
private void InitializeComponent()
{
this.richTextBox1 = new
System.Windows.Forms.RichTextBox();
this.button1 = new
System.Windows.Forms.Button();
this.SuspendLayout();
//
// richTextBox1
//
this.richTextBox1.Location = new System.Drawing.Point(16,
16);
this.richTextBox1.Name =
"richTextBox1";
this.richTextBox1.Size = new
System.Drawing.Size(184, 168);
this.richTextBox1.TabIndex =
0;
this.richTextBox1.Text =
"richTextBox1";
//
//
button1
//
this.button1.Location =
new System.Drawing.Point(200, 216);
this.button1.Name =
"button1";
this.button1.TabIndex =
1;
this.button1.Text =
"button1";
this.button1.Click += new
System.EventHandler(this.Button1Click);
//
// MainForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5,
15);
this.ClientSize = new System.Drawing.Size(292,
266);
this.Controls.Add(this.button1);
this.Controls.Add(this.richTextBox1);
this.Name
= "MainForm";
this.Text =
"MainForm";
this.ResumeLayout(false);
}
#endregion
void
Button1Click(object sender, System.EventArgs
e)
{
ulong freeBytesAvailable, totalBytes,
freeBytes;
// 呼叫 Win32 API
傳回磁碟空間資訊
Win32.Kernel.GetDiskFreeSpaceEx ( "C:", out
freeBytesAvailable, out totalBytes, out freeBytes
);
richTextBox1.Clear();
richTextBox1.AppendText
( "Total space : " + totalBytes + " Bytes"
+"\n");
richTextBox1.AppendText( "Free space : " +
freeBytes + " Bytes" +"\n");
richTextBox1.AppendText(
"Available Free space : " + freeBytesAvailable + " Bytes" +"\n");
  }

 }
}


Microsoft Win32 to Microsoft .NET Framework API Map

http://msdn.microsoft.com/library/en-us/dndotnet/html/win32map.asp


取得系統訊息
1.取得作業系統版本：
System.Environment.OSVersion.ToString()
2.取得電腦識別名稱：
 System.Environment.MachineName.ToString()
3.取得系統目前使用者名稱：
System.Environment.UserName.ToString()
4.取得.NET Framework目前使用版本：
System.Environment.Version.ToString()
5.取得目前執行檔所在位置的完整資料夾路徑：
System.Environment.CurrentDirectory.ToString()
6.取得目前執行檔所在位置的完整資料夾路徑：(含執行檔名稱)
System.Environment.CommandLine.ToString()
7.取得系統目前已執行時間：
System.Environment.TickCount.ToString()


取得系統環境變數
using System;
using System.Collections;
....
void Button2Click(object sender, System.EventArgs e)
{
 IDictionary envars =Environment.GetEnvironmentVariables();
 IDictionaryEnumerator varEnumerator =envars.GetEnumerator();
 while(varEnumerator.MoveNext() != false)
 {
  richTextBox1.AppendText(varEnumerator.Key+"="+
                          varEnumerator.Value+"\n");
 }
}


取得程式共用資料夾位置
private void button1_Click(object sender, System.EventArgs e)
{
 //取得程式共用資料夾位置
 string a = System.Environment.GetFolderPath
            (Environment.SpecialFolder.CommonProgramFiles);
 textBox1.Text = a;
}

結果:
  C:\Program Files\Common Files


取得存放Cookie資料夾位置
private void button1_Click(object sender, System.EventArgs e)
{
 //取得存放Cookie資料夾位置
 string a = System.Environment.GetFolderPath
       (Environment.SpecialFolder.Cookies);
 textBox1.Text = a;
}

結果:
  C:\Documents and Settings\UserName\Cookies


取得桌面路徑位置
private void button1_Click(object sender, System.EventArgs
e)
{
//取得桌面路徑位置
string a = System.Environment.GetFolderPath
(Environment.SpecialFolder.Desktop);
textBox1.Text = a;
}

結果:
  C:\Documents and Settings\Administrator\桌面


取得我的最愛資料夾位置
private void button1_Click(object sender, System.EventArgs
e)
{
//取得我的最愛資料夾位置
string a = System.Environment.GetFolderPath
(Environment.SpecialFolder.Favorites);
textBox1.Text = a;
}

結果:
  C:\Documents and Settings\UserName\Favorites


取得歷史資料夾位置
private void button1_Click(object sender, System.EventArgs e)
{
 //取得歷史資料夾位置
 string a = System.Environment.GetFolderPath
            (Environment.SpecialFolder.History);
 textBox1.Text = a;
}

結果:
  C:\Documents and Settings\UserName\Local Settings\History


取得IE暫存資料夾位置
private
void button1_Click(object sender, System.EventArgs e)
{
//取得IE暫存資料夾位置
string a = System.Environment.GetFolderPath
             (Environment.SpecialFolder.InternetCache);
  textBox1.Text = a;
}

結果:
  C:\Documents and Settings\UserName\Local Settings\Temporary Internet Files


取得我的文件夾位置
private void button1_Click(object sender, System.EventArgs e)
{
 //取得我的文件夾位置
 string a = System.Environment.GetFolderPath
            (Environment.SpecialFolder.Personal);
 textBox1.Text = a;
}

結果:
  C:\Documents and Settings\UserName\My Documents


取得Program Files 路徑
private
void button1_Click(object sender, System.EventArgs e)
{
//取得Program
Files資料夾路徑
string a = System.Environment.GetFolderPath
(Environment.SpecialFolder.ProgramFiles);
textBox1.Text = a;
}

結果:
  C:\Program Files


取得啟動資料夾路徑
private void button1_Click(object sender, System.EventArgs e)
{
 //取得啟動資料夾路徑
 string a = System.Environment.GetFolderPath
           (Environment.SpecialFolder.Startup);
 textBox1.Text = a;
}

結果：
C:\Documents and Settings\Administrator\「開始」功能表\程式集\啟動


取得傳送資料夾位置
private void button1_Click(object sender, System.EventArgs
e)
{
//取得傳送資料夾位置
string a = System.Environment.GetFolderPath
        (Environment.SpecialFolder.SendTo);
  textBox1.Text = a;
}

結果:
  C:\Documents and Settings\UserName\SendTo


確認檔案是否存在
using System.IO;
...
private
void button1_Click(object sender, System.EventArgs e)
{
string file
= @"c:\temp\a.ini";
if (File.Exists(file) == true)
{
MessageBox.Show("已存在!");
}
}


檔案拷貝
using System;
using System.IO;
public struct modmain
{
void
Main()
{
File.Copy("c:\autoexec.bat",
"c:\autocopy.ext");
}
}
另一範例：
using System.IO;
...
private void button1_Click(object sender,
System.EventArgs e)
{
string FromFile = @"c:\temp\a.ini"; //來源
string ToFile = @"c:\temp\b.ini";
//目的
try
{
File.Copy(FromFile,ToFile);
}catch
(IOException)
{
MessageBox.Show("拷貝錯誤");
}

//亦這樣寫
//File.Copy(FromFile,ToFile,true);
}

private void button2_Click(object sender,
System.EventArgs e)
{
//亦可這樣
FileInfo fn1 = new
FileInfo(@"c:\temp\a.ini");
fn1.CopyTo(@"c:\temp\b.ini",true);
}


刪除檔案
using System.IO;
...
private void button3_Click(object sender, System.EventArgs e)
{
  //執行先判斷是否存在，在執行刪除動作，不然會出現錯誤
  string File = @"c:\temp\a.ini";
  System.IO.File.Delete(File);
}


使用 System.IO 讀取文字檔
底下連結的文章示範如何從文字檔擷取資訊，並且使用 ArrayList 類別顯示這項資訊給使用者。
http://support.microsoft.com/default.aspx?scid=kb;EN-US;306777


使用System.CodeDom建立簡單的程式編譯器
=>產生Hello Wolrd程式碼=>編譯=>執行
程式碼如下：
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using Microsoft.CSharp;
using Microsoft.VisualBasic;

// This example demonstrates building a Hello World program graph
// using System.CodeDom elements. It calls code generator and
// code compiler methods to build the program using CSharp, VB.
// A Windows Forms interface is included.
namespace CodeDOMExample
{
    public class CodeDomExample
    {
        //<Snippet2>
        // Build a Hello World program graph using
        // System.CodeDom types.
        public static CodeCompileUnit BuildHelloWorldGraph()
        {
            // Create a new CodeCompileUnit to contain
            // the program graph.
            CodeCompileUnit compileUnit = new CodeCompileUnit();

            // Declare a new namespace called Samples.
            CodeNamespace samples = new CodeNamespace("Samples");
            // Add the new namespace to the compile unit.
            compileUnit.Namespaces.Add( samples );

            // Add the new namespace import for the System namespace.
            samples.Imports.Add( new CodeNamespaceImport("System") );

            // Declare a new type called Class1.
            CodeTypeDeclaration class1 = new CodeTypeDeclaration("Class1");
            // Add the new type to the namespace type collection.
            samples.Types.Add(class1);

            // Declare a new code entry point method.
            CodeEntryPointMethod start = new CodeEntryPointMethod();

            // Create a type reference for the System.Console class.
            CodeTypeReferenceExpression csSystemConsoleType = new CodeTypeReferenceExpression("System.Console");

            // Build a Console.WriteLine statement.
            CodeMethodInvokeExpression cs1 = new CodeMethodInvokeExpression(
                csSystemConsoleType, "WriteLine",
                new CodePrimitiveExpression("Hello World!") );

            // Add the WriteLine call to the statement collection.
            start.Statements.Add(cs1);

            // Build another Console.WriteLine statement.
            CodeMethodInvokeExpression cs2 = new CodeMethodInvokeExpression(
                csSystemConsoleType, "WriteLine",
                new CodePrimitiveExpression("Press the Enter key to continue.") );

            // Add the WriteLine call to the statement collection.
            start.Statements.Add(cs2);

            // Build a call to System.Console.ReadLine.
            CodeMethodInvokeExpression csReadLine = new CodeMethodInvokeExpression(
                csSystemConsoleType, "ReadLine");

            // Add the ReadLine statement.
            start.Statements.Add(csReadLine);

            // Add the code entry point method to
            // the Members collection of the type.
            class1.Members.Add( start );

            return compileUnit;
        }
        //</Snippet2>

        //<Snippet3>
        public static void GenerateCode(CodeDomProvider provider,
            CodeCompileUnit compileunit)
        {
            // Build the source file name with the appropriate
            // language extension.
            String sourceFile;
            if (provider.FileExtension[0] == '.')
            {
                sourceFile = "TestGraph" + provider.FileExtension;
            }
            else
            {
                sourceFile = "TestGraph." + provider.FileExtension;
            }

            // Obtain an ICodeGenerator from the CodeDomProvider.
            ICodeGenerator gen = provider.CreateGenerator();
            // Create an IndentedTextWriter, constructed with
            // a StreamWriter to the source file.
            IndentedTextWriter tw = new IndentedTextWriter(new StreamWriter(sourceFile, false), "    ");
            // Generate source code using the code generator.
            gen.GenerateCodeFromCompileUnit(compileunit, tw, new CodeGeneratorOptions());
            // Close the output file.
            tw.Close();
        }
        //</Snippet3>

        //<Snippet4>
        public static CompilerResults CompileCode(CodeDomProvider provider,
                                                  String sourceFile,
                                                  String exeFile)
        {
            // Obtain an ICodeCompiler from the CodeDomProvider.
            ICodeCompiler compiler = provider.CreateCompiler();
            // Configure a CompilerParameters that links System.dll
            // and produces the specified executable file.
            String [] referenceAssemblies = {"System.dll"};
            CompilerParameters cp = new CompilerParameters(referenceAssemblies,
                                                           exeFile, false);
            // Generate an executable rather than a DLL file.
            cp.GenerateExecutable = true;

            // Invoke compilation.
            CompilerResults cr = compiler.CompileAssemblyFromFile(cp, sourceFile);
            // Return the results of compilation.
            return cr;
        }
        //</Snippet4>
    }

    public class CodeDomExampleForm : System.Windows.Forms.Form
    {
        private System.Windows.Forms.Button run_button = new System.Windows.Forms.Button();
        private System.Windows.Forms.Button compile_button = new System.Windows.Forms.Button();
        private System.Windows.Forms.Button generate_button = new System.Windows.Forms.Button();
        private System.Windows.Forms.TextBox textBox1 = new System.Windows.Forms.TextBox();
        private System.Windows.Forms.ComboBox comboBox1 = new System.Windows.Forms.ComboBox();
        private System.Windows.Forms.Label label1 = new System.Windows.Forms.Label();

        private void generate_button_Click(object sender, System.EventArgs e)
        {
            CodeDomProvider provider = GetCurrentProvider();
            CodeDomExample.GenerateCode(provider, CodeDomExample.BuildHelloWorldGraph());

            // Build the source file name with the appropriate
            // language extension.
            String sourceFile;
            if (provider.FileExtension[0] == '.')
            {
                sourceFile = "TestGraph" + provider.FileExtension;
            }
            else
            {
                sourceFile = "TestGraph." + provider.FileExtension;
            }

            // Read in the generated source file and
            // display the source text.
            StreamReader sr = new StreamReader(sourceFile);
            textBox1.Text = sr.ReadToEnd();
            sr.Close();
        }

        private void compile_button_Click(object sender, System.EventArgs e)
        {
            CodeDomProvider provider = GetCurrentProvider();

            // Build the source file name with the appropriate
            // language extension.
            String sourceFile;
            if (provider.FileExtension[0] == '.')
            {
                sourceFile = "TestGraph" + provider.FileExtension;
            }
            else
            {
                sourceFile = "TestGraph." + provider.FileExtension;
            }

            // Compile the source file into an executable output file.
            CompilerResults cr = CodeDomExample.CompileCode(provider,
                                                            sourceFile,
                                                            "TestGraph.exe");

            if(cr.Errors.Count > 0)
            {
                // Display compilation errors.
                textBox1.Text = "Errors encountered while building " +
                                sourceFile + " into " +cr.PathToAssembly+": \r\n\n";
                foreach(CompilerError ce in cr.Errors)
                    textBox1.AppendText(ce.ToString()+"\r\n");
                run_button.Enabled = false;
            }
            else
            {
                textBox1.Text = "Source " + sourceFile + " built into " +
                                cr.PathToAssembly+" with no errors.";
                run_button.Enabled = true;
            }
        }

        private void run_button_Click(object sender,
            System.EventArgs e)
        {
            Process.Start("TestGraph.exe");
        }

        private CodeDomProvider GetCurrentProvider()
        {
            CodeDomProvider provider;
            switch((string)this.comboBox1.SelectedItem)
            {
                case "CSharp":
                    provider = new CSharpCodeProvider();
                    break;
                case "Visual Basic":
                    provider = new VBCodeProvider();
                    break;
                default:
                    provider = new CSharpCodeProvider();
                    break;
            }
            return provider;
        }

        public CodeDomExampleForm()
        {
            this.SuspendLayout();
            // Set properties for label1
            this.label1.Location = new System.Drawing.Point(395, 20);
            this.label1.Size = new Size(180, 22);
            this.label1.Text = "Select a programming language:";
            // Set properties for comboBox1
            this.comboBox1.Location = new System.Drawing.Point(560, 16);
            this.comboBox1.Size = new Size(190, 23);
            this.comboBox1.Name = "comboBox1";
            this.comboBox1.Items.AddRange( new string[] { "CSharp", "Visual Basic" } );
            this.comboBox1.Anchor = System.Windows.Forms.AnchorStyles.Left
                                    | System.Windows.Forms.AnchorStyles.Right
                                    | System.Windows.Forms.AnchorStyles.Top;
            this.comboBox1.SelectedIndex = 0;
            // Set properties for generate_button.
            this.generate_button.Location = new System.Drawing.Point(8, 16);
            this.generate_button.Name = "generate_button";
            this.generate_button.Size = new System.Drawing.Size(120, 23);
            this.generate_button.Text = "Generate Code";
            this.generate_button.Click += new System.EventHandler(this.generate_button_Click);
            // Set properties for compile_button.
            this.compile_button.Location = new System.Drawing.Point(136, 16);
            this.compile_button.Name = "compile_button";
            this.compile_button.Size = new System.Drawing.Size(120, 23);
            this.compile_button.Text = "Compile";
            this.compile_button.Click += new System.EventHandler(this.compile_button_Click);
            // Set properties for run_button.
            this.run_button.Enabled = false;
            this.run_button.Location = new System.Drawing.Point(264, 16);
            this.run_button.Name = "run_button";
            this.run_button.Size = new System.Drawing.Size(120, 23);
            this.run_button.Text = "Run";
            this.run_button.Click += new System.EventHandler(this.run_button_Click);
            // Set properties for textBox1.
            this.textBox1.Anchor = (System.Windows.Forms.AnchorStyles.Top
                                     | System.Windows.Forms.AnchorStyles.Bottom
                                     | System.Windows.Forms.AnchorStyles.Left
                                     | System.Windows.Forms.AnchorStyles.Right);
            this.textBox1.Location = new System.Drawing.Point(8, 48);
            this.textBox1.Multiline = true;
            this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new System.Drawing.Size(744, 280);
            this.textBox1.Text = "";
            // Set properties for the CodeDomExampleForm.
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(768, 340);
            this.MinimumSize = new System.Drawing.Size(750, 340);
            this.Controls.AddRange(new System.Windows.Forms.Control[] {this.textBox1,
                this.run_button, this.compile_button, this.generate_button,
                this.comboBox1, this.label1 });
            this.Name = "CodeDomExampleForm";
            this.Text = "CodeDom Hello World Example";
            this.ResumeLayout(false);
        }

        protected override void Dispose( bool disposing )
        {
            base.Dispose( disposing );
        }

        [STAThread]
        static void Main()
        {
            Application.Run(new CodeDomExampleForm());
        }
    }
}
參考：
http://longhorn.msdn.microsoft.com/?//longhorn.msdn.microsoft.com/lhsdk/ref/ns/system.codedom.compiler/c/codedomprovider/codedomprovider.aspx


MDI基本範例
步驟：
一、主視窗設定：
1.檔案->新增專案->選擇「C#」->Windows應用程式->確定=>產生「MainForm.cs」
2.「專案管理」書籤->更改「MainForm.cs」為「MDIForm.cs」
3.切換到「表單視窗設計」書籤->修改MainForm屬性：
   (a)「Name」為MDIForm
   (b)「IsMDIContainer」 設為True
   (c)「WindowState」設為「Maximized」
4.切換到「程式碼編輯器」，將MDIForm.cs的名稱空間改為「MDI」
二、子視窗設定：
1.檔案->新增檔案->C#->表單->確定=>產生「form1.cs」
2.切換到「程式碼編輯器」，將form1.cs的名稱空間改為「MDI」
3.儲存
4.到專案管理->專案名稱按右鍵->新增->加入外部檔案「form1.cs」
三、回到「MDIForm主視窗」，加入開啟Form1程式碼：
如下：（紅色部分）
  public
MDIForm()
{
//
// The
InitializeComponent() call is required for Windows Forms designer
support.
//
InitializeComponent();
//
//
TODO: Add constructor code after the InitializeComponent()
call.
//
//===new ChildForm1===
Form1
ChildForm1=new
Form1();
ChildForm1.MdiParent=this;
ChildForm1.Show();
}
四、執行本程式


MDI應用程式範例
(請參考 第二章 2-2-專案的處理--自製MDI範本)
步驟：
1.新增MDIForm視窗應用程式專案
2.新增表單Form1=>存成 form1.cs
3.新增表單Form2=>存成 form2.cs
4.開啟專案管理書籤==>加入外部檔案form1.cs、form2.cs到專案中
5.執行==>完成
MDI主視窗(MDIForm)
using System;
using System.Windows.Forms;
namespace MDIdemo
{
///
<summary>
/// Description of MDIForm.
///
</summary>
public class MDIForm :
System.Windows.Forms.Form
{
public
MDIForm()
{
//
// The
InitializeComponent() call is required for Windows Forms designer
support.
//
InitializeComponent();

//
//
TODO: Add constructor code after the InitializeComponent()
call.
//
//===new ChildForm1===
Form1
ChildForm1=new
Form1();
ChildForm1.MdiParent=this;
ChildForm1.Show();
//===new
ChildForm2===
Form2 ChildForm2=new
Form2();
ChildForm2.MdiParent=this;
ChildForm2.Show();

}

[STAThread]
public
static void Main(string[]
args)
{
Application.Run(new
MDIForm());
}

#region Windows
Forms Designer generated code
///
<summary>
/// This method is required for Windows Forms
designer support.
/// Do not change the method contents inside
the source code editor. The Forms designer might
/// not be able
to load this method if it was changed manually.
///
</summary>
private void
InitializeComponent()
{
//
// MDIForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5,
13);
this.ClientSize = new System.Drawing.Size(292,
266);
this.Text = "MDIForm";
this.Name
=
"MDIForm";
this.IsMdiContainer=true;
}
#endregion
}
}
MDI子視窗(Form1)
using System;
using System.Windows.Forms;
namespace MDIdemo
{
///
<summary>
/// Description of Form1.
///
</summary>
public class Form1 :
System.Windows.Forms.Form
{
public
Form1()
{
//
// The
InitializeComponent() call is required for Windows Forms designer
support.
//
InitializeComponent();

//
//
TODO: Add constructor code after the InitializeComponent()
call.
//
}

#region
Windows Forms Designer generated code
///
<summary>
/// This method is required for Windows Forms
designer support.
/// Do not change the method contents inside
the source code editor. The Forms designer might
/// not be able
to load this method if it was changed manually.
///
</summary>
private void
InitializeComponent()
{
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5,
13);
this.ClientSize = new System.Drawing.Size(292,
266);
this.Text = "Form1";
this.Name =
"Form1";
}
#endregion
}
}
MDI子視窗(Form2)
using System;
using System.Windows.Forms;
namespace MDIdemo
{
///
<summary>
/// Description of Form2.
///
</summary>
public class Form2 :
System.Windows.Forms.Form
{
public
Form2()
{
//
// The
InitializeComponent() call is required for Windows Forms designer
support.
//
InitializeComponent();

//
//
TODO: Add constructor code after the InitializeComponent()
call.
//
}

#region
Windows Forms Designer generated code
///
<summary>
/// This method is required for Windows Forms
designer support.
/// Do not change the method contents inside
the source code editor. The Forms designer might
/// not be able
to load this method if it was changed manually.
///
</summary>
private void
InitializeComponent()
{
//
// Form2
//
this.AutoScaleBaseSize = new System.Drawing.Size(5,
13);
this.ClientSize = new System.Drawing.Size(292,
266);
this.Text = "Form2";
this.Name =
"Form2";
}
#endregion
}
}


取得其他表單變數
將form1的instance傳給form2。
class form1
{
public string str1;
void Button1_Click( ......  )
{
form2 f2 = new
form2();
f2.f1 = this;
}
}
class form2
{
public form1
f1;
private void func1()
{
string str = f1.str1;
}
}
[MainForm程式碼]
using System;
using System.Windows.Forms;
namespace DefaultNamespace
{
 /// <summary>
 /// Description of MainForm.
 /// </summary>
 public class MainForm : System.Windows.Forms.Form
 {
  private System.Windows.Forms.Button button1;
  public MainForm()
  {
   //
   // The InitializeComponent() call is required for Windows Forms designer support.
   //
   InitializeComponent();

   //
   // TODO: Add constructor code after the InitializeComponent() call.
   //
  }

  [STAThread]
  public static void Main(string[] args)
  {
   Application.Run(new MainForm());
  }

  #region Windows Forms Designer generated code
  /// <summary>
  /// This method is required for Windows Forms designer support.
  /// Do not change the method contents inside the source code editor. The Forms designer might
  /// not be able to load this method if it was changed manually.
  /// </summary>
  private void InitializeComponent() {
   this.button1 = new System.Windows.Forms.Button();
   this.SuspendLayout();
   //
   // button1
   //
   this.button1.Location = new System.Drawing.Point(184, 128);
   this.button1.Name = "button1";
   this.button1.TabIndex = 0;
   this.button1.Text = "button1";
   this.button1.Click += new System.EventHandler(this.Button1Click);
   //
   // MainForm
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
   this.ClientSize = new System.Drawing.Size(292, 266);
   this.Controls.Add(this.button1);
   this.Name = "MainForm";
   this.Text = "MainForm";
   this.ResumeLayout(false);
  }
  #endregion

  public string str1;
  void Button1Click(object sender, System.EventArgs e)
  {
           Form1 f2 = new Form1();
             f2.f1 = this;
  }

 }
}
[Form1程式碼]
using System;
using System.Windows.Forms;
namespace DefaultNamespace
{
///
<summary>
/// Description of Form1.
///
</summary>
public class Form1 :
System.Windows.Forms.Form
{
public
Form1()
{
//
// The
InitializeComponent() call is required for Windows Forms designer
support.
//
InitializeComponent();

//
//
TODO: Add constructor code after the InitializeComponent()
call.
//
}

#region
Windows Forms Designer generated code
///
<summary>
/// This method is required for Windows Forms
designer support.
/// Do not change the method contents inside
the source code editor. The Forms designer might
/// not be able
to load this method if it was changed manually.
///
</summary>
private void
InitializeComponent()
{
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5,
13);
this.ClientSize = new System.Drawing.Size(292,
266);
this.Text = "Form1";
this.Name =
"Form1";
}
#endregion

 public MainForm f1;
 private void func1()
 {
      string str = f1.str1;
 }
 }
}


Label 屬性設定
1.Label 自動調整大小設定：
label1.AutoSize = true;
label2.AutoSize = false;
□
2. 使用 Label 設定焦點位置：
Label1.Text="label1(&A)";
Label2.Text="label2(&B)";
Label3.Text="label3(&C)";
如圖：
例如：鍵盤使用「Alt」+「C」切換到textBox3位置


LinkLabel 超連結標籤設定
一、開啟文件：
private void linkLabel1_Click(object sender, System.EventArgs e)
{
  System.Diagnostics.Process.Start(@"c:\temp\" + this.linkLabel1.Text);
}
二、開啟網站：
linkLabel1.Text="http://tw.yahoo.com";
private void linkLabel1_LinkClicked(object sender,
                          System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
{
  System.Diagnostics.Process.Start(this.linkLabel1.Text);
}
三、包含文字與圖片的超連結：
linkLabel1.Text="c:\文章.txt";
linkLabel1.Image="圖片.bmp";
private void linkLabel1_Click(object sender, System.EventArgs e)
{
  System.Diagnostics.Process.Start(@"c:\temp\" + this.linkLabel1.Text);
}


Button 屬性設定
一、Button 的文字設定：
this.button1.Text = "按扭";
二、Button 的停用設定：
this.button1.Enabled = false;
三、Button 的位置設定：
this.button1.TextAlign = ContentAlignment.BottomCenter; //靠下置中
其他：BottomCenter、BottomLeft、
BottomRight、MiddleCenter、
MiddleLeft、MiddleRight
四、Button 的外觀設定：
this.button1.FlatStyle = FlatStyle.Flat;
this.button2.FlatStyle = FlatStyle.Popup;
this.button3.FlatStyle = FlatStyle.Standard;
this.button4.FlatStyle = FlatStyle.System; //XP效果
五、設定Button上的圖示：
this.button1.Image = System.Drawing.Image.FromFile(@"c:\temp\agentdp2.ico");
註:ImageAlign為設定圖示位置


Button 取得子視窗傳回值
private void button1_Click_1(object sender,
System.EventArgs e)
{
Form2 f = new Form2(); //建立Form2子表單視窗
f.ShowDialog(this);
f.Dispose();  /* 資源釋放 */
if (f.DialogResult ==
DialogResult.OK)
{
textBox1.Text =
"OK";
}
if (f.DialogResult ==
DialogResult.Cancel)
{
textBox1.Text =
"Cancel";
}
}
子表單視窗，兩按鈕設定如下：
this.button1.DialogResult = DialogResult.OK;
this.button2.DialogResult = DialogResult.Cancel;


Button Sender判斷
1.表單建立三個按鈕、和一個textBox文字盒
2.建立自訂的myEvent事件，程式碼如下：
 private void myEvent(object sender, System.EventArgs e)
  {
   Button btn = (Button)sender;
   if (btn.Name == "button1")
   {
    textBox1.Text = "按扭1";
   }
   if (btn.Name == "button2")
   {
    textBox1.Text = "按扭2";
   }
   if (btn.Name == "button3")
   {
    textBox1.Text = "按扭3";
   }
  }
3.點選各個按鈕的Click事件，選擇引用myEvent事件
4.完成「Button Sender判斷」
[完整程式碼]
/*
 * Created by SharpDevelop.
 * User: Administrator
 * Date: 2004/8/30
 * Time: 下午 08:30
 *
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Windows.Forms;
namespace DefaultNamespace
{
///
<summary>
/// Description of MainForm.
///
</summary>
public class MainForm :
System.Windows.Forms.Form
{
private
System.Windows.Forms.Button button3;
private
System.Windows.Forms.Button button1;
private
System.Windows.Forms.TextBox textBox1;
private
System.Windows.Forms.Button button2;
public
MainForm()
{
//
// The
InitializeComponent() call is required for Windows Forms designer
support.
//
InitializeComponent();

//
//
TODO: Add constructor code after the InitializeComponent()
call.
//
}

[STAThread]
public
static void Main(string[]
args)
{
Application.Run(new
MainForm());
}

#region Windows
Forms Designer generated code
///
<summary>
/// This method is required for Windows Forms
designer support.
/// Do not change the method contents inside
the source code editor. The Forms designer might
/// not be able
to load this method if it was changed manually.
///
</summary>
private void InitializeComponent()
{
this.button2 = new
System.Windows.Forms.Button();
this.textBox1 = new
System.Windows.Forms.TextBox();
this.button1 = new
System.Windows.Forms.Button();
this.button3 = new
System.Windows.Forms.Button();
this.SuspendLayout();
//
// button2
//
this.button2.Location = new System.Drawing.Point(96,
80);
this.button2.Name =
"button2";
this.button2.TabIndex =
1;
this.button2.Text =
"button2";
this.button2.Click += new
System.EventHandler(this.myEvent);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(88,
24);
this.textBox1.Name =
"textBox1";
this.textBox1.TabIndex =
3;
this.textBox1.Text = "textBox1";
//
// button1
//
this.button1.Location = new System.Drawing.Point(16,
80);
this.button1.Name =
"button1";
this.button1.TabIndex =
0;
this.button1.Text =
"button1";
this.button1.Click += new
System.EventHandler(this.myEvent);
//
// button3
//
this.button3.Location = new System.Drawing.Point(176,
80);
this.button3.Name =
"button3";
this.button3.TabIndex =
2;
this.button3.Text =
"button3";
this.button3.Click += new
System.EventHandler(this.myEvent);
//
// MainForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5,
15);
this.ClientSize = new System.Drawing.Size(292,
266);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name
= "MainForm";
this.Text =
"MainForm";
this.ResumeLayout(false);
}
#endregion

private void myEvent(object sender,
System.EventArgs e)
{
Button btn =
(Button)sender;
if (btn.Name ==
"button1")
{
textBox1.Text =
"按扭1";
}
if (btn.Name ==
"button2")
{
textBox1.Text =
"按扭2";
}
if (btn.Name ==
"button3")
{
textBox1.Text =
"按扭3";
}
}
 }
}


CheckBox 屬性設定
一、CheckBox 外觀設定：
(1)文字位置：
checkBox1.CheckAlign = ContentAlignment.MiddleLeft;
checkBox2.CheckAlign = ContentAlignment.MiddleRight;
( 2)按鈕樣式：
checkBox3.Appearance = Appearance.Button;
二、CheckBox初始化設定：
checkBox1.Checked = true;
取得checkBox狀態:
 checkBox2.CheckState = CheckState.Checked;
三、CheckBox 中間狀態設定：
checkBox1.ThreeState = true;


CheckBox 狀態判斷寫法：
private void button1_Click(object sender, System.EventArgs e)
{
    if (checkBox1.Checked == true)
    {
        MessageBox.Show("已選擇為TRUE");
    }
    //判斷狀態
    if (checkBox1.CheckState == CheckState.Checked)
    {
        MessageBox.Show("已選擇為TRUE");
    }
}


使用CheckedChanged事件判斷CheckBox是否改變狀態寫法：
private void checkBox1_CheckedChanged(object sender, System.EventArgs e)
{
    string a;
    if (checkBox1.Checked == true)
    {
        a = "為TRUE";
    }
    else
    {
        a = "為False";
    }
    MessageBox.Show(a);
}


判斷選取狀態
/*
 * Created by SharpDevelop.
 * User: Administrator
 * Date: 2004/9/2
 * Time:
 *
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Windows.Forms;
namespace
DefaultNamespace
{
/// <summary>
/// Description of
MainForm.
/// </summary>
public class MainForm :
System.Windows.Forms.Form
{
private
System.Windows.Forms.TextBox textBox1;
private
System.Windows.Forms.Button button1;
private
System.Windows.Forms.RadioButton radioButton1;
private
System.Windows.Forms.RadioButton radioButton2;
private
System.Windows.Forms.RadioButton radioButton3;
public
MainForm()
{
//
// The
InitializeComponent() call is required for Windows Forms designer
support.
//
InitializeComponent();

//
//
TODO: Add constructor code after the InitializeComponent()
call.
//
}

[STAThread]
public
static void Main(string[]
args)
{
Application.Run(new
MainForm());
}

#region Windows
Forms Designer generated code
///
<summary>
/// This method is required for Windows Forms
designer support.
/// Do not change the method contents inside
the source code editor. The Forms designer might
/// not be able
to load this method if it was changed manually.
///
</summary>
private void InitializeComponent()
{
this.radioButton3 = new
System.Windows.Forms.RadioButton();
this.radioButton2 = new
System.Windows.Forms.RadioButton();
this.radioButton1 = new
System.Windows.Forms.RadioButton();
this.button1 = new
System.Windows.Forms.Button();
this.textBox1 = new
System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// radioButton3
//
this.radioButton3.Location = new System.Drawing.Point(8,
56);
this.radioButton3.Name =
"radioButton3";
this.radioButton3.TabIndex =
2;
this.radioButton3.Text =
"radioButton3";
//
//
radioButton2
//
this.radioButton2.Location = new System.Drawing.Point(8,
32);
this.radioButton2.Name =
"radioButton2";
this.radioButton2.TabIndex =
1;
this.radioButton2.Text =
"radioButton2";
//
//
radioButton1
//
this.radioButton1.Checked =
true;
this.radioButton1.Location = new
System.Drawing.Point(8, 8);
this.radioButton1.Name =
"radioButton1";
this.radioButton1.TabIndex =
0;
this.radioButton1.TabStop =
true;
this.radioButton1.Text =
"radioButton1";
//
//
button1
//
this.button1.Location =
new System.Drawing.Point(144, 32);
this.button1.Name =
"button1";
this.button1.TabIndex =
3;
this.button1.Text =
"button1";
this.button1.Click += new
System.EventHandler(this.Button1Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(8,
88);
this.textBox1.Name =
"textBox1";
this.textBox1.Size = new
System.Drawing.Size(200, 22);
this.textBox1.TabIndex =
4;
this.textBox1.Text = "textBox1";
//
// MainForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5,
15);
this.ClientSize = new System.Drawing.Size(232,
126);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button1);
this.Controls.Add(this.radioButton3);
this.Controls.Add(this.radioButton2);
this.Controls.Add(this.radioButton1);
this.Name
= "MainForm";
this.Text =
"MainForm";
this.ResumeLayout(false);
}
#endregion
void Button1Click(object sender,
System.EventArgs e)
{
if (radioButton1.Checked ==
true)
{
textBox1.Text =
"radioButton1已被選取";
}
if (radioButton2.Checked ==
true)
{
textBox1.Text =
"radioButton2已被選取";
}
if (radioButton3.Checked ==
true)
{
textBox1.Text =
"radioButton3已被選取";
}
  }

 }
}


基本用法
groupBox1的Text屬性設為：第一群組
groupBox2的Text屬性設為：第二群組
如圖：


checkedListBox 新增資料
選擇checkedListBox的Items屬性：
依序填入：
check1
check2
check3
或程式寫法：
checkedListBox1.Items.Add("check1");
checkedListBox1.Items.Add("check2");
checkedListBox1.Items.Add("check3");


檢查checkedListBox項目數
一、已存在的項目數：
  void Button1Click(object sender, System.EventArgs e)
  {
   int cnt = checkedListBox1.Items.Count;
   MessageBox.Show(cnt.ToString());
  }

二、已設為True的項目數：
  void Button2Click(object sender, System.EventArgs e)
  {
   int cnt = checkedListBox1.CheckedItems.Count;
   MessageBox.Show(cnt.ToString());
  }


取得被選取的項目名稱
void Button1Click(object sender, System.EventArgs
e)
{
for (int i=0; i< checkedListBox1.CheckedItems.Count;i++)
{
MessageBox.Show(checkedListBox1.CheckedItems[i].ToString());
}
}
結果：(若選擇以下兩者為真，則顯示以下名稱)
check1
check3
同樣效果，另一寫法：
  void Button1Click(object sender,
System.EventArgs e)
{
foreach (string
a in checkedListBox1.CheckedItems)
{
MessageBox.Show(a);
}
}


設定測試框立體樣式
void Button2Click(object sender, System.EventArgs e)
  {
   checkedListBox1.ThreeDCheckBoxes = true;
  }


設為可重複選項
this.checkedListBox1.MultiColumn = true;


新增資料
設定ComboBox的Items屬性：
依序加入：
item1
item2
item3
或 程式寫法：
comboBox1.Items.Clear();
comboBox1.Items.Add("item1");
comboBox1.Items.Add("item2");
comboBox1.Items.Add("item3");


設定初始值
comboBox1.Text = "item2";
comboBox1.Items.Clear();
comboBox1.Items.Add("item1");
comboBox1.Items.Add("item2");
comboBox1.Items.Add("item3");


外觀樣式設定
有三種：
comboBox1.DropDownStyle = ComboBoxStyle.DropDown;
comboBox2.DropDownStyle = ComboBoxStyle.Simple;
comboBox3.DropDownStyle = ComboBoxStyle.DropDownList;


取得comboBox的項目資料
// text
string a = comboBox1.Text;
MessageBox.Show(a+"顯示已取得的資料");

//
SelectedItem
if (comboBox1.SelectedItem != null)
{
string b =
comboBox1.SelectedItem.ToString();
MessageBox.Show(b+"取得已選取的項目資料");
}

//
SelectedIndex
if (comboBox1.SelectedIndex != -1)
{
int i =
comboBox1.SelectedIndex;
string c =
comboBox1.Items[i].ToString();
MessageBox.Show(c+"依據索引值取得項目資料");
}


SelectedIndexChanged事件
When the item which is selected modifies:
private void comboBoxDrives_SelectedIndexChanged(object sender, System.EventArgs e)
{
 string a = comboBox1.SelectedItem as string;
 if ( a == null ) return;
}


加入子節點
.在.Net的程式中創建一個TreeView的元件，其實就是創建了一個可以放置TreeNode節點的“容器”(Container)。而在該容器中加入一個節點，其實就是加入一個TreeNode物件，刪除一個節點，就是刪除一個TreeNode物件。

    TreeView元件雖然是一個操作起來比較麻煩的元件，但歸根到底，可以總結滛三種基本操作：加入子節點、加入兄弟節點和刪除節點

加入子節點：

    所謂子節點，就是處於選定節點的下一級節點。加入子節點的具體過程是：首先要在TreeView元件中定位要加入的子節點的位置，然後創建一個節點物件，然後利用TreeVeiw類中對節點的加入方法（即：Add ( )方法），加入此節點物件。

if(myTreeView.SelectedNode!=null)
{
 TreeNode ChildNode=new TreeNode(“子節點”);
 myTreeView.SelectedNode.Nodes.Add(ChildNode);
 myTreeView.ExpandAll();
}


加入兄弟節點
  所謂兄弟節點，就是在選定的節點的平級的節點。加入兄弟節點的方法和加入子節點的方法基本一致，只是在最後的實現方法上有著略微的區別。
if(myTreeView.SelectedNode!=null)
{
TreeNode
BrotherNode=new TreeNode(“兄弟節點”);
myTreeView.SelectedNode.Parent.Nodes.Add(BrotherNode);
myTreeView.ExpandAll();
}


刪除節點
    刪除節點必須保證要刪除的節點沒有下一級節點，否則必須先刪除此節點中的所有下一級節點，然後再刪除此節點。
//判斷選定的節點是否存在下一級節點
if ( myTreeView.SelectedNode.Nodes.Count == 0 )
//刪除節點
treeView1.SelectedNode.Remove () ;


一些其他常用操作
這些常用操作無非是，展開所有節點，展開指定的節點、和折疊所有節點。

展開所有節點：

    要展開TreeView元件中的所有節點，首先就要把選定的節點指標定位在TreeView元件的根節點上，然後調用選定元件的ExpandAll方法就可以了，下面是具體代碼：
//定位根節點
myTreeView.SelectedNode = myTreeView.Nodes [0] ;
//展開元件中的所有節點
treeView1.SelectedNode.ExpandAll ( ) ;

折疊所有節點：

    折疊所有節點和展開所有節點是一組互操作.
//定位根節點
myTreeView.SelectedNode = myTreeView.Nodes [0] ;
//折疊元件中所有節點
myTreeView.SelectedNode.Collapse ( ) ;

展開選定節點的下一級節點：

    由於只是展開下一級節點，所以就沒有必要用ExpandAll ( )方法了。展開下一級節點只需要調用Expand ( )方法就可以了，下面是具體的實現代碼：

myTreeView.SelectedNode.Expand ( ) ;


取得所選取的顏色
private void button1_Click(object sender, System.EventArgs e)
{
    if (colorDialog1.ShowDialog() == DialogResult.OK)
    {
        button1.ForeColor = colorDialog1.Color;
    }
}


開啟colorDialog延伸功能
colorDialog1.FullOpen = true;


使用 ADO.NET 連接到資料庫並執行命令
底下連結的文章說明如何使用 ActiveX Data Objects (ADO) .NET 連接到資料庫並執行命令。
http://support.microsoft.com/?id=306636


/*
 * Created by SharpDevelop.
 * User: Administrator
 * Date: 2004/8/1
 * Time: 下午 03:15
 *
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
namespace mdbproject
{
 /// <summary>
 /// Description of MainForm.
 /// </summary>
 public class MainForm : System.Windows.Forms.Form
 {
  private System.Windows.Forms.DataGrid dataGrid1;
  private System.Data.DataSet dataSet1;
  private System.Data.OleDb.OleDbConnection oleDbConnection1;
  public MainForm()
  {
   //
   // The InitializeComponent() call is required for Windows Forms designer support.
   //
   InitializeComponent();

   //
   // TODO: Add constructor code after the InitializeComponent() call.
   //
  }

  [STAThread]
  public static void Main(string[] args)
  {
   Application.Run(new MainForm());
  }

  #region Windows Forms Designer generated code
  /// <summary>
  /// This method is required for Windows Forms designer support.
  /// Do not change the method contents inside the source code editor. The Forms designer might
  /// not be able to load this method if it was changed manually.
  /// </summary>
  private void InitializeComponent() {
   this.oleDbConnection1 = new System.Data.OleDb.OleDbConnection();
   this.dataSet1 = new System.Data.DataSet();
   this.dataGrid1 = new System.Windows.Forms.DataGrid();
   ((System.ComponentModel.ISupportInitialize)(this.dataSet1)).BeginInit();
   ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
   this.SuspendLayout();
   //
   // dataSet1
   //
   this.dataSet1.DataSetName = "NewDataSet";
   this.dataSet1.Locale = new System.Globalization.CultureInfo("zh-TW");
   this.dataSet1.Namespace = "mdbproject";
   //
   // dataGrid1
   //
   this.dataGrid1.DataMember = "";
   this.dataGrid1.DataSource = this.dataSet1;
   this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
   this.dataGrid1.Location = new System.Drawing.Point(8, 8);
   this.dataGrid1.Name = "dataGrid1";
   this.dataGrid1.Size = new System.Drawing.Size(560, 256);
   this.dataGrid1.TabIndex = 0;
   //
   // MainForm
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
   this.ClientSize = new System.Drawing.Size(584, 278);
   this.Controls.Add(this.dataGrid1);
   this.Name = "MainForm";
   this.Text = "MainForm";
   this.Load += new System.EventHandler(this.MainFormLoad);
   ((System.ComponentModel.ISupportInitialize)(this.dataSet1)).EndInit();
   ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
   this.ResumeLayout(false);
  }
  #endregion
  void MainFormLoad(object sender, System.EventArgs e)
  {
   oleDbConnection1.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db1.mdb";
   oleDbConnection1.Open();
   OleDbDataAdapter adapter = new OleDbDataAdapter();
         adapter.SelectCommand = new OleDbCommand("select * from myTable", oleDbConnection1);
         adapter.Fill(dataSet1);
  }

 }
}


ODBC .NET 資料提供者(ODBC .NET Data Provider) 下載

ODBC .NET 資料提供者是 .NET Framework 的附加元件。

它提供存取原生 ODBC 驅動程式的方式，與 OLE DB .NET 資料提供者提供存取原生 OLE DB 提供者的方式相同。
ODBC .NET Data Provider下載
http://www.microsoft.com/downloads/details.aspx?displaylang=zh-tw&FamilyID=6CCD8427-1017-4F33-A062-D165078E32B1

概觀

ODBC .NET 資料提供者是 .NET Framework 的附加元件。它提供存取原生 ODBC 驅動程式的方式，
與 OLE DB .NET 資料提供者提供存取原生 OLE DB 提供者的方式相同。
ODBC .NET 資料提供者的主要設計是用於配合所有相容的 ODBC 驅動程式，
但只有下列的驅動程式已經過 ODBC .NET 資料提供者測試：
  • Microsoft SQL ODBC Driver
  • Microsoft ODBC Driver for Oracle
  • Microsoft Jet ODBC Driver

系統需求

  • 支援的作業系統: Windows 2000, Windows 98, Windows ME, Windows NT, Windows XP

如果 .NET Framework (為 Visual Studio .NET 的一部份) 沒有安裝本下載檔案的安裝程式，則將無法運作。
當成本下載檔案的安裝程式的一部份，Microsoft.Data.Odbc 命名空間被會加到全域快取組件中。

ODBC .NET 資料提供者也需要安裝 MDAC 2.7 或以後版本。


SharpDevelop Fidalgo 安裝MySQL元件
1.下載：ByteFX.Data.MySQLClient
        http://sourceforge.net/projects/mysqlnet/

2.安裝：ByteFX.MySqlClient.76=>Setup.msi

3.開啟SharpDevelop，安裝MySQL元件：
  =>工具(Tools)面版=>右鍵選單=>Configure Sidebar(引用項目)
  =>新增分類(New)=>設定名稱：MySQL.Net
  =>新增元件(Add Components)=>ByteFX.MySqlClient和ByteFX.MySqlClient.Design=>Ok
  =>ok

4.開新專案(New Combine)=>看工具(Tools)面版==>多一個MySQL.Net=>元件安裝完成


/*
 * 由 SharpDevelop .NET 免費開發工具 建立的.NET程式.
 * 作    者: Administrator
 * 建立日期: 2004/8/1
 * 建立時間: 下午 10:36
 * 功    能: MySQL資料庫連結
 * 修改日期:
 */
using System;
using System.Windows.Forms;
using ByteFX.Data.MySqlClient;

namespace MySQLproject
{
 /// <summary>
 /// Description of MainForm.
 /// </summary>
 public class MainForm : System.Windows.Forms.Form
 {
  private System.Windows.Forms.Button button1;
  private System.Windows.Forms.DataGrid dataGrid1;
  private System.Data.DataSet dataSet1;
  public MainForm()
  {
   //
   // The InitializeComponent() call is required for Windows Forms designer support.
   //
   InitializeComponent();

   //
   // TODO: Add constructor code after the InitializeComponent() call.
   //
  }

  [STAThread]
  public static void Main(string[] args)
  {
   Application.Run(new MainForm());
  }

  #region Windows Forms Designer generated code
  /// <summary>
  /// This method is required for Windows Forms designer support.
  /// Do not change the method contents inside the source code editor. The Forms designer might
  /// not be able to load this method if it was changed manually.
  /// </summary>
  private void InitializeComponent() {
   this.dataSet1 = new System.Data.DataSet();
   this.dataGrid1 = new System.Windows.Forms.DataGrid();
   this.button1 = new System.Windows.Forms.Button();
   ((System.ComponentModel.ISupportInitialize)(this.dataSet1)).BeginInit();
   ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
   this.SuspendLayout();
   //
   // dataSet1
   //
   this.dataSet1.DataSetName = "NewDataSet";
   this.dataSet1.Locale = new System.Globalization.CultureInfo("zh-TW");
   this.dataSet1.Namespace = "mdbproject";
   //
   // dataGrid1
   //
   this.dataGrid1.DataMember = "";
   this.dataGrid1.DataSource = this.dataSet1;
   this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
   this.dataGrid1.Location = new System.Drawing.Point(8, 40);
   this.dataGrid1.Name = "dataGrid1";
   this.dataGrid1.Size = new System.Drawing.Size(560, 224);
   this.dataGrid1.TabIndex = 0;
   //
   // button1
   //
   this.button1.BackColor = System.Drawing.SystemColors.ActiveCaption;
   this.button1.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
   this.button1.Location = new System.Drawing.Point(464, 8);
   this.button1.Name = "button1";
   this.button1.Size = new System.Drawing.Size(104, 24);
   this.button1.TabIndex = 1;
   this.button1.Text = "連線MySQL資料庫";
   this.button1.Click += new System.EventHandler(this.Button1Click);
   //
   // MainForm
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
   this.ClientSize = new System.Drawing.Size(584, 278);
   this.Controls.Add(this.button1);
   this.Controls.Add(this.dataGrid1);
   this.Name = "MainForm";
   this.Text = "MainForm";
   ((System.ComponentModel.ISupportInitialize)(this.dataSet1)).EndInit();
   ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
   this.ResumeLayout(false);
  }
  #endregion

  void Button1Click(object sender, System.EventArgs e)
  {
   MySqlConnection myConnection = new MySqlConnection("Database=delphi;Data Source=localhost;User Id=root;Password=");
   MySqlDataAdapter adapter = new MySqlDataAdapter();
   adapter.SelectCommand = new MySqlCommand("select * from forum_forum", myConnection);
   adapter.Fill(dataSet1);
   myConnection.Open();
  }
 }
}


ODBC.NET 方式連到MySQL
/**
* @sample    : mycon.cs
* @purpose   : Demo sample for ODBC.NET using Connector/ODBC
* @author    : Venu, venu@mysql.com
*
* (C) Copyright MySQL AB, 1995-2003
*
**/

/* build command
  *
  *  csc /t:exe
  *      /out:mycon.exe mycon.cs
  *      /r:Microsoft.Data.Odbc.dll
  */

using Console = System.Console;
using Microsoft.Data.Odbc;

namespace myodbc3
{
  class mycon
  {
    static void Main(string[] args)
    {
      try
      {
        //Connection string for Connector/ODBC 2.50
        /*string MyConString = "DRIVER={MySQL};" +
                             "SERVER=localhost;" +
                             "DATABASE=test;" +
                             "UID=venu;" +
                             "PASSWORD=venu;" +
                             "OPTION=3";
        */
        //Connection string for Connector/ODBC 3.51
        string MyConString = "DRIVER={MySQL ODBC 3.51 Driver};" +
                             "SERVER=localhost;" +
                             "DATABASE=test;" +
                             "UID=venu;" +
                             "PASSWORD=venu;" +
                             "OPTION=3";

        //Connect to MySQL using Connector/ODBC
        OdbcConnection MyConnection = new OdbcConnection(MyConString);
        MyConnection.Open();

        Console.WriteLine("\n !!! success, connected successfully !!!\n");

        //Display connection information
        Console.WriteLine("Connection Information:");
        Console.WriteLine("\tConnection String:" + MyConnection.ConnectionString);
        Console.WriteLine("\tConnection Timeout:" + MyConnection.ConnectionTimeout);
        Console.WriteLine("\tDatabase:" + MyConnection.Database);
        Console.WriteLine("\tDataSource:" + MyConnection.DataSource);
        Console.WriteLine("\tDriver:" + MyConnection.Driver);
        Console.WriteLine("\tServerVersion:" + MyConnection.ServerVersion);

        //Create a sample table
        OdbcCommand MyCommand = new OdbcCommand("DROP TABLE IF EXISTS my_odbc_net",MyConnection);
        MyCommand.ExecuteNonQuery();
        MyCommand.CommandText = "CREATE TABLE my_odbc_net(id int, name varchar(20), idb bigint)";
        MyCommand.ExecuteNonQuery();

        //Insert
        MyCommand.CommandText = "INSERT INTO my_odbc_net VALUES(10,'venu', 300)";
        Console.WriteLine("INSERT, Total rows affected:" + MyCommand.ExecuteNonQuery());;

        //Insert
        MyCommand.CommandText = "INSERT INTO my_odbc_net VALUES(20,'mysql',400)";
        Console.WriteLine("INSERT, Total rows affected:" + MyCommand.ExecuteNonQuery());

        //Insert
        MyCommand.CommandText = "INSERT INTO my_odbc_net VALUES(20,'mysql',500)";
        Console.WriteLine("INSERT, Total rows affected:" + MyCommand.ExecuteNonQuery());

        //Update
        MyCommand.CommandText = "UPDATE my_odbc_net SET id=999 WHERE id=20";
        Console.WriteLine("Update, Total rows affected:" + MyCommand.ExecuteNonQuery());

        //COUNT(*)
        MyCommand.CommandText = "SELECT COUNT(*) as TRows FROM my_odbc_net";
        Console.WriteLine("Total Rows:" + MyCommand.ExecuteScalar());

        //Fetch
        MyCommand.CommandText = "SELECT * FROM my_odbc_net";
        OdbcDataReader MyDataReader;
        MyDataReader =  MyCommand.ExecuteReader();
        while (MyDataReader.Read())
        {
         if(string.Compare(MyConnection.Driver,"myodbc3.dll") == 0) {
           Console.WriteLine("Data:" + MyDataReader.GetInt32(0) + " " +
                                       MyDataReader.GetString(1) + " " +
                                       MyDataReader.GetInt64(2)); //Supported only by Connector/ODBC 3.51
         }
         else {
           Console.WriteLine("Data:" + MyDataReader.GetInt32(0) + " " +
                                       MyDataReader.GetString(1) + " " +
                                       MyDataReader.GetInt32(2)); //BIGINTs not supported by Connector/ODBC
         }
        }

        //Close all resources
        MyDataReader.Close();
        MyConnection.Close();
      }
      catch (OdbcException MyOdbcException) //Catch any ODBC exception ..
      {
        for (int i=0; i < MyOdbcException.Errors.Count; i++)
        {
          Console.Write("ERROR #" + i + "\n" +
            "Message: " + MyOdbcException.Errors[i].Message + "\n" +
            "Native: " + MyOdbcException.Errors[i].NativeError.ToString() + "\n" +
            "Source: " + MyOdbcException.Errors[i].Source + "\n" +
            "SQL: " + MyOdbcException.Errors[i].SQLState + "\n");
        }
      }
    }
  }
}


畫單線範例
範例一：
using System.Drawing;
....
void MainFormPaint(object sender, System.Windows.Forms.PaintEventArgs e)
{
 Graphics  g = e.Graphics;
 g.DrawLine(Pens.Black, 10, 10, 200, 100);
}
範例二：
using System.Drawing;
....
void MainFormPaint(object sender, System.Windows.Forms.PaintEventArgs e)
{
 Graphics  g = e.Graphics;
 Pen Fpen = new Pen(Color.Black, 3.0F);//改變線的粗細3.0F=3.0
 g.DrawLine(Fpen, 10, 10, 200, 100);
}

範例三：
using System.Drawing;
....

void MainFormPaint(object sender, System.Windows.Forms.PaintEventArgs e)
{
 Graphics  g = e.Graphics;
 Pen pen = new Pen(Color.Black, 3.0F);//改變線的粗細
 g.TranslateTransform(100, 100);      //平移X和Y各加100
 g.ScaleTransform(2, 3);              //X延伸2倍,Y延伸3倍
 g.RotateTransform(90);               //旋轉90度
 g.DrawLine(pen, 10, 10, 200, 100);   //畫直線
}
[完整程式]
/*
 * 由 SharpDevelop .NET 免費開發工具 建立的 C# .NET 程式.
 * 作    者: Administrator
 * 建立日期: 2004/8/6
 * 建立時間: 上午 01:34
 * 功    能: Drawing with C# (畫線範例)
 * 修改日期: 上午 01:34
 */
using System;
using System.Windows.Forms;
using System.Drawing;
namespace DefaultNamespace
{
 /// <summary>
 /// Description of MainForm.
 /// </summary>
 public class MainForm : System.Windows.Forms.Form
 {
  public MainForm()
  {
   //
   // The InitializeComponent() call is required for Windows Forms designer support.
   //
   InitializeComponent();

   //
   // TODO: Add constructor code after the InitializeComponent() call.
   //
  }

  [STAThread]
  public static void Main(string[] args)
  {
   Application.Run(new MainForm());
  }

  #region Windows Forms Designer generated code
  /// <summary>
  /// This method is required for Windows Forms designer support.
  /// Do not change the method contents inside the source code editor. The Forms designer might
  /// not be able to load this method if it was changed manually.
  /// </summary>
  private void InitializeComponent() {
   //
   // MainForm
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
   this.ClientSize = new System.Drawing.Size(292, 266);
   this.Name = "MainForm";
   this.Text = "MainForm";
   this.Paint += new System.Windows.Forms.PaintEventHandler(this.MainFormPaint);
  }
  #endregion
  void MainFormPaint(object sender, System.Windows.Forms.PaintEventArgs e)
  {
       // Get the graphics object
       Graphics gfx = e.Graphics;
       // Create a new pen that we shall use for drawing the line
       Pen myPen = new Pen(Color.Black);
       // Loop and create a new line 10 pixels below the last one
       for(int i = 20; i < 250; i = i + 10)
        gfx.DrawLine(myPen, 20, i, 270, i);
  }
 }
}


/*
 * 由 SharpDevelop .NET 免費開發工具 建立的 C# .NET 程式.
 * 作    者: Administrator
 * 建立日期: 2004/8/6
 * 建立時間: 上午 01:34
 * 功    能: Drawing with C# (畫方格圖範例)
 * 修改日期: 上午 01:34
 */
using System;
using System.Windows.Forms;
using System.Drawing;
namespace DefaultNamespace
{
 /// <summary>
 /// Description of MainForm.
 /// </summary>
 public class MainForm : System.Windows.Forms.Form
 {
  public MainForm()
  {
   //
   // The InitializeComponent() call is required for Windows Forms designer support.
   //
   InitializeComponent();

   //
   // TODO: Add constructor code after the InitializeComponent() call.
   //
  }

  [STAThread]
  public static void Main(string[] args)
  {
   Application.Run(new MainForm());
  }

  #region Windows Forms Designer generated code
  /// <summary>
  /// This method is required for Windows Forms designer support.
  /// Do not change the method contents inside the source code editor. The Forms designer might
  /// not be able to load this method if it was changed manually.
  /// </summary>
  private void InitializeComponent() {
   //
   // MainForm
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
   this.ClientSize = new System.Drawing.Size(292, 266);
   this.Name = "MainForm";
   this.Text = "MainForm";
   this.Paint += new System.Windows.Forms.PaintEventHandler(this.MainFormPaint);
  }
  #endregion
  void MainFormPaint(object sender, System.Windows.Forms.PaintEventArgs e)
  {
            // Get the graphics object
            Graphics gfx = e.Graphics;
            // Create a new pen that we shall use for drawing the line
            Pen myPen = new Pen(Color.Black);
            // Loop and create a horizontal line 10 pixels below the last one
            for(int i = 20; i <= 250; i = i + 10)
            {
                gfx.DrawLine(myPen, 20, i, 270, i);
            }
            // Loop and create a vertical line 10 pixels next to the last one
            for(int x = 20; x < 280; x = x + 10)
            {
                gfx.DrawLine(myPen, x, 20, x, 250);
            }
  }
 }
}


/*
 * 由 SharpDevelop .NET 免費開發工具 建立的 C# .NET 程式.
 * 作    者: Administrator
 * 建立日期: 2004/8/6
 * 建立時間: 上午 01:34
 * 功    能: Drawing with C# (Rectangles範例)
 * 修改日期: 上午 01:34
 */
using System;
using System.Windows.Forms;
using System.Drawing;
namespace DefaultNamespace
{
 /// <summary>
 /// Description of MainForm.
 /// </summary>
 public class MainForm : System.Windows.Forms.Form
 {
  public MainForm()
  {
   //
   // The InitializeComponent() call is required for Windows Forms designer support.
   //
   InitializeComponent();

   //
   // TODO: Add constructor code after the InitializeComponent() call.
   //
  }

  [STAThread]
  public static void Main(string[] args)
  {
   Application.Run(new MainForm());
  }

  #region Windows Forms Designer generated code
  /// <summary>
  /// This method is required for Windows Forms designer support.
  /// Do not change the method contents inside the source code editor. The Forms designer might
  /// not be able to load this method if it was changed manually.
  /// </summary>
  private void InitializeComponent() {
   //
   // MainForm
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
   this.ClientSize = new System.Drawing.Size(292, 266);
   this.Name = "MainForm";
   this.Text = "MainForm";
   this.Paint += new System.Windows.Forms.PaintEventHandler(this.MainFormPaint);
  }
  #endregion
  void MainFormPaint(object sender, System.Windows.Forms.PaintEventArgs e)
  {
            // Get the graphics object
            Graphics gfx = e.Graphics;
            // Create a new pen that we shall use for drawing the line
            Pen myPen = new Pen(Color.Black);
            // Loop until the coordinates reach 250 (the lower right corner of the form)
            for(int i = 0; i < 250; i = i + 50)
            {
                // Draw a 50x50 pixels rectangle
                gfx.DrawRectangle(myPen, i, i, 50, 50);
            }
  }
 }
}


/*
 * 由 SharpDevelop .NET 免費開發工具 建立的 C# .NET 程式.
 * 作    者: Administrator
 * 建立日期: 2004/8/6
 * 建立時間: 上午 01:34
 * 功    能: Drawing with C# (畫漸層色彩範例)
 * 修改日期: 上午 01:34
 */
using System;
using System.Windows.Forms;
using System.Drawing;
namespace DefaultNamespace
{
 /// <summary>
 /// Description of MainForm.
 /// </summary>
 public class MainForm : System.Windows.Forms.Form
 {
  public MainForm()
  {
   //
   // The InitializeComponent() call is required for Windows Forms designer support.
   //
   InitializeComponent();

   //
   // TODO: Add constructor code after the InitializeComponent() call.
   //
  }

  [STAThread]
  public static void Main(string[] args)
  {
   Application.Run(new MainForm());
  }

  #region Windows Forms Designer generated code
  /// <summary>
  /// This method is required for Windows Forms designer support.
  /// Do not change the method contents inside the source code editor. The Forms designer might
  /// not be able to load this method if it was changed manually.
  /// </summary>
  private void InitializeComponent() {
   //
   // MainForm
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
   this.ClientSize = new System.Drawing.Size(292, 266);
   this.Name = "MainForm";
   this.Text = "MainForm";
   this.Paint += new System.Windows.Forms.PaintEventHandler(this.MainFormPaint);
  }
  #endregion
  void MainFormPaint(object sender, System.Windows.Forms.PaintEventArgs e)
  {
            // Get the graphics object
            Graphics gfx = e.Graphics;
            int x1 = 0;
            int y1 = 0;
            // Loop trough the 255 values red can have
            for(int i = 0; i <= 255; i++)
            {
                // Create new brush with a defined color
                Color brushColor = Color.FromArgb(i, 0, 0);
                // The brush is solid because we want a solid rectangle
                SolidBrush myBrush = new SolidBrush(brushColor);
                // Actually draw the rectangle
                gfx.FillRectangle(myBrush, x1, y1, 10, 10);
                // The next rectangle should be near the last one
                x1 = x1 + 10;
                // If the row is complete start another one
                if((x1 % 290) == 0)
                {
                    y1 = y1 + 10;
                    x1 = 0;
                }
            }
            for(int i = 0; i <= 255; i++)
            {
             Color brushColor = Color.FromArgb(0, i, 0);
             SolidBrush myBrush = new SolidBrush(brushColor);
             gfx.FillRectangle(myBrush, x1, y1, 10, 10);
             x1 = x1 + 10;
             if((x1 % 290) == 0)
             {
                 y1 = y1 + 10;
                 x1 = 0;
             }
            }
             for(int i = 0; i <= 255; i++)
             {
              Color brushColor = Color.FromArgb(0, 0, i);
              SolidBrush myBrush = new SolidBrush(brushColor);
              gfx.FillRectangle(myBrush, x1, y1, 10, 10);
              x1 = x1 + 10;
              if((x1 % 290) == 0)
              {
                  y1 = y1 + 10;
                  x1 = 0;
              }
           }
     }
 }
}


/*
 * 由 SharpDevelop .NET 免費開發工具 建立的 C# .NET 程式.
 * 作    者:
 * 建立日期: 2004/8/7
 * 建立時間: 下午 06:24
 * 功    能: 3D GDI+ Effect
 * 修改日期: 2004/8/7 下午 06:24
 */
using System;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Text;
namespace DefaultNamespace
{
 /// <summary>
 /// Description of MainForm.
 /// </summary>
 public class MainForm : System.Windows.Forms.Form
 {
  public MainForm()
  {
   //
   // The InitializeComponent() call is required for Windows Forms designer support.
   //
   InitializeComponent();

   //
   // TODO: Add constructor code after the InitializeComponent() call.
   //
  }

  [STAThread]
  public static void Main(string[] args)
  {
   Application.Run(new MainForm());
  }

  #region Windows Forms Designer generated code
  /// <summary>
  /// This method is required for Windows Forms designer support.
  /// Do not change the method contents inside the source code editor. The Forms designer might
  /// not be able to load this method if it was changed manually.
  /// </summary>
  private void InitializeComponent() {
   //
   // MainForm
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
   this.ClientSize = new System.Drawing.Size(464, 358);
   this.Name = "MainForm";
   this.Text = "MainForm";
   this.Paint += new System.Windows.Forms.PaintEventHandler(this.MainFormPaint);
  }
  #endregion

  void MainFormPaint(object sender, System.Windows.Forms.PaintEventArgs e)
  {
   // Create a pen and font
   Graphics g = e.Graphics;
   Pen blackPen = new Pen(Color.Black, 2);
   Font verdanaFont = new Font( "Verdana", 60, FontStyle.Bold);
   // Create points that define polygon.
   Point[] curvePoints1 = { new Point(200, 15),
   new Point(200, 200), new Point(375, 250) };
   Point[] curvePoints2 = { new Point(0, 250),
   new Point(200, 200), new Point(375, 250) };
   Point[] curvePoints3 = { new Point(200, 15),
   new Point(200, 200), new Point(0, 250) };
   // Create linear gradient brushes
   Point pt1 = new Point(10, 10);
   Point pt2 = new Point(30, 30);
   LinearGradientBrush lgBrush1 =
   new LinearGradientBrush(pt1, pt2, Color.Red, Color.Blue);
   LinearGradientBrush lgBrush2 =
   new LinearGradientBrush(pt1, pt2, Color.Red, Color.Green);
   LinearGradientBrush lgBrush3 =
   new LinearGradientBrush(pt1, pt2, Color.Blue, Color.Green);
   // If you want to draw three lines
   //e.Graphics.DrawLine(blackPen, 200, 55, 200, 200);
   //e.Graphics.DrawLine(blackPen, 50, 250, 200, 200);
   //e.Graphics.DrawLine(blackPen, 345, 260, 200, 200);
   // Set quality of text and shape
   g.TextRenderingHint = TextRenderingHint.AntiAlias;
   g.SmoothingMode = SmoothingMode.AntiAlias;
   // Draw three polygons and string
   e.Graphics.FillPolygon(new SolidBrush(Color.FromArgb(80, 255, 0, 0)), curvePoints1);
   e.Graphics.FillPolygon(new SolidBrush(Color.FromArgb(80, 0, 255, 0)), curvePoints2);
   e.Graphics.FillPolygon(new SolidBrush(Color.FromArgb(80, 0, 0, 255)), curvePoints3);
   // Draw C# using the DrawString method
   // Starting @ point 140, 150
   g.DrawString("C#", verdanaFont, lgBrush1, new PointF(140,150) );
   // Dispose Graphics
   g.Dispose();

  }

 }
}


/*
 * 由 SharpDevelop .NET 免費開發工具 建立的 C# .NET 程式.
 * 作    者: Administrator
 * 建立日期: 2004/8/6
 * 建立時間: 上午 01:34
 * 功    能: Charting in GDI+ with C#
 * 修改日期: 上午 01:34
 */
using System;
using System.Windows.Forms;
using System.Drawing;
namespace DefaultNamespace
{
 /// <summary>
 /// Description of MainForm.
 /// </summary>
 public class MainForm : System.Windows.Forms.Form
 {
  private System.Windows.Forms.TextBox textBox5;
  private System.Windows.Forms.TextBox textBox1;
  private System.Windows.Forms.TextBox textBox3;
  private System.Windows.Forms.TextBox textBox2;
  private System.Windows.Forms.TextBox textBox4;
  public MainForm()
  {
   //
   // The InitializeComponent() call is required for Windows Forms designer support.
   //
   InitializeComponent();

   //
   // TODO: Add constructor code after the InitializeComponent() call.
   //
  }

  [STAThread]
  public static void Main(string[] args)
  {
   Application.Run(new MainForm());
  }

  #region Windows Forms Designer generated code
  /// <summary>
  /// This method is required for Windows Forms designer support.
  /// Do not change the method contents inside the source code editor. The Forms designer might
  /// not be able to load this method if it was changed manually.
  /// </summary>
  private void InitializeComponent() {
   this.textBox4 = new System.Windows.Forms.TextBox();
   this.textBox2 = new System.Windows.Forms.TextBox();
   this.textBox3 = new System.Windows.Forms.TextBox();
   this.textBox1 = new System.Windows.Forms.TextBox();
   this.textBox5 = new System.Windows.Forms.TextBox();
   this.SuspendLayout();
   //
   // textBox4
   //
   this.textBox4.Location = new System.Drawing.Point(176, 8);
   this.textBox4.Name = "textBox4";
   this.textBox4.Size = new System.Drawing.Size(48, 22);
   this.textBox4.TabIndex = 3;
   this.textBox4.Text = "80";
   //
   // textBox2
   //
   this.textBox2.Location = new System.Drawing.Point(64, 8);
   this.textBox2.Name = "textBox2";
   this.textBox2.Size = new System.Drawing.Size(48, 22);
   this.textBox2.TabIndex = 1;
   this.textBox2.Text = "53";
   //
   // textBox3
   //
   this.textBox3.Location = new System.Drawing.Point(120, 8);
   this.textBox3.Name = "textBox3";
   this.textBox3.Size = new System.Drawing.Size(48, 22);
   this.textBox3.TabIndex = 2;
   this.textBox3.Text = "61";
   //
   // textBox1
   //
   this.textBox1.Location = new System.Drawing.Point(8, 8);
   this.textBox1.Name = "textBox1";
   this.textBox1.Size = new System.Drawing.Size(48, 22);
   this.textBox1.TabIndex = 0;
   this.textBox1.Text = "73";
   //
   // textBox5
   //
   this.textBox5.Location = new System.Drawing.Point(232, 8);
   this.textBox5.Name = "textBox5";
   this.textBox5.Size = new System.Drawing.Size(48, 22);
   this.textBox5.TabIndex = 4;
   this.textBox5.Text = "56";
   //
   // MainForm
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
   this.ClientSize = new System.Drawing.Size(292, 266);
   this.Controls.Add(this.textBox5);
   this.Controls.Add(this.textBox4);
   this.Controls.Add(this.textBox3);
   this.Controls.Add(this.textBox2);
   this.Controls.Add(this.textBox1);
   this.Name = "MainForm";
   this.Text = "MainForm";
   this.Paint += new System.Windows.Forms.PaintEventHandler(this.MainFormPaint);
   this.ResumeLayout(false);
  }
  #endregion
  void MainFormPaint(object sender, System.Windows.Forms.PaintEventArgs e)
  {
             Point[] pointarray=new Point[5];
             Random r=new Random();
             this.textBox1.Text=r.Next(100).ToString();
             this.textBox2.Text=r.Next(100).ToString();
             this.textBox3.Text=r.Next(100).ToString();
             this.textBox4.Text=r.Next(100).ToString();
             this.textBox5.Text=r.Next(100).ToString();
             float a=Convert.ToInt32(this.textBox1.Text.ToString());
             a=a*3;
             a=a/2;
             a=150-a;
             float b=Convert.ToInt32(this.textBox2.Text.ToString());
             b=b*3;
             b=b/2;
             b=150-b;
             float c=Convert.ToInt32(this.textBox3.Text.ToString());
             c=c*3;
             c=c/2;
             c=150-c;
             float d=Convert.ToInt32(this.textBox4.Text.ToString());
             d=d*3;
             d=d/2;
             d=150-d;
             float f=Convert.ToInt32(this.textBox5.Text.ToString());
             f=f*3;
             f=f/2;
             f=150-f;
             Pen newpen = new Pen(Color.Black);
             Graphics g=Graphics.FromHwnd(this.Handle);
             //Set point of origin to be 50,50 on the form
             g.TranslateTransform(50,50);
             g.DrawLine(newpen,1,1,1,150);
             g.DrawLine(newpen,1,150,150,150);
             //Draw X and y axis
             g.DrawLine(newpen,-3,30,3,30);
             g.DrawLine(newpen,-3,60,3,60);
             g.DrawLine(newpen,-3,90,3,90);
             g.DrawLine(newpen,-3,120,3,120);
             g.DrawLine(newpen,30,147,30,153);
             g.DrawLine(newpen,60,147,60,153);
             g.DrawLine(newpen,90,147,90,153);
             g.DrawLine(newpen,120,147,120,153);
             g.DrawLine(newpen,150,147,150,153);
             Font newfont=new Font("Arial",10);
             //label Y axis
             g.DrawString("100",newfont,new SolidBrush(Color.Black),-25,-5);
             g.DrawString("80",newfont,new SolidBrush(Color.Black),-25,25);
             g.DrawString("60",newfont,new SolidBrush(Color.Black),-25,55);
             g.DrawString("40",newfont,new SolidBrush(Color.Black),-25,85);
             g.DrawString("20",newfont,new SolidBrush(Color.Black),-25,115);

             //Label X axis
             g.DrawString("0",newfont,new SolidBrush(Color.Black),-10,145);
             g.DrawString("p1",newfont,new SolidBrush(Color.Black),25,155);
             g.DrawString("p2",newfont,new SolidBrush(Color.Black),55,155);
             g.DrawString("p3",newfont,new SolidBrush(Color.Black),85,155);
             g.DrawString("p4",newfont,new SolidBrush(Color.Black),115,155);
             g.DrawString("p5",newfont,new SolidBrush(Color.Black),145,155);
             //Plot points
             g.DrawEllipse(new Pen(Color.Blue),30-2,a-2,4,4);
             g.DrawEllipse(new Pen(Color.Red),60-2,b-2,4,4);
             g.DrawEllipse(new Pen(Color.Green),90-2,c-2,4,4);
             g.DrawEllipse(new Pen(Color.Black),120-2,d-2,4,4);
             g.DrawEllipse(new Pen(Color.Gold),150-2,f-2,4,4);
             //Join the points
             pointarray[0]=new Point(30,Convert.ToInt32(a));
             pointarray[1]=new Point(60,Convert.ToInt32(b));
             pointarray[2]=new Point(90,Convert.ToInt32(c));
             pointarray[3]=new Point(120,Convert.ToInt32(d));
             pointarray[4]=new Point(150,Convert.ToInt32(f));
             g.DrawLines(new Pen(Color.DarkSalmon),pointarray);
     }

 }
}


使用GDI+做螢幕抓圖
/*
* Created by SharpDevelop.
* User: Administrator
* Date: 2004/8/30
* Time: 下午 02:32
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
namespace ScreenCapture
{
///
<summary>
/// Description of MainForm.
///
</summary>
public class MainForm :
System.Windows.Forms.Form
{
private
System.Windows.Forms.Button button1;
public
MainForm()
{
//
// The
InitializeComponent() call is required for Windows Forms designer
support.
//
InitializeComponent();

//
//
TODO: Add constructor code after the InitializeComponent()
call.
//
}

[STAThread]
public
static void Main(string[]
args)
{
Application.Run(new
MainForm());
}

#region Windows
Forms Designer generated code
///
<summary>
/// This method is required for Windows Forms
designer support.
/// Do not change the method contents inside
the source code editor. The Forms designer might
/// not be able
to load this method if it was changed manually.
///
</summary>
private void InitializeComponent()
{
this.button1 = new
System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(192,
168);
this.button1.Name =
"button1";
this.button1.TabIndex =
0;
this.button1.Text =
"button1";
this.button1.Click += new
System.EventHandler(this.Button1Click);
//
// MainForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5,
15);
this.ClientSize = new System.Drawing.Size(292,
266);
this.Controls.Add(this.button1);
this.Name
= "MainForm";
this.Text =
"MainForm";
this.ResumeLayout(false);
}
#endregion

//============================呼叫系統DLL================
class GDI32
{
[DllImport("GDI32.dll")]
public static extern
bool BitBlt(int hdcDest,int nXDest,int
nYDest,
int nWidth,int nHeight,int
hdcSrc,
int nXSrc,int nYSrc,int dwRop);
[DllImport("GDI32.dll")]
public static extern
int CreateCompatibleBitmap(int hdc,int nWidth,
int nHeight);
[DllImport("GDI32.dll")]
public static extern
int CreateCompatibleDC(int hdc);
[DllImport("GDI32.dll")]
public static extern
bool DeleteDC(int hdc);
[DllImport("GDI32.dll")]
public static extern
bool DeleteObject(int hObject);
[DllImport("GDI32.dll")]
public static extern
int GetDeviceCaps(int hdc,int nIndex);
[DllImport("GDI32.dll")]
public static extern
int SelectObject(int hdc,int hgdiobj);
}
class
User32
{
[DllImport("User32.dll")]
public static extern
int GetDesktopWindow();
[DllImport("User32.dll")]
public static extern
int GetWindowDC(int hWnd);
[DllImport("User32.dll")]
public static extern
int ReleaseDC(int hWnd,int hDC);
}
//============================應用========================
public void CaptureScreen(string
fileName,ImageFormat imageFormat)
{
int hdcSrc =
User32.GetWindowDC(User32.GetDesktopWindow()),
hdcDest =
GDI32.CreateCompatibleDC(hdcSrc),
hBitmap =
GDI32.CreateCompatibleBitmap(hdcSrc,
GDI32.GetDeviceCaps(hdcSrc,8),GDI32.GetDeviceCaps(hdcSrc,10));
GDI32.SelectObject(hdcDest,hBitmap);
GDI32.BitBlt(hdcDest,0,0,GDI32.GetDeviceCaps(hdcSrc,8),
GDI32.GetDeviceCaps(hdcSrc,10),
hdcSrc,0,0,0x00CC0020);
SaveImageAs(hBitmap,fileName,imageFormat);
Cleanup(hBitmap,hdcSrc,hdcDest);
}

private void
Cleanup(int hBitmap,int hdcSrc,int
hdcDest)
{
User32.ReleaseDC(User32.GetDesktopWindow(),hdcSrc);
GDI32.DeleteDC(hdcDest);
GDI32.DeleteObject(hBitmap);
}
private void SaveImageAs(int hBitmap,string fileName,ImageFormat imageFormat)
{
Bitmap image =
new Bitmap(Image.FromHbitmap(new IntPtr(hBitmap)),
Image.FromHbitmap(new IntPtr(hBitmap)).Width,
Image.FromHbitmap(new IntPtr(hBitmap)).Height);
image.Save(fileName,imageFormat);
}

void Button1Click(object sender, System.EventArgs e)
{
CaptureScreen("c:\\qoo.bmp",ImageFormat.Bmp);
}
}
}


簡單動畫
/*
* Created by SharpDevelop.
* User: Administrator
* Date: 2004/8/30
* Time: 下午 06:53
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace Animated
{
///
<summary>
/// Description of MainForm.
///
</summary>
public class MainForm :
System.Windows.Forms.Form
{
private
System.ComponentModel.IContainer components;
private
System.Windows.Forms.PictureBox pictureBox1;
private
System.Windows.Forms.Timer timer1;
private int
curFrame=0;

public
MainForm()
{
//
// The
InitializeComponent() call is required for Windows Forms designer
support.
//
InitializeComponent();

//
//
TODO: Add constructor code after the InitializeComponent()
call.
//
SetStyle(ControlStyles.UserPaint,
true);
SetStyle(ControlStyles.AllPaintingInWmPaint,
true);
SetStyle(ControlStyles.DoubleBuffer,
true);
}

[STAThread]
public
static void Main(string[]
args)
{
Application.Run(new
MainForm());
}

#region Windows
Forms Designer generated code
///
<summary>
/// This method is required for Windows Forms
designer support.
/// Do not change the method contents inside
the source code editor. The Forms designer might
/// not be able
to load this method if it was changed manually.
///
</summary>
private void InitializeComponent()
{
this.components = new
System.ComponentModel.Container();
System.Resources.ResourceManager
resources = new
System.Resources.ResourceManager(typeof(MainForm));
this.timer1
= new
System.Windows.Forms.Timer(this.components);
this.pictureBox1
= new
System.Windows.Forms.PictureBox();
this.SuspendLayout();
//
// timer1
//
this.timer1.Enabled =
true;
this.timer1.Interval =
1000;
this.timer1.Tick += new
System.EventHandler(this.Timer1Tick);
//
// pictureBox1
//
this.pictureBox1.Image =
((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));//載入GIF檔
this.pictureBox1.Location
= new System.Drawing.Point(24, 32);
this.pictureBox1.Name =
"pictureBox1";
this.pictureBox1.Size = new
System.Drawing.Size(96, 104);
this.pictureBox1.TabIndex =
0;
this.pictureBox1.TabStop =
false;
this.pictureBox1.Visible =
false;
//
//
MainForm
//
this.AutoScaleBaseSize =
new System.Drawing.Size(5, 15);
this.ClientSize = new
System.Drawing.Size(292,
266);
this.Controls.Add(this.pictureBox1);
this.Name
= "MainForm";
this.Text =
"MainForm";
this.Paint += new
System.Windows.Forms.PaintEventHandler(this.MainFormPaint);
this.ResumeLayout(false);
}
#endregion
void MainFormPaint(object sender,
System.Windows.Forms.PaintEventArgs
e)
{
Graphics
g=e.Graphics;
int
frames=pictureBox1.Image.GetFrameCount(FrameDimension.Time);
curFrame++;
if(curFrame>=frames)
curFrame=0;
pictureBox1.Image.SelectActiveFrame(FrameDimension.Time,
curFrame);
g.DrawImage(pictureBox1.Image,
this.ClientRectangle);
Invalidate();
}

void
Timer1Tick(object sender, System.EventArgs
e)
{
framesPerSecondCount=0;
}

}
}


FormChart.Net Version 1.0
(With Complete Dessign Time Support)

Download Component

Download Sample Project
Installation and Setup Instructions

What is FormChart.Net?

FormChart.Net is a custom user control library that you can use on Windows Forms to render your data in the sahpe of charts or graphs. Last month we release our ASPChart.Net library for drawing graphs and charts. The same library acts as the drawing engine for this custom user control.

What Functionlaity Is Supported In Current Version?

As it has been mentioned earlier that this component is based on ASPChart.Net engine, it supports all the features of that library. But we have taken that library to a higher level. This control provides you complete design time support. Following are some of the highlights of this control library.

  • Ability to add the control library to Visual Studio .Net IDE Toolbox
  • Drag and drop of controls from toolbox onto Windows Form designer
  • Complete design time support. This helps in cutting down your development time by making you type less code.
  • WYSIWYG (What you see is what you get) features let you specify all the appearnace and alignment attributes right from the Properties view of IDE.

Where Can I User It?

The control has infinite possibilites. You can use it anywhere where you need to display the information as Pie Charts, Bar Charts, Line Graphs, etc.

How to install it?

We have created a install document. You can download it from our web site and follow it step by step to get going.

How to use it?

The control is very easy to use like any other .Net windows controls. Drag and drop the control onto Windows Forms designer, modify the properties to specify the appearance and alignment you want. And the necessary code will be added to your CS or VB file.

After you have completed the initial step. There are two more steps that are needed. Without this control will not function.

  • The control accepts the data as an XML document. In the current version of control we don't have support for DataBinding. This support will be added in next version. For now you will need to create the XML document and load it in control.
  • The control gives you ability to select option to specify if you want to use random colors generated by ASPChart.Net drawing engine or you want to specify your own list of colors. If you select Random Color generation, then you don't need to perform any more steps. Otherwise, create a StringCollection object containing string representation of KnownColor values. And set to Colors property of this control.

The following code demonstrates the steps we discissed above. For more details, look at the source code of the attached WinChartApp project.

public ChartForm()
{
    InitializeComponent();
    barChart2DControl1.LoadData(this.CreateChartData());

    if (!barChart2DControl1.UseRandomColors)
    {
        barChart2DControl1.Colors = this.CreateColorNames();
    }
}

public XmlDocument CreateChartData()
{
    XmlDocument obXmlDoc = new XmlDocument();
    obXmlDoc.Load("BarChartData.xml");
    return obXmlDoc;
}

private StringCollection CreateColorNames()
{
    StringCollection obColorNames = new StringCollection();
    obColorNames.Add("Red");
    obColorNames.Add("Blue");
    obColorNames.Add("Black");
    obColorNames.Add("Pink");
    obColorNames.Add("Khaki");
    obColorNames.Add("Green");
    obColorNames.Add("Gray");
    obColorNames.Add("Beige");
    obColorNames.Add("Purple");
    obColorNames.Add("Yellow");
    return obColorNames;
}


CsGL (C sharp Graphics Library)
網址：http://csgl.sourceforge.net/

Features

CsGL (C sharp Graphics Library) implements a wrapper for the quite well known and powerful C-library OpenGL allowing any .NET language make use of it.
It feature:
  • OpenGL 1.4 API and this list of extension
  • an extension "generator" in <csgl>/extras/generator/generator.exe.
  • a font "engine", the CsGL.OpenGL.GDITextureFont. Demonstrated in the <csgl>/examples/CS/gdifont.cs
  • mouse and keyboard classes (CsGL.Util.Mouse & CsGL.Util.Keyboard) for simplified event management. Demonstrated in <csgl>/examples/CS/event.cs
  • a fullscreen window, able to change screen definition (CsGL.Util.ScreenForm). Demonstrated in the CsGLExamples.


Windows MediaPlayer操作範例-收音機製作
(Windows MediaPlayer 9採用非視覺方式製作-加入「參考」方式)
程式碼如下：
/*
 * 由 SharpDevelop .NET 免費開發工具 建立的 C# .NET 程式.
 * 作    者:
 * 建立日期: 2004/8/25
 * 建立時間: 下午 08:05
 * 功    能:
 * 修改日期: 2004/8/25 下午 08:05
 */
using System;
using System.Windows.Forms;
using System.ComponentModel;
using WMPLib;
namespace DefaultNamespace
{
 /// <summary>
 /// Description of MainForm.
 /// </summary>
 public class MainForm : System.Windows.Forms.Form
 {
  private ColorButton.ColorButton colorButton2;
  private ColorButton.ColorButton colorButton1;
  private System.Windows.Forms.ListBox listBox1;
  private WMPLib.WindowsMediaPlayer Paly=new WindowsMediaPlayer();
  private System.ComponentModel.Container components = null;
  public MainForm()
  {
   //
   // The InitializeComponent() call is required for Windows Forms designer support.
   //
   InitializeComponent();

   //
   // TODO: Add constructor code after the InitializeComponent() call.
   //
  }

  [STAThread]
  public static void Main(string[] args)
  {
   Application.Run(new MainForm());
  }
  /// <summary>
  /// 記憶體釋放
  /// </summary>
  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
     if (components != null)
     {
      components.Dispose();
     }
   }
   base.Dispose( disposing );
  }

  #region Windows Forms Designer generated code
  /// <summary>
  /// This method is required for Windows Forms designer support.
  /// Do not change the method contents inside the source code editor. The Forms designer might
  /// not be able to load this method if it was changed manually.
  /// </summary>
  private void InitializeComponent() {
   this.listBox1 = new System.Windows.Forms.ListBox();
   this.colorButton1 = new ColorButton.ColorButton();
   this.colorButton2 = new ColorButton.ColorButton();
   this.SuspendLayout();
   //
   // listBox1
   //
   this.listBox1.ItemHeight = 12;
   this.listBox1.Items.AddRange(new object[] {
      "mms://live.media.hinet.net/UFO_Music1",
      "mms://live.media.hinet.net/kissradio ",
      "mms://live.media.hinet.net/vot "});
   this.listBox1.Location = new System.Drawing.Point(8, 8);
   this.listBox1.Name = "listBox1";
   this.listBox1.Size = new System.Drawing.Size(272, 64);
   this.listBox1.TabIndex = 1;
   this.listBox1.Click += new System.EventHandler(this.listBox1Click);
   //
   // colorButton1
   //
   this.colorButton1.Active = true;
   this.colorButton1.ButtonStyle = ColorButton.ColorButton.ButtonStyles.Rectangle;
   this.colorButton1.Font = new System.Drawing.Font("Verdana", 10F, System.Drawing.FontStyle.Bold);
   this.colorButton1.GradientStyle = ColorButton.ColorButton.GradientStyles.Vertical;
   this.colorButton1.HoverBorderColor = System.Drawing.Color.MediumVioletRed;
   this.colorButton1.HoverColorA = System.Drawing.Color.MediumVioletRed;
   this.colorButton1.HoverColorB = System.Drawing.Color.White;
   this.colorButton1.Location = new System.Drawing.Point(8, 80);
   this.colorButton1.Name = "colorButton1";
   this.colorButton1.NormalBorderColor = System.Drawing.Color.Green;
   this.colorButton1.NormalColorA = System.Drawing.Color.Green;
   this.colorButton1.NormalColorB = System.Drawing.Color.Honeydew;
   this.colorButton1.Size = new System.Drawing.Size(64, 32);
   this.colorButton1.SmoothingQuality = ColorButton.ColorButton.SmoothingQualities.AntiAlias;
   this.colorButton1.TabIndex = 2;
   this.colorButton1.Text = "播放";
   this.colorButton1.Click += new System.EventHandler(this.ColorButton1Click);
   //
   // colorButton2
   //
   this.colorButton2.Active = true;
   this.colorButton2.ButtonStyle = ColorButton.ColorButton.ButtonStyles.Rectangle;
   this.colorButton2.Font = new System.Drawing.Font("Verdana", 10F, System.Drawing.FontStyle.Bold);
   this.colorButton2.GradientStyle = ColorButton.ColorButton.GradientStyles.Vertical;
   this.colorButton2.HoverBorderColor = System.Drawing.Color.MediumVioletRed;
   this.colorButton2.HoverColorA = System.Drawing.Color.MediumVioletRed;
   this.colorButton2.HoverColorB = System.Drawing.Color.White;
   this.colorButton2.Location = new System.Drawing.Point(80, 80);
   this.colorButton2.Name = "colorButton2";
   this.colorButton2.NormalBorderColor = System.Drawing.Color.Green;
   this.colorButton2.NormalColorA = System.Drawing.Color.Green;
   this.colorButton2.NormalColorB = System.Drawing.Color.Honeydew;
   this.colorButton2.Size = new System.Drawing.Size(64, 32);
   this.colorButton2.SmoothingQuality = ColorButton.ColorButton.SmoothingQualities.AntiAlias;
   this.colorButton2.TabIndex = 3;
   this.colorButton2.Text = "停止";
   this.colorButton2.Click += new System.EventHandler(this.ColorButton2Click);
   //
   // MainForm
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
   this.ClientSize = new System.Drawing.Size(296, 126);
   this.Controls.Add(this.colorButton2);
   this.Controls.Add(this.colorButton1);
   this.Controls.Add(this.listBox1);
   this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
   this.MaximizeBox = false;
   this.Name = "MainForm";
   this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
   this.Text = "簡易收音機";
   this.ResumeLayout(false);
  }
  #endregion

  void listBox1Click(object sender, System.EventArgs e)
  {
    Paly.URL=listBox1.SelectedItem.ToString();
  }

  void ColorButton1Click(object sender, System.EventArgs e)
  {
      if (listBox1.SelectedItem.ToString().Length>0)
   {
    Paly.controls.play();
   }
  }

  void ColorButton2Click(object sender, System.EventArgs e)
  {
   Paly.controls.stop();
  }

 }
}


/*
 * 由 SharpDevelop .NET 免費開發工具 建立的 C# .NET 程式.
 * 作    者:
 * 建立日期: 2004/8/25
 * 建立時間: 下午 11:56
 * 功    能: axWebBrowser基本瀏覽器製作
 * 修改日期: 2004/8/25 下午 11:56
 */
using System;
using System.Windows.Forms;
namespace DefaultNamespace
{
///
<summary>
/// Description of MainForm.
///
</summary>
public class MainForm :
System.Windows.Forms.Form
{
private
System.Windows.Forms.Button button3;
private
System.Windows.Forms.Button button2;
private
System.Windows.Forms.Button button1;
private
AxSHDocVw.AxWebBrowser axWebBrowser1;
private
System.Windows.Forms.Button button5;
private
System.Windows.Forms.Button button4;
private
System.Windows.Forms.Panel panel1;
private
System.Windows.Forms.TextBox textBox1;
public
MainForm()
{
//
// The
InitializeComponent() call is required for Windows Forms designer
support.
//
InitializeComponent();

//
//
TODO: Add constructor code after the InitializeComponent()
call.
//
}

[STAThread]
public
static void Main(string[]
args)
{
Application.Run(new
MainForm());
}

#region Windows
Forms Designer generated code
///
<summary>
/// This method is required for Windows Forms
designer support.
/// Do not change the method contents inside
the source code editor. The Forms designer might
/// not be able
to load this method if it was changed manually.
///
</summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(MainForm));
this.textBox1
= new System.Windows.Forms.TextBox();
this.panel1 = new
System.Windows.Forms.Panel();
this.button4 = new
System.Windows.Forms.Button();
this.button5 = new
System.Windows.Forms.Button();
this.axWebBrowser1 = new
AxSHDocVw.AxWebBrowser();
this.button1 = new
System.Windows.Forms.Button();
this.button2 = new
System.Windows.Forms.Button();
this.button3 = new
System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).BeginInit();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(0,
0);
this.textBox1.Name =
"textBox1";
this.textBox1.Size = new
System.Drawing.Size(528, 22);
this.textBox1.TabIndex =
1;
this.textBox1.Text = " http://tw.yahoo.com ";
//
//
panel1
//
this.panel1.Dock =
System.Windows.Forms.DockStyle.Top;
this.panel1.Location =
new System.Drawing.Point(0, 0);
this.panel1.Name =
"panel1";
this.panel1.Size = new System.Drawing.Size(600,
64);
this.panel1.TabIndex = 7;
//
// button4
//
this.button4.FlatStyle =
System.Windows.Forms.FlatStyle.System;
this.button4.Location
= new System.Drawing.Point(168, 32);
this.button4.Name =
"button4";
this.button4.TabIndex =
5;
this.button4.Text =
"首頁";
this.button4.Click += new
System.EventHandler(this.Button4Click);
//
// button5
//
this.button5.FlatStyle =
System.Windows.Forms.FlatStyle.System;
this.button5.Location
= new System.Drawing.Point(248, 32);
this.button5.Name =
"button5";
this.button5.TabIndex =
6;
this.button5.Text =
"搜尋";
this.button5.Click += new
System.EventHandler(this.Button5Click);
//
// axWebBrowser1
//
this.axWebBrowser1.Dock =
System.Windows.Forms.DockStyle.Fill;
this.axWebBrowser1.Enabled
= true;
this.axWebBrowser1.Location = new
System.Drawing.Point(0, 64);
this.axWebBrowser1.OcxState =
((System.Windows.Forms.AxHost.State)(resources.GetObject("axWebBrowser1.OcxState")));
this.axWebBrowser1.Size
= new System.Drawing.Size(600,
278);
this.axWebBrowser1.TabIndex =
0;
//
//
button1
//
this.button1.FlatStyle =
System.Windows.Forms.FlatStyle.System;
this.button1.Location
= new System.Drawing.Point(536, 0);
this.button1.Name =
"button1";
this.button1.Size = new System.Drawing.Size(56,
24);
this.button1.TabIndex =
2;
this.button1.Text =
"GO";
this.button1.Click += new
System.EventHandler(this.Button1Click);
//
// button2
//
this.button2.FlatStyle =
System.Windows.Forms.FlatStyle.System;
this.button2.Location
= new System.Drawing.Point(8, 32);
this.button2.Name =
"button2";
this.button2.TabIndex =
3;
this.button2.Text =
"上一頁";
this.button2.Click += new
System.EventHandler(this.Button2Click);
//
// button3
//
this.button3.FlatStyle =
System.Windows.Forms.FlatStyle.System;
this.button3.Location
= new System.Drawing.Point(88, 32);
this.button3.Name =
"button3";
this.button3.TabIndex =
4;
this.button3.Text =
"下一頁";
this.button3.Click += new
System.EventHandler(this.Button3Click);
//
// MainForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5,
15);
this.ClientSize = new System.Drawing.Size(600,
342);
this.Controls.Add(this.button5);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.axWebBrowser1);
this.Controls.Add(this.panel1);
this.Name
= "MainForm";
this.Text =
"MainForm";
((System.ComponentModel.ISupportInitialize)(this.axWebBrowser1)).EndInit();
this.ResumeLayout(false);
}
#endregion

  //首頁
  void Button4Click(object sender, System.EventArgs e)
  {
   axWebBrowser1.GoHome();
  }
//上一頁
void Button2Click(object sender,
System.EventArgs
e)
{
try
{
axWebBrowser1.GoBack();
}
catch(Exception
ee)
{
MessageBox.Show("訊息:"+ee.Message.ToString());
}
}

  //開啟網址
  void Button1Click(object sender, System.EventArgs e)
  {
   object oNull = null;
   axWebBrowser1.Navigate(textBox1.Text,ref oNull, ref oNull,ref oNull,ref oNull);
  }
//下一頁
void Button3Click(object sender,
System.EventArgs
e)
{
try
{
axWebBrowser1.GoForward();
}
catch(Exception
ee)
{
MessageBox.Show("訊息:"+ee.Message.ToString());
}
}
//搜尋
void Button5Click(object sender,
System.EventArgs
e)
{
axWebBrowser1.GoSearch();
}

}
}


寄信程式
在.NET中發送郵件需要什麼？ 首先，也是最重要的，需要安裝.NET Framework。
其次需要引用System.Web.dll（ASP.NET應用程式已經自動包含了）。
接著需要引用System.Web.Main命名空間，以便建立和發送email信息。

因為SWM只是簡單的封裝了兩個COM庫：CDONTS.NewMail（可以在cdonts.dll中找到）
和CDO.Message（可以在cdosys.dll中找到），因此伺服器上同樣也需要他們。
如果使用NT4或Win9x，cdonts.dll會隨著NT4的Option Pack或者Personal webserver一起安裝。
預設情況cdosys.dll已經安裝在Windows 2003和Windows XP中了，
同樣安裝Microsoft Office也會安裝cdosys.dll

使用SWM發送郵件時，你需要一個轉發伺服器。
轉發伺服器就是一個郵件伺服器或者一個SMTP伺服器/服務，它可以發送郵件。
SWM簡單的發送郵件到轉發伺服器，轉發伺服器負責傳送到最終目的地。
程式碼如下：
//
// Created by SharpDevelop.
// User: Administrator
// Date: 2004/7/31
// Time: 下午 11:19
//
// To change this template use Tools | Options | Coding | Edit Standard Headers.
//
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Web.Mail;
namespace DefaultNamespace
{
 public class MainForm : System.Windows.Forms.Form
 {
  private System.Windows.Forms.Button button2;
  private System.Windows.Forms.Button button1;
  private System.Windows.Forms.MenuItem menuItem7;
  private System.Windows.Forms.TextBox textBox4;
  private System.Windows.Forms.MenuItem menuItem3;
  private System.Windows.Forms.MenuItem menuItem2;
  private System.Windows.Forms.MenuItem menuItem1;
  private System.Windows.Forms.MenuItem menuItem6;
  private System.Windows.Forms.MenuItem menuItem5;
  private System.Windows.Forms.MenuItem menuItem4;
  private System.Windows.Forms.ContextMenu contextMenu1;
  private System.Windows.Forms.Label label3;
  private System.Windows.Forms.Label label2;
  private System.Windows.Forms.Label label1;
  private System.Windows.Forms.RichTextBox richTextBox1;
  private System.Windows.Forms.Label label5;
  private System.Windows.Forms.Label label4;
  private System.Windows.Forms.TextBox textBox1;
  private System.Windows.Forms.TextBox textBox3;
  private System.Windows.Forms.TextBox textBox2;
  public static void Main()
  {
   MainForm fMainForm = new MainForm();
   fMainForm.ShowDialog();
  }
#region Windows Forms Designer generated code
  // This method is required for Windows Forms designer support.
  // Do not change the method contents inside the source code editor. The Forms designer might
  // not be able to load this method if it was changed manually.
  public MainForm()
  {
   base.New();
   //
   // The Me.InitializeComponent call is required for Windows Forms designer support.
   //
   this.InitializeComponent();
   //
   // TODO : Add constructor code after InitializeComponents
   //
  }
  private void InitializeComponent()
  {
   this.textBox2 = new System.Windows.Forms.TextBox();
   this.textBox3 = new System.Windows.Forms.TextBox();
   this.textBox1 = new System.Windows.Forms.TextBox();
   this.label4 = new System.Windows.Forms.Label();
   this.label5 = new System.Windows.Forms.Label();
   this.richTextBox1 = new System.Windows.Forms.RichTextBox();
   this.label1 = new System.Windows.Forms.Label();
   this.label2 = new System.Windows.Forms.Label();
   this.label3 = new System.Windows.Forms.Label();
   this.contextMenu1 = new System.Windows.Forms.ContextMenu();
   this.menuItem4 = new System.Windows.Forms.MenuItem();
   this.menuItem5 = new System.Windows.Forms.MenuItem();
   this.menuItem6 = new System.Windows.Forms.MenuItem();
   this.menuItem1 = new System.Windows.Forms.MenuItem();
   this.menuItem2 = new System.Windows.Forms.MenuItem();
   this.menuItem3 = new System.Windows.Forms.MenuItem();
   this.textBox4 = new System.Windows.Forms.TextBox();
   this.menuItem7 = new System.Windows.Forms.MenuItem();
   this.button1 = new System.Windows.Forms.Button();
   this.button2 = new System.Windows.Forms.Button();
   this.SuspendLayout();
   //
   //textBox2
   //
   this.textBox2.BackColor = System.Drawing.SystemColors.Info;
   this.textBox2.Location = new System.Drawing.Point(104, 32);
   this.textBox2.Name = "textBox2";
   this.textBox2.Size = new System.Drawing.Size(160, 22);
   this.textBox2.TabIndex = 7;
   this.textBox2.Text = "";
   //
   //textBox3
   //
   this.textBox3.Location = new System.Drawing.Point(104, 57);
   this.textBox3.Name = "textBox3";
   this.textBox3.Size = new System.Drawing.Size(160, 22);
   this.textBox3.TabIndex = 8;
   this.textBox3.Text = "";
   //
   //textBox1
   //
   this.textBox1.BackColor = System.Drawing.SystemColors.Info;
   this.textBox1.Location = new System.Drawing.Point(104, 7);
   this.textBox1.Name = "textBox1";
   this.textBox1.Size = new System.Drawing.Size(128, 22);
   this.textBox1.TabIndex = 6;
   this.textBox1.Text = "";
   //
   //label4
   //
   this.label4.ForeColor = System.Drawing.SystemColors.ActiveCaption;
   this.label4.Location = new System.Drawing.Point(44, 87);
   this.label4.Name = "label4";
   this.label4.Size = new System.Drawing.Size(56, 16);
   this.label4.TabIndex = 4;
   this.label4.Text = "信件主旨";
   //
   //label5
   //
   this.label5.ForeColor = System.Drawing.SystemColors.ActiveCaption;
   this.label5.Location = new System.Drawing.Point(44, 112);
   this.label5.Name = "label5";
   this.label5.Size = new System.Drawing.Size(56, 16);
   this.label5.TabIndex = 5;
   this.label5.Text = "信件內容";
   //
   //richTextBox1
   //
   this.richTextBox1.ContextMenu = this.contextMenu1;
   this.richTextBox1.Location = new System.Drawing.Point(104, 112);
   this.richTextBox1.Name = "richTextBox1";
   this.richTextBox1.Size = new System.Drawing.Size(512, 200);
   this.richTextBox1.TabIndex = 10;
   this.richTextBox1.Text = "";
   //
   //label1
   //
   this.label1.ForeColor = System.Drawing.Color.Red;
   this.label1.Location = new System.Drawing.Point(9, 12);
   this.label1.Name = "label1";
   this.label1.Size = new System.Drawing.Size(96, 16);
   this.label1.TabIndex = 1;
   this.label1.Text = "郵件伺服器位置";
   //
   //label2
   //
   this.label2.ForeColor = System.Drawing.Color.Red;
   this.label2.Location = new System.Drawing.Point(32, 37);
   this.label2.Name = "label2";
   this.label2.Size = new System.Drawing.Size(72, 16);
   this.label2.TabIndex = 2;
   this.label2.Text = "寄件者信箱";
   //
   //label3
   //
   this.label3.ForeColor = System.Drawing.SystemColors.ActiveCaption;
   this.label3.Location = new System.Drawing.Point(32, 63);
   this.label3.Name = "label3";
   this.label3.Size = new System.Drawing.Size(88, 16);
   this.label3.TabIndex = 3;
   this.label3.Text = "收件者信箱";
   //
   //contextMenu1
   //
   this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {this.menuItem1, this.menuItem2, this.menuItem3, this.menuItem4, this.menuItem5, this.menuItem6, this.menuItem7});
   //
   //menuItem4
   //
   this.menuItem4.Index = 3;
   this.menuItem4.Text = "複製";
   this.menuItem4.Click += new System.EventHandler(this.MenuItem4Click);
   //
   //menuItem5
   //
   this.menuItem5.Index = 4;
   this.menuItem5.Text = "貼上";
   this.menuItem5.Click += new System.EventHandler(this.MenuItem5Click);
   //
   //menuItem6
   //
   this.menuItem6.Index = 5;
   this.menuItem6.Text = "-";
   //
   //menuItem1
   //
   this.menuItem1.Index = 0;
   this.menuItem1.Text = "復原";
   this.menuItem1.Click += new System.EventHandler(this.MenuItem1Click);
   //
   //menuItem2
   //
   this.menuItem2.Index = 1;
   this.menuItem2.Text = "-";
   //
   //menuItem3
   //
   this.menuItem3.Index = 2;
   this.menuItem3.Text = "剪下";
   this.menuItem3.Click += new System.EventHandler(this.MenuItem3Click);
   //
   //textBox4
   //
   this.textBox4.Location = new System.Drawing.Point(104, 83);
   this.textBox4.Name = "textBox4";
   this.textBox4.Size = new System.Drawing.Size(280, 22);
   this.textBox4.TabIndex = 9;
   this.textBox4.Text = "";
   //
   //menuItem7
   //
   this.menuItem7.Index = 6;
   this.menuItem7.Text = "全選";
   this.menuItem7.Click += new System.EventHandler(this.MenuItem7Click);
   //
   //button1
   //
   this.button1.BackColor = System.Drawing.Color.Gray;
   this.button1.Cursor = System.Windows.Forms.Cursors.Hand;
   this.button1.Font = new System.Drawing.Font("新細明體", 9.75, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)136));
   this.button1.ForeColor = System.Drawing.Color.White;
   this.button1.Location = new System.Drawing.Point(392, 320);
   this.button1.Name = "button1";
   this.button1.Size = new System.Drawing.Size(224, 32);
   this.button1.TabIndex = 0;
   this.button1.Text = "立刻傳送郵件...";
   this.button1.Click += new System.EventHandler(this.Button1Click);
   //
   //button2
   //
   this.button2.BackColor = System.Drawing.Color.Red;
   this.button2.Cursor = System.Windows.Forms.Cursors.Hand;
   this.button2.ForeColor = System.Drawing.Color.White;
   this.button2.Location = new System.Drawing.Point(528, 80);
   this.button2.Name = "button2";
   this.button2.Size = new System.Drawing.Size(80, 24);
   this.button2.TabIndex = 11;
   this.button2.Text = "重寫";
   this.button2.Click += new System.EventHandler(this.Button2Click);
   //
   //MainForm
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
   this.BackColor = System.Drawing.Color.Wheat;
   this.ClientSize = new System.Drawing.Size(624, 358);
   this.Controls.Add(this.button2);
   this.Controls.Add(this.richTextBox1);
   this.Controls.Add(this.textBox4);
   this.Controls.Add(this.textBox3);
   this.Controls.Add(this.textBox2);
   this.Controls.Add(this.textBox1);
   this.Controls.Add(this.label5);
   this.Controls.Add(this.label4);
   this.Controls.Add(this.label3);
   this.Controls.Add(this.label2);
   this.Controls.Add(this.label1);
   this.Controls.Add(this.button1);
   this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
   this.MaximizeBox = false;
   this.Name = "MainForm";
   this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
   this.Text = "寄信程式 .NET版";
   this.ResumeLayout(false);
  }
#endregion
  private void Button1Click(object sender, System.EventArgs e)
  {
   MailMessage oMail = new MailMessage();
   // 指定SMTP-Server
   SmtpMail.SmtpServer = textBox1.text;
   // 寄件者信箱
   oMail.From = textBox2.text;
   // 收件者信箱
   oMail.To = textBox3.text;
   // 信件主旨
   oMail.Subject = textBox4.text;
   // 信件內容
   oMail.Body = richTextBox1.Text;
   // 附加檔案
   // .Attachments.Add(New MailAttachment("檔案名稱"))
   try {
    SmtpMail.Send(oMail);
    MessageBox.show("傳送完成！");
   } catch (Exception oEx) {
    MessageBox.show("傳送失敗原因：" + oEx.Message.ToString);
   }
  }
  private void Button2Click(object sender, System.EventArgs e)
  {
   richTextBox1.Clear();
  }
  private void MenuItem1Click(object sender, System.EventArgs e)
  {
   richTextBox1.Undo();
  }
  private void MenuItem3Click(object sender, System.EventArgs e)
  {
   richTextBox1.Cut();
  }
  private void MenuItem4Click(object sender, System.EventArgs e)
  {
   richTextBox1.Copy();
  }
  private void MenuItem5Click(object sender, System.EventArgs e)
  {
   richTextBox1.Paste();
  }
  private void MenuItem7Click(object sender, System.EventArgs e)
  {
   richTextBox1.SelectAll();
  }
 }
}


/*
 * 由 SharpDevelop .NET 免費開發工具 建立的 C# .NET 程式.
 * 作    者: Administrator
 * 建立日期: 2004/8/6
 * 建立時間: 上午 12:35
 * 功    能: 電腦名稱之IP查詢
 * 修改日期: 上午 12:35
 */
using System;
using System.Windows.Forms;
using System.Net;
namespace DefaultNamespace
{
 /// <summary>
 /// Description of MainForm.
 /// </summary>
 public class MainForm : System.Windows.Forms.Form
 {
  private System.Windows.Forms.Label label1;
  private System.Windows.Forms.Button button1;
  private System.Windows.Forms.TextBox textBox1;
  private System.Windows.Forms.TextBox textBox2;
  private System.Windows.Forms.Label label2;
  public MainForm()
  {
   //
   // The InitializeComponent() call is required for Windows Forms designer support.
   //
   InitializeComponent();

   //
   // TODO: Add constructor code after the InitializeComponent() call.
   //
  }

  [STAThread]
  public static void Main(string[] args)
  {
   Application.Run(new MainForm());
  }

  #region Windows Forms Designer generated code
  /// <summary>
  /// This method is required for Windows Forms designer support.
  /// Do not change the method contents inside the source code editor. The Forms designer might
  /// not be able to load this method if it was changed manually.
  /// </summary>
  private void InitializeComponent() {
   this.label2 = new System.Windows.Forms.Label();
   this.textBox2 = new System.Windows.Forms.TextBox();
   this.textBox1 = new System.Windows.Forms.TextBox();
   this.button1 = new System.Windows.Forms.Button();
   this.label1 = new System.Windows.Forms.Label();
   this.SuspendLayout();
   //
   // label2
   //
   this.label2.AutoSize = true;
   this.label2.Location = new System.Drawing.Point(8, 40);
   this.label2.Name = "label2";
   this.label2.Size = new System.Drawing.Size(77, 18);
   this.label2.TabIndex = 1;
   this.label2.Text = "電腦IP位址：";
   //
   // textBox2
   //
   this.textBox2.Location = new System.Drawing.Point(104, 40);
   this.textBox2.Name = "textBox2";
   this.textBox2.Size = new System.Drawing.Size(136, 22);
   this.textBox2.TabIndex = 3;
   this.textBox2.Text = "";
   //
   // textBox1
   //
   this.textBox1.Location = new System.Drawing.Point(104, 12);
   this.textBox1.Name = "textBox1";
   this.textBox1.Size = new System.Drawing.Size(136, 22);
   this.textBox1.TabIndex = 2;
   this.textBox1.Text = "";
   //
   // button1
   //
   this.button1.Location = new System.Drawing.Point(168, 72);
   this.button1.Name = "button1";
   this.button1.TabIndex = 4;
   this.button1.Text = "查詢IP";
   this.button1.Click += new System.EventHandler(this.Button1Click);
   //
   // label1
   //
   this.label1.AutoSize = true;
   this.label1.Location = new System.Drawing.Point(8, 16);
   this.label1.Name = "label1";
   this.label1.Size = new System.Drawing.Size(91, 18);
   this.label1.TabIndex = 0;
   this.label1.Text = "輸入電腦名稱：";
   //
   // MainForm
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
   this.ClientSize = new System.Drawing.Size(248, 102);
   this.Controls.Add(this.button1);
   this.Controls.Add(this.textBox2);
   this.Controls.Add(this.textBox1);
   this.Controls.Add(this.label2);
   this.Controls.Add(this.label1);
   this.Name = "MainForm";
   this.Text = "電腦名稱之IP查詢";
   this.ResumeLayout(false);
  }
  #endregion
  void Button1Click(object sender, System.EventArgs e)
  {
   try{
   IPHostEntry ipHost = Dns.GetHostByName(textBox1.Text);
   IPAddress[] ipAddr = ipHost.AddressList;
   for(int x = 0; x < ipAddr.Length; x++)
    {
    textBox2.Text= ipAddr[x].ToString();
    }
   }catch(System.Net.Sockets.SocketException){
            MessageBox.Show("電腦名稱不存在.");
         }
  }

 }
}


透過WebBrowser 控制項 來 Post Form Data
底下連結的文章中詳細說明如何在 Visual C# .NET 使用 WebBrowser ActiveX 控制項來執行 post of form data。
http://support.microsoft.com/default.aspx?scid=KB;EN-US;313068


Use P/Invoke to Develop a .NET Base Class Library for Serial Device Communications

This article assumes you're familiar with C# and RS232 communications
3
Download the code for this article: NetSerialComm.exe (89KB)
SUMMARY Out-of-the-box, the only way of coding RS232 serial communications applications in the .NET environment is to import the outdated and somewhat limited MSComm ActiveX control. This article describes the development of a lean, multithreaded, and modern RS232 base class library in C# managed code. The library uses Platform Invocation Services to interact with the Win32 API directly. Application programmers can use the library from any .NET language through inheritance; the article explores examples written in C# and Visual Basic .NET.
he Microsoft𦲷 .NET Framework Class Library (FCL) provides reasonably comprehensive coverage of the functionality of the underlying Win32𦲷 API, greatly contributing to the sophistication of the C# and Visual Basic𦲷 .NET languages. However, RS232 serial communications is one area that is conspicuously absent from the library. To be fair, most people probably now regard these ports as legacy baggage. These days, you interact with serial modems via software layers such as TAPI or PPP. Other devices that once used these ports are now migrating to USB. Nevertheless, the need for device drivers for specialized RS232 devices such as GPS receivers, barcode and swipe card readers, programmable controllers, and device programmers will continue for the foreseeable future. (For RS232 port specs, see the sidebar "Hardware Specs".)
Platform Invocation Services (P/Invoke) is the .NET technology that enables managed code in the common language runtime (CLR) to make calls into unmanaged DLLs, including those that implement the Win32 API. In this article, I will wrap the API functions provided for RS232 communications in CLR managed classes using C#. The resultant base class library will make it relatively easy to develop drivers for specific devices using any .NET language. Full source code for the library and examples is available for download from the link at the top of this article.

Design Principles
There are at least four design options that you should consider when encapsulating the Win32 serial communications functions in managed classes:
  1. Use P/Invoke to wrap the API functions, constants, and structure definitions as static members of a managed class. While I use this approach internally, I do not expose this class to application programmers.
  2. 2.Write a stream handler. This is a generalized, extensible abstraction used by the framework for file, console, and network communications. At first sight, this is attractive, but on closer examination it is better suited to traditional modem communications than to the command-response syntaxes of modern serial devices.
  3. 3.Build a direct replacement for the MSComm OLE Control Extension (OCX). In other words, create a class that encapsulates the API file handle and provides a number of generalized methods and events (Open, Close, Read, Write, and so on). You could reuse this functionality by instantiating an object of the library class within the application class—that is, by aggregation, COM-style.
  4. 4.Write a base class from which the application code inherits. This is a truly object-oriented approach that exploits the wonderful .NET trick of language-independent run-time inheritance. The generalized methods are inherited into the application object and virtual methods are used rather than events. The application object provides a public interface in terms appropriate to the actual RS232 device (for example, a GPS receiver driver might have public properties for latitude and longitude).
I will employ the fourth approach. The library will contain two base classes declared as abstract (they can't be instantiated), but I will use them as base classes for building application-specific classes through inheritance. Figure 1 illustrates the inheritance hierarchy.
Figure 1 Inheritance Hierarchy
Figure 1 Inheritance Hierarchy
The first library class, CommBase, makes no assumptions about data formatting and provides facilities for opening and closing the communications port, sending and receiving bytes of data, and interacting with the control inputs and outputs.
The second library class, CommLine, inherits from CommBase and makes two assumptions: that the coding of the bytes sent and received is ASCII and that a reserved ASCII control code will mark the termination of variable-length lines of data, enabling transmission and reception of strings. Of course, this model is extensible; you could write alternative versions of CommLine for Unicode communications, for example.

Using the Base Classes
 Two example applications, BaseTerm and LineTerm, are available for download. These are general-purpose terminal emulators allowing experimentation with just about any serial device, including a modem. I will take a brief look from a user perspective at BaseTerm, then analyze the source code for LineTerm in detail.
Figure 2 BaseTerm
Figure 2 BaseTerm
BaseTerm (see Figure 2) is a full Windows𦲷 Forms-based application that inherits from CommBase to provide a byte-oriented diagnostic terminal. The Settings button brings up a form to enable editing of the full range of communications settings (see Figure 3). The menus on this form enable the user to save and load settings to XML-structured files, as well as a number of presets for common flow control scenarios. Tooltips explain the use of the individual settings. Once saved to XML, you can specify the file on the command line when you start the program again. Once the link is online, typed characters get sent to the remote device immediately. Keyboard keys send the appropriate ASCII byte, and if you want you can send non-keyboard codes using an escape facility.
Figure 3 Comm Settings
Figure 3 Comm Settings
To start an escape, type the open angle bracket (<) character. Then, type either an ASCII control code name or a decimal number between 0 and 255. To terminate the escape, type the > character, which will cause the appropriate ASCII code to be sent immediately. The < character can be sent by typing it twice. You can view a list of valid ASCII control code names in the "Xon Code" dropdown on the settings dialog, and sites like http://www.asciitable.com provide additional useful information. The larger text box on the terminal window displays all received bytes in either ASCII or hexadecimal without further interpretation.
You can use display settings to break received lines either after reception of a specific ASCII character or after a fixed number of characters. The Status button displays a report of the status of the transmission and reception queues.
LineTerm uses CommLine as its base class and illustrates how to use the library in source code. You will need to run it from the Visual Studio𦲷 IDE because there is no user interface for settings. In Visual Studio .NET, create a new Visual Basic console application. Remove the supplied default module from the project. Copy LineTerm.vb, CommBase.dll, and CommBase.xml into the project directory (the XML file provides IntelliSense𦲷 information for the library). Use Add Existing Item in the project explorer to import LineTerm.vb and Add Reference to set a reference to CommBase.dll. You should now be able to build and run the project.
Figure 4 shows the complete source code for this example. In the first line, I import the namespace for the library. Then I create a new class, LineTerm, that inherits from CommLine. This provides the public methods Open and Close (actually inherited from CommBase), and the protected method Send, which I make public as SendCommand. In my new class, I override a number of virtual methods from the base classes. The CommSettings method is invoked by Open to configure the communications port; it must return an initialized CommBaseSettings object.
I actually use CommLineSettings here, which is fine because it inherits from CommBaseSettings. In the last two lines of this function, I first pass the object to the Setup method, which is inherited from CommLine, and then return it to CommBase. All the settings are public members and can be set directly, but there is also a helper method, SetStandard, which automatically configures the most common settings for CommBase. You will probably need to edit the parameters to this function and the line terminator and filter members to suit the device you have available for testing.
The Main method for the application simply creates an instance of my class, invokes the Open method, and provides a console harness for sending strings and displaying received strings. There are two methods of doing this: blocking and non-blocking. Using SendCommand starts non-blocking communications. This function returns immediately, then sometime later the send will complete and the OnTxDone override will report this. Later still, when the remote device has transmitted a complete response line, the OnRxLine override will display it on the console. During this time, the Main routine waits for user input, but it could have been getting on with other work. If you comment out SendCommand and enable TransactCommand instead, the same action will be performed using blocking communications. Here the Main routine will block at this line until the response is available. You will still see the message from OnTxDone, but instead of the RECEIVED message from OnRxLine you will see the RESPONSE message from TransactCommand.
Figure 5 Flow Control for GPS
Figure 5 Flow Control for GPS
In a real application, such as a driver for a GPS receiver, you would not simply make the Send or Transact methods public in the same way as I did in this example. Instead, you would provide public methods and properties exposing the functionality of the device (for example, properties like Speed and Altitude, or an event like PositionChanged). These methods should assemble the necessary command, use the Transact method, and then parse the response to extract the return value. Figure 5 illustrates the flow control for such a device driver.

Sending
 In serial communications, as in so much of life, sending messages is much easier than receiving them. For reception, you are at the whim of the remote device, whereas for transmission, you remain in control of the timing. However, at typical speeds of between 2 and 20,000 baud compared to computer speeds in the gigahertz range, you do not want to be cooling your heels waiting for transmission operations to complete. The Win32 API treats serial communications as a special case of file operations and uses a technique that is known as overlapped I/O to provide non-blocking operations.
The CommBase class provides the public method Open, which uses the Win32 API function CreateFile to open a serial port and store the resulting operating system handle as a private member variable:
hPort = Win32Com.CreateFile(cs.port,
   Win32Com.GENERIC_READ | Win32Com.GENERIC_WRITE, 0, IntPtr.Zero,
   Win32Com.OPEN_EXISTING, Win32Com.FILE_FLAG_OVERLAPPED,
   IntPtr.Zero);
The first parameter is the port name as a string, usually COM1: or COM2:, but in theory the name could be anything, so I have used a string rather than a number. I haven't found any way to determine a list of valid port names, so I have chosen to let the caller attempt to open any port, accepting the fact that this may fail. Failure may also occur if the port exists but is already in use by another application, in which case Open returns false. I use FILE_FLAG_OVERLAPPED to specify that all operations on this file handle will be non-blocking, and the rest of the parameters are boilerplate for serial communications.
  Win32Com is a helper class used as a container for static definitions of the API functions, structures, and constants that I will be using via P/Invoke. CreateFile is declared as follows in C#:
[DllImport("kernel32.dll", SetLastError=true)]
internal static extern IntPtr CreateFile(String lpFileName,
   UInt32 dwDesiredAccess, UInt32 dwShareMode,
   IntPtr lpSecurityAttributes, UInt32 dwCreationDisposition,
   UInt32 dwFlagsAndAttributes, IntPtr hTemplateFile);
The various constants are also defined here. For example:
internal const UInt32 FILE_FLAG_OVERLAPPED = 0x40000000;

Since there is currently very little tool support for P/Invoke, I have had to handcraft these definitions. The key resources include the Win32 API documentation and the header files provided for use with C++. (The excellent file search facilities in Visual Studio .NET are invaluable for finding definitions in the header files. I use these for documentation purposes only; you don't need them to compile the library.) A full discussion of interop marshaling, the process by which managed data types are translated into the unmanaged C definitions used by the API, is beyond the scope of this article. However, you can get an idea of what is going on under the hood from another piece of code in the Open method:
wo.Offset = 0;
wo.OffsetHigh = 0;
if (checkSends)
    wo.hEvent = writeEvent.Handle;
else
    wo.hEvent = IntPtr.Zero;
ptrUWO = Marshal.AllocHGlobal(Marshal.SizeOf(wo));
Marshal.StructureToPtr(wo, ptrUWO, true);

Here, wo is a local variable of type Win32Com.OVERLAPPED, and ptrUWO is a private class variable of type IntPtr. Marshal is a static object in System.Runtime.InteropServices that provides access to the interop marshaler. In this code, I am doing manually what the marshaler normally does automatically when an external function is called. The first step is to allocate an appropriately sized block of unmanaged memory, then copy the contents of the managed structure into it, remapping the memory layout as required. After the function call, the marshaler would normally use Marshal.PtrToStructure to perform the reverse copy, then Marshal.FreeHGlobal to release the memory. I perform this operation manually because of the special way the API uses the OVERLAPPED structure. I will specify it in a WriteFile call, but then the operating system will continue to use it after the call returns.
Some time later, I will call GetOverlappedResult, specifying the same structure again. If I left this up to automatic marshaling, the risk would be that the unmanaged memory would be reallocated between the two calls. In this case, unmarshaling is not necessary since the fields do not need to be accessed again. The memory must, however, be deallocated when the port is closed:
if (ptrUWO != IntPtr.Zero) Marshal.FreeHGlobal(ptrUWO);
With this groundwork in place, actually sending an array of bytes is quite straightforward:
if (!Win32Com.WriteFile(hPort, tosend, (uint)writeCount,
   out sent, ptrUWO))
if (Marshal.GetLastWin32Error != Win32Com.ERROR_IO_PENDING)
   ThrowException("Unexpected failure");

The tosend parameter is a pointer to an array of bytes; writeCount is the number of bytes in the array; the sent parameter will return the number of bytes actually sent; and ptrUWO is a pointer to the unmanaged version of OVERLAPPED, as already created. Normally, the function will return false and the error code will be ERROR_IO_PENDING. This is a pseudo-error which indicates that the operation has been queued because it could not be completed immediately. Any other error code means that the operation could not be queued. With buffered serial hardware and short send strings, it is possible that the operation will be completed immediately, in which case the function will return true.
Before sending new data, the result of any previous Send should be checked, enabling the detection of error conditions or timeouts. (Strangely, the API treats a pending operation as an error, but a timeout as perfectly normal—the only way of detecting it is that fewer bytes are sent than were queued. Ironing out this kind of anomaly is one of the hidden pleasures of writing a wrapper library!) Although I could allow multiple pending sends, each with its own OVERLAPPED structure, it would add a lot of complexity. Instead, I have blocked a subsequent Send until the previous one completes. If this blocking is a problem, it can be disabled by setting the checkAllSends member to false, in which case the OVERLAPPED structure is reused and there is no guarantee that errors or timeouts will be caught.

Receiving
 As you might guess, receiving data is simply a matter of calling the API ReadFile function. As previously mentioned, the difficult part is not so much receiving, but knowing when to receive. To avoid forcing application programmers to continually poll for data, some form of callback mechanism is required. Virtual methods called from a worker thread can perform this function. CommBase invokes a virtual method on reception of each byte. This method is overridden in CommLine to buffer up the bytes and call a different virtual method when a line terminator is received.
To make this work, I create a second thread of execution using the following code in the Open method:
rxThread = new Thread(new ThreadStart(this.ReceiveThread));
rxThread.Name = "ComBaseRx";
rxThread.Priority = ThreadPriority.AboveNormal;
rxThread.Start;
Thread.Sleep(1);
This starts up a new thread running the code in the private method ReceiveThread. The need for the final line surprised me; I assumed that the new, higher priority thread would preempt the original thread at the Start command. For some reason it does not and this created problems because the worker thread was not always ready when it was first needed. As a second attempt, I used Sleep(0) which the documentation suggests should allow preemption without wasting time (most of a whole millisecond, for goodness sake!), but again this did not work in practice.
ReceiveThread is an infinite loop of code broken only on an exception. I terminate the thread on closing the port using the following line:
rxThread.Abort;
This throws a ThreadAbortException in the thread, causing it to terminate via the catch clause, which is used for tidying up. A finally clause could also be used, but in this case it makes is no difference because the only exit route is through an exception.
Figure 6 shows a simplified version of ReceiveThread. SetCommMask indicates that I want to be notified when a new byte arrives. WaitCommEvent may return true, in which case there is already one or more bytes waiting. If it returns false with error code ERROR_IO_PENDING, I can suspend the thread until a byte arrives. The OVERLAPPED structure that was passed to WaitCommEvent includes the handle to an AutoResetEvent, which will be signaled when the byte arrives. When I execute the AutoResetEvent's WaitOne method, execution is suspended until the event is signaled.
Whether WaitCommEvent returns true immediately or signals completion later, the eventMask variable will contain a bitmask identifying which of the conditions requested in SetCommMask actually occurred (in the real code, I specify some other housekeeping conditions as well).
Notice that I use the same manual marshaling trick for eventMask as previously discussed for OVERLAPPED. I suspect this is not actually necessary and that automatic marshaling might work, but the exact behavior is not documented so it's better to be safe than sorry. Replacing the unmarshaled pointer with the managed variable as a reference parameter seems to work, but it may just be luck that the memory has not been reused.
Depending on timing, more than one character may be waiting, so the queue is drained one character at a time using ReadFile repeatedly and calling the virtual function OnRxChar with each character. When I get ERROR_IO_PENDING, I call CancelIo because I don't want to wait here; I want to loop back and wait at WaitCommEvent.
Error handling and exceptions need to be carefully considered when using worker threads. Any unhandled exceptions that occur in ReceiveThread, any of the virtual methods called from it, and any methods or events called or fired from any of these will propagate up and be handled by the catch clause. If the exception is not ThreadAbortException, it is stored in a private member of CommBase and the thread is then terminated. The next time the application code invokes a method on the primary thread, the exception is raised again and the port is closed. This makes good use of the inner exception mechanism since a generic "Receive Thread Fault" is raised, containing a reference to the original stored exception. ThrowException is provided as a helper method for use in derived classes; it adjusts its behavior according to which thread it is called on.

Settings and Other Details
 I read all the configurable settings from a helper object of class CommBaseSettings. Open acquires this object by calling the virtual method CommSettings and then copies the values into the API structures. CommBaseSettings also provides methods for saving and restoring settings to XML configuration files and for applying common settings scenarios in bulk. I provide documentation for the settings in the form of IntelliSense help. This design provides an extensible settings infrastructure since derived classes can provide their own settings class that inherits from CommBaseSettings. I have inherited CommLineSettings in this way to add additional settings required by CommLine.
There are three API functions for configuring communications protocols: SetupComm, SetCommState, and SetCommTimeouts. SetupComm requests sizes for the reception and transmission queues. Normally you can just set these to zero and the operating system decides, but it may be worth adjusting the requested size for some file transfer and similar applications. There is no guarantee that the system will honor this request; in Windows XP, there appears to be a dynamic transmission queue and only the reception queue length is honored.
SetCommState supplies the settings for baud rate, word format, and handshake settings in a structure called the device control block (DCB).
SetCommTimeouts provides three reception and two transmission timeout values in a COMMTIMEOUTS structure. The reception timeouts are not useful in the design I have chosen because individual characters are processed asynchronously. If a reception timeout is required, then it needs to be implemented at a higher level (for example, CommLine provides a timeout for its Transact method). The transmission timeouts are useful, however, for multibyte sends. The number of bytes in the send is multiplied by the sendTimeoutMultiplier and then sendTimeoutConstant is added to this to give the total time allowed in milliseconds.
Once the port is opened and configured, Open invokes a virtual method AfterOpen, which may be overridden to check the status of the connection to the remote device and possibly also to configure it. If this returns false, the port will be closed again and Open itself will return false. There is also a BeforeClose method for shutting down the remote device if necessary.
CommBase provides two overloaded versions of Send, one taking a byte array and the other taking a single byte. CommLine provides a third version of Send, taking a string. All of these ultimately use the byte array version after appropriate data conversion. There is also a SendImmediate method taking a single byte. This sends the byte ahead of any other bytes in the transmission queue and may be useful for implementing custom flow control schemes. There are also properties providing direct control of the Request to Send (RTS) and Data Terminal Ready (DTR) output pins and the ability to put the TX output into a break condition. The input pins—Clear-to-Send (CTS), Data Set Ready (DSR), Received Line Signal Detector (RLSD), and Ring Detect—can be read directly using GetModemStatus and the virtual function OnStatusChange is called when the state of any of these input and output pins changes.
GetQueueStatus returns a QueueStatus object, giving the size and content of the transmission and reception queues and what, if any, flow control condition is currently blocking transmission.

Conclusion
 I've used Platform Invocation Services to address one of the gaps in the functionality of the FCL. This turned out to be a nontrivial but perfectly feasible exercise. Much of the difficulty arises because full tool support and documentation for P/Invoke is not yet in place.
Finally, I have a confession to make. As part of this project, I wrote and tested a complete wrapper for the Win32 Waitable Events API before stumbling on the ManualResetEvent and AutoResetEvent framework classes that already encapsulated all the functionality I needed. Remember: you just might be spending all your free time writing brand new classes from scratch when just what you needed already existed. Check your local hardware store before reinventing the wheel. On this principle, I hope that the base classes developed here will help other programmers bring RS232 device communications into the .NET world.
For related articles see:
 House of COM: ating Native Code to the .NET CLR
Serial Communications Overview
RS232 standard


使用 C# .NET 撰寫事件記錄檔
底下連結的文章示範如何使用 Microsoft .NET Framework 將您自己的項目加入到作業系統的事件記錄檔。
http://support.microsoft.com/default.aspx?scid=kb;EN-US;307024


XML 和 Data Grid (資料瀏覽)
employees.xml 內容如下：
<?xml version="1.0" encoding="utf-8"?>
<fullrecord>
  <employee>
    <firstname>Sylvie</firstname>
    <lastname>Aronson</lastname>
    <salary>25.64</salary>
    <gender>Female</gender>
  </employee>
  <employee>
    <firstname>Bertrand</firstname>
    <lastname>Yamaguchi</lastname>
    <salary>16.38</salary>
    <gender>Male</gender>
  </employee>
    <firstname>Anselme</firstname>
    <lastname>Bean</lastname>
    <salary>22.82</salary>
    <gender>Male</gender>
  <employee>
    <firstname>Mauricette</firstname>
    <lastname>Thomas</lastname>
    <salary>18.35</salary>
    <gender>Female</gender>
  </employee>
  <employee>
    <firstname>Hermine</firstname>
    <lastname>Gray</lastname>
    <salary>12.75</salary>
    <gender>Female</gender>
  </employee>
</fullrecord>

程式內容：

/*
 * 由 SharpDevelop .NET 免費開發工具 建立的 C# .NET 程式.
 * 作    者:
 * 建立日期: 2004/8/9
 * 建立時間: 上午 10:40
 * 功    能:
 * 修改日期: 2004/8/9 上午 10:40
 */
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace IntroXML1
{
    /// <summary>
    /// Description of MainForm.
    /// </summary>
    public class MainForm : System.Windows.Forms.Form
    {
        private System.Windows.Forms.DataGrid dataGrid1;
        private DataSet dsEmployees;
        public MainForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
        }

        [STAThread]
        public static void Main(string[] args)
        {
            Application.Run(new MainForm());
        }

        #region Windows Forms Designer generated code
        /// <summary>
        /// This method is required for Windows Forms designer support.
        /// Do not change the method contents inside the source code editor. The Forms designer might
        /// not be able to load this method if it was changed manually.
        /// </summary>
        private void InitializeComponent() {
            this.dataGrid1 = new System.Windows.Forms.DataGrid();
            ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
            this.SuspendLayout();
            //
            // dataGrid1
            //
            this.dataGrid1.DataMember = "";
            this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
            this.dataGrid1.Location = new System.Drawing.Point(8, 8);
            this.dataGrid1.Name = "dataGrid1";
            this.dataGrid1.Size = new System.Drawing.Size(440, 208);
            this.dataGrid1.TabIndex = 0;
            //
            // MainForm
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
            this.ClientSize = new System.Drawing.Size(456, 230);
            this.Controls.Add(this.dataGrid1);
            this.Name = "MainForm";
            this.Text = "MainForm";
            this.Load += new System.EventHandler(this.MainFormLoad);
            ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
            this.ResumeLayout(false);
        }
        #endregion
        void MainFormLoad(object sender, System.EventArgs e)
        {
            this.dsEmployees = new DataSet("employees");
            this.dsEmployees.ReadXml("employees.xml");
            this.dataGrid1.DataSource = this.dsEmployees;
            this.dataGrid1.DataMember = "employee";
        }

    }
}


XML 和 comboBox (新增資料到comboBox ，並存到XML檔中)
ISFlavors.xml 檔內容：

<?xml version="1.0" encoding="utf-8"?>
<flavors>
  <flavor>French Vanilla</flavor>
</flavors>

完整程式碼：

/*
 * 由 SharpDevelop .NET 免費開發工具 建立的 C# .NET 程式.
 * 作    者:
 * 建立日期: 2004/8/9
 * 建立時間: 上午 11:05
 * 功    能:
 * 修改日期: 2004/8/9 上午 11:05
 */
using System;
using System.Windows.Forms;
using System.Xml;
using System.Text;

namespace DefaultNamespace
{
    /// <summary>
    /// Description of MainForm.
    /// </summary>
    public class MainForm : System.Windows.Forms.Form
    {
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.TextBox textBox1;
        private System.Windows.Forms.ComboBox comboBox1;
        public MainForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
        }

        [STAThread]
        public static void Main(string[] args)
        {
            Application.Run(new MainForm());
        }

        #region Windows Forms Designer generated code
        /// <summary>
        /// This method is required for Windows Forms designer support.
        /// Do not change the method contents inside the source code editor. The Forms designer might
        /// not be able to load this method if it was changed manually.
        /// </summary>
        private void InitializeComponent() {
            this.comboBox1 = new System.Windows.Forms.ComboBox();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.button1 = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // comboBox1
            //
            this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBox1.Location = new System.Drawing.Point(16, 40);
            this.comboBox1.Name = "comboBox1";
            this.comboBox1.Size = new System.Drawing.Size(120, 20);
            this.comboBox1.Sorted = true;
            this.comboBox1.TabIndex = 0;
            //
            // textBox1
            //
            this.textBox1.Location = new System.Drawing.Point(240, 40);
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new System.Drawing.Size(104, 22);
            this.textBox1.TabIndex = 2;
            this.textBox1.Text = "textBox1";
            //
            // button1
            //
            this.button1.Location = new System.Drawing.Point(144, 40);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(88, 24);
            this.button1.TabIndex = 1;
            this.button1.Text = "新增";
            this.button1.Click += new System.EventHandler(this.Button1Click);
            //
            // MainForm
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
            this.ClientSize = new System.Drawing.Size(368, 134);
            this.Controls.Add(this.textBox1);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.comboBox1);
            this.Name = "MainForm";
            this.Text = "MainForm";
            this.Closing += new System.ComponentModel.CancelEventHandler(this.MainFormClosing);
            this.Load += new System.EventHandler(this.MainFormLoad);
            this.ResumeLayout(false);
        }
        #endregion
        void Button1Click(object sender, System.EventArgs e)
        {
            string NewItem = this.textBox1.Text;

            // If there is no flavor to add, do nothing
            if( NewItem.Equals("") == true )
                return;

            // Since there is an item to add, prepare to add it
            // First make sure the item is not already in the list
            if( this.comboBox1.FindStringExact(NewItem) > 0 )
            {
                MessageBox.Show(NewItem + " exists already in the list and will not be added.");
                return;
            }

            // Since the item is not yet in the list, add it...
            this.comboBox1.Items.Add(NewItem);
            // After adding the item to the combo box, remove it from the text box
            this.textBox1.Text = "";
            // And give focus to the text box in case the user wants to add another item
            this.textBox1.Focus();
        }

        void MainFormLoad(object sender, System.EventArgs e)
        {
             // Declare a variable of type  XmlTextReader
             XmlTextReader xtr  = null;
             // Declare a string that holds the name of the file
             string fileName = "ISFlavors.xml";

             try {
                 // Initialize the XmlTextReader variable with the name of the file
                 xtr = new XmlTextReader(fileName);
                 xtr.WhitespaceHandling = WhitespaceHandling.None;

                 // Scan the XML file
                 while (xtr.Read())
                 {
                   // every time you find an element, find out what type it is
                   switch (xtr.NodeType)
                   {
                    case XmlNodeType.Text:
                    // If you find text, put it in the combo box' list
                    this.comboBox1.Items.Add(xtr.Value);
                    break;
                   }
                 }

                 // For this example, select the first item
                 this.comboBox1.SelectedIndex = 0;
             }
             finally
             {
                 // Close the XmlTextReader
                 if (xtr != null)
                      xtr.Close();
             }
        }

        void MainFormClosing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            XmlTextWriter xtw = null;
            string fileName   = "ISFlavors.xml";

             try {
                 xtw = new XmlTextWriter(fileName, Encoding.UTF8);
                 xtw.Formatting = Formatting.Indented;

                 xtw.WriteStartDocument();
                 xtw.WriteStartElement("flavors");

                 for(int i = 0; i < this.comboBox1.Items.Count; i++)
                 {
                   xtw.WriteElementString("flavor", (string)this.comboBox1.Items[i]);
                 }

                 xtw.WriteEndElement();
                 xtw.WriteEndDocument();
             }
             finally
             {
                 if (xtw != null)
                   xtw.Close();
             }

        }

    }
}


客戶端執行 Office 應用程式使用後，沒有消失離開處理
當你從Visual Basic .NET or Visual C# .NET 自動化呼叫任一個 Microsoft Office application，即使我們呼叫了 Quit 這一個方法，Office 應用程式並沒有消失離開，請參考底下連結的說明文件。

PRB: Office Application Does Not Quit After Automation from Visual Studio .NET Client
 http://support.microsoft.com/?id=317109


簡單C#與EXCEL整合的應用程式
1.轉OLB檔為NET使用的DLL檔
    TlbImp.exe  excel.olb excel.dll

Type Library Importer (Tlbimp.exe)使用說明：

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/html/cpgrftypelibraryimportertlbimpexe.asp

2.開發工具->加入「參考」
3.程式碼如下：
using System;
using System.Windows.Forms;
using System.Reflection; // For Missing.Value and BindingFlags
using System.Runtime.InteropServices; // For COMException
using Excel;

namespace MyFormProject
{

 class MainForm : System.Windows.Forms.Form
 {
  private System.Windows.Forms.Button button;
  private System.Windows.Forms.Button button2;
  public static int Excel1()
{
Excel.Application exc = new
Excel.Application();
exc.Visible = true;
Workbooks workbooks = exc.Workbooks;
_Workbook workbook =
workbooks.Add(XlWBATemplate.xlWBATWorksheet);
//Sheets sheets =
workbook.Worksheets;
return
0;
}
public MainForm()
{
InitializeComponent();
}
// THIS
METHOD IS MAINTAINED BY THE FORM DESIGNER
// DO NOT EDIT IT
MANUALLY! YOUR CHANGES ARE LIKELY TO BE LOST
void
InitializeComponent() {
this.button2 = new
System.Windows.Forms.Button();
this.button = new
System.Windows.Forms.Button();
this.SuspendLayout();
//
//
button2
//
this.button2.Location = new
System.Drawing.Point(24, 56);
this.button2.Name =
"button2";
this.button2.TabIndex = 1;
this.button2.Text = "結束程式";
this.button2.Click += new
System.EventHandler(this.Button2Click);
//
//
button
//
this.button.Location = new
System.Drawing.Point(24, 24);
this.button.Name =
"button";
this.button.TabIndex = 0;
this.button.Text = "開啟Excel程式";
this.button.Click += new
System.EventHandler(this.ButtonClick);
//
//
MainForm
//
this.AutoScaleBaseSize = new
System.Drawing.Size(5, 15);
this.ClientSize = new
System.Drawing.Size(292, 273);
this.Controls.Add(this.button2);
this.Controls.Add(this.button);
this.Name =
"MainForm";
this.Text = "This is my form";
this.ResumeLayout(false);
}

  [STAThread]
  public static void Main(string[] args)
  {
   System.Windows.Forms.Application.Run(new MainForm());
   //Important because Excel is an Application too:
   // without System.Windows.Forms ambiguous reference error
  }
void Button2Click(object sender,
System.EventArgs e)
{
this.Close();
}
void ButtonClick(object sender,
System.EventArgs e)
{
Excel1();
}
}
}


C#填資料到 EXCEL中
透過自動化 Excel 的方式，使用陣列來填入或取出某一範圍中的資料
底下連結的文章示範了如何在 Visual C# .NET 中透過自動化Excel 的方式，使用陣列來填入或取出某一多欄位範圍中的資料。
 http://support.microsoft.com/?id=302096


透過 C# .NET來處理 Execl 觸發的事件
底下連結的文章逐步說明如何在Visual C# .NET 所開發的自動化客戶端上處理Excel 觸發的事件。
 http://support.microsoft.com/?id=302815


AxImp轉換COM 為NET視覺元件
(AxImp.exe:.NET framework SDK安裝後有提供！)
AxImp.exe使用方式：
Windows Forms ActiveX Control Importer (Aximp.exe)
 http://msdn.microsoft.com/library/en-us/cptools/html/cpgrfWindowsFormsActiveXControlImporterAximpexe.asp
批次檔執行範例
如下：
@echo 「AxImp轉換COM」為NET可視覺的元件製作
aximp c:\windows\system32\wmp.dll /out:Interop.wmp.dll
pause
完成後，可在工具面版按右鍵
-->選擇configuresidebar(引用項目設定)-->選擇存放元件分類位置-->新增元件-->自訂-->選擇Interop.wmp.dll-->確定
備註1：開發工具加入COM為「參考( References )」時，為NET非視覺元件使用方式。
備註2：引用 ActiveX 元件..兩種玩法 (AxImp.exe 和 註冊到GAC)


/*
* 由 SharpDevelop .NET 免費開發工具 建立的 C# .NET 程式.
* 作    者:
* 建立日期: 2004/8/25
* 建立時間: 下午 10:57
* 功    能: 收音機(轉換COM為.NET視覺化元件方式)
* 修改日期: 2004/8/25 下午 10:57
*/
using System;
using System.Windows.Forms;

namespace DefaultNamespace
{
/// <summary>
/// Description of MainForm.
/// </summary>
public class MainForm : System.Windows.Forms.Form
{
private System.Windows.Forms.ListBox listBox1;
private mdobler.XPCommonControls.XPGradientPanel xPGradientPanel1;
private AxWMPLib.AxWindowsMediaPlayer axWindowsMediaPlayer1;
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();

//
// TODO: Add constructor code after the InitializeComponent() call.
//
}

[STAThread]
public static void Main(string[] args)
{
Application.Run(new MainForm());
}

#region Windows Forms Designer generated code
/// <summary>
/// This method is required for Windows Forms designer support.
/// Do not change the method contents inside the source code editor. The Forms designer might
/// not be able to load this method if it was changed manually.
/// </summary>
private void InitializeComponent() {
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainForm));
this.axWindowsMediaPlayer1 = new AxWMPLib.AxWindowsMediaPlayer();
this.xPGradientPanel1 = new mdobler.XPCommonControls.XPGradientPanel();
this.listBox1 = new System.Windows.Forms.ListBox();
((System.ComponentModel.ISupportInitialize)(this.axWindowsMediaPlayer1)).BeginInit();
this.xPGradientPanel1.SuspendLayout();
this.SuspendLayout();
//
// axWindowsMediaPlayer1
//
this.axWindowsMediaPlayer1.ContainingControl = this;
this.axWindowsMediaPlayer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.axWindowsMediaPlayer1.Enabled = true;
this.axWindowsMediaPlayer1.Location = new System.Drawing.Point(216, 0);
this.axWindowsMediaPlayer1.Name = "axWindowsMediaPlayer1";
this.axWindowsMediaPlayer1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWindowsMediaPlayer1.OcxState")));
this.axWindowsMediaPlayer1.Size = new System.Drawing.Size(336, 246);
this.axWindowsMediaPlayer1.TabIndex = 0;
 //
// xPGradientPanel1
//
this.xPGradientPanel1.Controls.Add(this.axWindowsMediaPlayer1);
this.xPGradientPanel1.Controls.Add(this.listBox1);
this.xPGradientPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.xPGradientPanel1.Location = new System.Drawing.Point(0, 0);
this.xPGradientPanel1.Name = "xPGradientPanel1";
this.xPGradientPanel1.Size = new System.Drawing.Size(552, 246);
this.xPGradientPanel1.TabIndex = 1;
//
// listBox1
//
this.listBox1.Dock = System.Windows.Forms.DockStyle.Left;
this.listBox1.ItemHeight = 12;
this.listBox1.Items.AddRange(new object[] {
"mms://live.media.hinet.net/UFO_Music1 ",
"mms://live.media.hinet.net/kissradio ",
"mms://live.media.hinet.net/vot "});
this.listBox1.Location = new System.Drawing.Point(0, 0);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(216, 244);
this.listBox1.TabIndex = 1;
this.listBox1.Click += new System.EventHandler(this.listBox1Click);
//
// MainForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
this.ClientSize = new System.Drawing.Size(552, 246);
this.Controls.Add(this.xPGradientPanel1);
this.Name = "MainForm";
this.Text = "MainForm";
((System.ComponentModel.ISupportInitialize)(this.axWindowsMediaPlayer1)).EndInit();
this.xPGradientPanel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion

void listBox1Click(object sender, System.EventArgs e)
{
axWindowsMediaPlayer1.URL=listBox1.SelectedItem.ToString();
}
}
}


Windows MediaPlayer操作範例-收音機製作
(Windows MediaPlayer採用非視覺方式製作-加入「參考」方式)
程式碼如下：
/*
 * 由 SharpDevelop .NET 免費開發工具 建立的 C# .NET 程式.
 * 作    者:
 * 建立日期: 2004/8/25
 * 建立時間: 下午 08:05
 * 功    能:
 * 修改日期: 2004/8/25 下午 08:05
 */
using System;
using System.Windows.Forms;
using System.ComponentModel;
using WMPLib;
namespace DefaultNamespace
{
 /// <summary>
 /// Description of MainForm.
 /// </summary>
 public class MainForm : System.Windows.Forms.Form
 {
  private ColorButton.ColorButton colorButton2;
  private ColorButton.ColorButton colorButton1;
  private System.Windows.Forms.ListBox listBox1;
  private WMPLib.WindowsMediaPlayer Paly=new WindowsMediaPlayer();
  private System.ComponentModel.Container components = null;

  public MainForm()
  {
   //
   // The InitializeComponent() call is required for Windows Forms designer support.
   //
   InitializeComponent();

   //
   // TODO: Add constructor code after the InitializeComponent() call.
   //
  }

  [STAThread]
  public static void Main(string[] args)
  {
   Application.Run(new MainForm());
  }
  /// <summary>
  /// 元件記憶體釋放
  /// </summary>
  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
     if (components != null)
     {
      components.Dispose();
     }
   }
   base.Dispose( disposing );
  }

  #region Windows Forms Designer generated code
  /// <summary>
  /// This method is required for Windows Forms designer support.
  /// Do not change the method contents inside the source code editor. The Forms designer might
  /// not be able to load this method if it was changed manually.
  /// </summary>
  private void InitializeComponent() {
   this.listBox1 = new System.Windows.Forms.ListBox();
   this.colorButton1 = new ColorButton.ColorButton();
   this.colorButton2 = new ColorButton.ColorButton();
   this.SuspendLayout();
   //
   // listBox1
   //
   this.listBox1.ItemHeight = 12;
   this.listBox1.Items.AddRange(new object[] {
      "mms://live.media.hinet.net/UFO_Music1",
      "mms://live.media.hinet.net/kissradio ",
      "mms://live.media.hinet.net/vot "});
   this.listBox1.Location = new System.Drawing.Point(8, 8);
   this.listBox1.Name = "listBox1";
   this.listBox1.Size = new System.Drawing.Size(272, 64);
   this.listBox1.TabIndex = 1;
   this.listBox1.Click += new System.EventHandler(this.listBox1Click);
   //
   // colorButton1
   //
   this.colorButton1.Active = true;
   this.colorButton1.ButtonStyle = ColorButton.ColorButton.ButtonStyles.Rectangle;
   this.colorButton1.Font = new System.Drawing.Font("Verdana", 10F, System.Drawing.FontStyle.Bold);
   this.colorButton1.GradientStyle = ColorButton.ColorButton.GradientStyles.Vertical;
   this.colorButton1.HoverBorderColor = System.Drawing.Color.MediumVioletRed;
   this.colorButton1.HoverColorA = System.Drawing.Color.MediumVioletRed;
   this.colorButton1.HoverColorB = System.Drawing.Color.White;
   this.colorButton1.Location = new System.Drawing.Point(8, 80);
   this.colorButton1.Name = "colorButton1";
   this.colorButton1.NormalBorderColor = System.Drawing.Color.Green;
   this.colorButton1.NormalColorA = System.Drawing.Color.Green;
   this.colorButton1.NormalColorB = System.Drawing.Color.Honeydew;
   this.colorButton1.Size = new System.Drawing.Size(64, 32);
   this.colorButton1.SmoothingQuality = ColorButton.ColorButton.SmoothingQualities.AntiAlias;
   this.colorButton1.TabIndex = 2;
   this.colorButton1.Text = "播放";
   this.colorButton1.Click += new System.EventHandler(this.ColorButton1Click);
   //
   // colorButton2
   //
   this.colorButton2.Active = true;
   this.colorButton2.ButtonStyle = ColorButton.ColorButton.ButtonStyles.Rectangle;
   this.colorButton2.Font = new System.Drawing.Font("Verdana", 10F, System.Drawing.FontStyle.Bold);
   this.colorButton2.GradientStyle = ColorButton.ColorButton.GradientStyles.Vertical;
   this.colorButton2.HoverBorderColor = System.Drawing.Color.MediumVioletRed;
   this.colorButton2.HoverColorA = System.Drawing.Color.MediumVioletRed;
   this.colorButton2.HoverColorB = System.Drawing.Color.White;
   this.colorButton2.Location = new System.Drawing.Point(80, 80);
   this.colorButton2.Name = "colorButton2";
   this.colorButton2.NormalBorderColor = System.Drawing.Color.Green;
   this.colorButton2.NormalColorA = System.Drawing.Color.Green;
   this.colorButton2.NormalColorB = System.Drawing.Color.Honeydew;
   this.colorButton2.Size = new System.Drawing.Size(64, 32);
   this.colorButton2.SmoothingQuality = ColorButton.ColorButton.SmoothingQualities.AntiAlias;
   this.colorButton2.TabIndex = 3;
   this.colorButton2.Text = "停止";
   this.colorButton2.Click += new System.EventHandler(this.ColorButton2Click);
   //
   // MainForm
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
   this.ClientSize = new System.Drawing.Size(296, 126);
   this.Controls.Add(this.colorButton2);
   this.Controls.Add(this.colorButton1);
   this.Controls.Add(this.listBox1);
   this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
   this.MaximizeBox = false;
   this.Name = "MainForm";
   this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
   this.Text = "簡易收音機";
   this.ResumeLayout(false);
  }
  #endregion

  void listBox1Click(object sender, System.EventArgs e)
  {
    Paly.URL=listBox1.SelectedItem.ToString();
  }

  void ColorButton1Click(object sender, System.EventArgs e)
  {
      if (listBox1.SelectedItem.ToString().Length>0)
   {
    Paly.controls.play();
   }
  }

  void ColorButton2Click(object sender, System.EventArgs e)
  {
   Paly.controls.stop();
  }

 }
}


繁簡轉換 COM 元件取得與註冊：
1.下載Hokoy.WordKit.dll檔，並註冊，才能執行本程式：
 http://www.hokoy.com/Works/Program/HokoyWordKit.aspx
2.拷貝Hokoy.WordKit.dll到c:\windows\system32資料夾
3.註冊 RegSvr32 Hokoy.WordKit.dll
4.專案加入「參考」->「COM」書籤->選擇「Hokoy Library」->確定

程式碼如下：
/*
 * 由 SharpDevelop .NET 免費開發工具 建立的 C# .NET 程式.
 * 作    者:
 * 建立日期: 2004/8/15
 * 建立時間: 上午 11:49
 * 功    能:
 * 修改日期: 2004/8/15 上午 11:49
 */
using System;
using System.Windows.Forms;
using Hokoy;
namespace DefaultNamespace
{
    /// <summary>
    /// Description of MainForm.
    /// </summary>
    public class MainForm : System.Windows.Forms.Form
    {
        private mdobler.XPCommonControls.XPGradientPanel xPGradientPanel1;
        private System.Windows.Forms.Button button3;
        private System.Windows.Forms.Button button2;
        private System.Windows.Forms.Button button12;
        private System.Windows.Forms.Button button7;
        private System.Windows.Forms.Button button6;
        private System.Windows.Forms.Button button5;
        private System.Windows.Forms.Button button4;
        private System.Windows.Forms.MenuItem menuItem3;
        private System.Windows.Forms.MenuItem menuItem2;
        private System.Windows.Forms.MenuItem menuItem1;
        private System.Windows.Forms.Button button8;
        private System.Windows.Forms.Button button11;
        private System.Windows.Forms.MenuItem menuItem5;
        private System.Windows.Forms.MenuItem menuItem4;
        private System.Windows.Forms.Button button10;
        private System.Windows.Forms.ContextMenu contextMenu1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.RichTextBox richTextBox1;
        private System.Windows.Forms.CheckBox checkBox1;
        private System.Windows.Forms.RichTextBox richTextBox2;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.Button button9;
        private Hokoy.WordKitClass source;
        private System.Object OK;
        public MainForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
        }

        [STAThread]
        public static void Main(string[] args)
        {
            Application.Run(new MainForm());
        }

        #region Windows Forms Designer generated code
        /// <summary>
        /// This method is required for Windows Forms designer support.
        /// Do not change the method contents inside the source code editor. The Forms designer might
        /// not be able to load this method if it was changed manually.
        /// </summary>
        private void InitializeComponent() {
            this.source =new WordKitClass();
            this.OK =new Object();
            this.button9 = new System.Windows.Forms.Button();
            this.button1 = new System.Windows.Forms.Button();
            this.richTextBox2 = new System.Windows.Forms.RichTextBox();
            this.checkBox1 = new System.Windows.Forms.CheckBox();
            this.richTextBox1 = new System.Windows.Forms.RichTextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.contextMenu1 = new System.Windows.Forms.ContextMenu();
            this.button10 = new System.Windows.Forms.Button();
            this.menuItem4 = new System.Windows.Forms.MenuItem();
            this.menuItem5 = new System.Windows.Forms.MenuItem();
            this.button11 = new System.Windows.Forms.Button();
            this.button8 = new System.Windows.Forms.Button();
            this.menuItem1 = new System.Windows.Forms.MenuItem();
            this.menuItem2 = new System.Windows.Forms.MenuItem();
            this.menuItem3 = new System.Windows.Forms.MenuItem();
            this.button4 = new System.Windows.Forms.Button();
            this.button5 = new System.Windows.Forms.Button();
            this.button6 = new System.Windows.Forms.Button();
            this.button7 = new System.Windows.Forms.Button();
            this.button12 = new System.Windows.Forms.Button();
            this.button2 = new System.Windows.Forms.Button();
            this.button3 = new System.Windows.Forms.Button();
            this.xPGradientPanel1 = new mdobler.XPCommonControls.XPGradientPanel();
            this.SuspendLayout();
            //
            // button9
            //
            this.button9.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.button9.Location = new System.Drawing.Point(464, 184);
            this.button9.Name = "button9";
            this.button9.Size = new System.Drawing.Size(184, 24);
            this.button9.TabIndex = 12;
            this.button9.Text = "繁體->Unicode";
            this.button9.Click += new System.EventHandler(this.Button9Click);
            //
            // button1
            //
            this.button1.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.button1.Location = new System.Drawing.Point(464, 24);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(184, 24);
            this.button1.TabIndex = 1;
            this.button1.Text = "繁體->簡體";
            this.button1.Click += new System.EventHandler(this.Button1Click);
            //
            // richTextBox2
            //
            this.richTextBox2.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(255)), ((System.Byte)(192)));
            this.richTextBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.richTextBox2.Font = new System.Drawing.Font("新細明體", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(136)));
            this.richTextBox2.ForeColor = System.Drawing.Color.Navy;
            this.richTextBox2.Location = new System.Drawing.Point(8, 193);
            this.richTextBox2.Name = "richTextBox2";
            this.richTextBox2.Size = new System.Drawing.Size(448, 151);
            this.richTextBox2.TabIndex = 2;
            this.richTextBox2.Text = "";
            //
            // checkBox1
            //
            this.checkBox1.Appearance = System.Windows.Forms.Appearance.Button;
            this.checkBox1.Checked = true;
            this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked;
            this.checkBox1.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.checkBox1.Font = new System.Drawing.Font("新細明體", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World);
            this.checkBox1.ForeColor = System.Drawing.Color.Blue;
            this.checkBox1.Location = new System.Drawing.Point(464, 280);
            this.checkBox1.Name = "checkBox1";
            this.checkBox1.Size = new System.Drawing.Size(56, 24);
            this.checkBox1.TabIndex = 16;
            this.checkBox1.Text = "自動換行";
            this.checkBox1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            this.checkBox1.CheckedChanged += new System.EventHandler(this.CheckBox1CheckedChanged);
            //
            // richTextBox1
            //
            this.richTextBox1.ContextMenu = this.contextMenu1;
            this.richTextBox1.Font = new System.Drawing.Font("新細明體", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(136)));
            this.richTextBox1.Location = new System.Drawing.Point(8, 24);
            this.richTextBox1.Name = "richTextBox1";
            this.richTextBox1.Size = new System.Drawing.Size(448, 144);
            this.richTextBox1.TabIndex = 0;
            this.richTextBox1.Text = "";
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.BackColor = System.Drawing.SystemColors.InactiveCaptionText;
            this.label1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.label1.Font = new System.Drawing.Font("新細明體", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(136)));
            this.label1.Location = new System.Drawing.Point(8, 2);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(34, 22);
            this.label1.TabIndex = 3;
            this.label1.Text = "來源";
            this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.BackColor = System.Drawing.SystemColors.InactiveCaptionText;
            this.label2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.label2.Font = new System.Drawing.Font("新細明體", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(136)));
            this.label2.Location = new System.Drawing.Point(8, 170);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(60, 22);
            this.label2.TabIndex = 4;
            this.label2.Text = "轉換結果";
            this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            //
            // contextMenu1
            //
            this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                        this.menuItem1,
                        this.menuItem2,
                        this.menuItem3,
                        this.menuItem4,
                        this.menuItem5});
            //
            // button10
            //
            this.button10.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.button10.Location = new System.Drawing.Point(464, 216);
            this.button10.Name = "button10";
            this.button10.Size = new System.Drawing.Size(184, 24);
            this.button10.TabIndex = 13;
            this.button10.Text = "Unicode->簡體";
            this.button10.Click += new System.EventHandler(this.Button10Click);
            //
            // menuItem4
            //
            this.menuItem4.Index = 3;
            this.menuItem4.Text = "-";
            //
            // menuItem5
            //
            this.menuItem5.Index = 4;
            this.menuItem5.Text = "全      選";
            this.menuItem5.Click += new System.EventHandler(this.MenuItem5Click);
            //
            // button11
            //
            this.button11.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.button11.Location = new System.Drawing.Point(464, 248);
            this.button11.Name = "button11";
            this.button11.Size = new System.Drawing.Size(184, 24);
            this.button11.TabIndex = 14;
            this.button11.Text = "Unicode->繁體";
            this.button11.Click += new System.EventHandler(this.Button11Click);
            //
            // button8
            //
            this.button8.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.button8.Location = new System.Drawing.Point(464, 152);
            this.button8.Name = "button8";
            this.button8.Size = new System.Drawing.Size(184, 24);
            this.button8.TabIndex = 11;
            this.button8.Text = "簡體->Unicode";
            this.button8.Click += new System.EventHandler(this.Button8Click);
            //
            // menuItem1
            //
            this.menuItem1.Index = 0;
            this.menuItem1.Text = "剪      下";
            this.menuItem1.Click += new System.EventHandler(this.MenuItem1Click);
            //
            // menuItem2
            //
            this.menuItem2.Index = 1;
            this.menuItem2.Text = "複      製";
            this.menuItem2.Click += new System.EventHandler(this.MenuItem2Click);
            //
            // menuItem3
            //
            this.menuItem3.Index = 2;
            this.menuItem3.Text = "貼      上";
            this.menuItem3.Click += new System.EventHandler(this.MenuItem3Click);
            //
            // button4
            //
            this.button4.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.button4.Location = new System.Drawing.Point(464, 120);
            this.button4.Name = "button4";
            this.button4.Size = new System.Drawing.Size(184, 24);
            this.button4.TabIndex = 7;
            this.button4.Text = "Unicode繁體字->Unicode簡體字";
            this.button4.Click += new System.EventHandler(this.Button4Click);
            //
            // button5
            //
            this.button5.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.button5.Location = new System.Drawing.Point(560, 296);
            this.button5.Name = "button5";
            this.button5.Size = new System.Drawing.Size(88, 48);
            this.button5.TabIndex = 8;
            this.button5.Text = "複製結果";
            this.button5.Click += new System.EventHandler(this.Button5Click);
            //
            // button6
            //
            this.button6.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.button6.Location = new System.Drawing.Point(120, 168);
            this.button6.Name = "button6";
            this.button6.Size = new System.Drawing.Size(248, 24);
            this.button6.TabIndex = 9;
            this.button6.Text = "上下互換";
            this.button6.Click += new System.EventHandler(this.Button6Click);
            //
            // button7
            //
            this.button7.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.button7.Location = new System.Drawing.Point(352, 0);
            this.button7.Name = "button7";
            this.button7.Size = new System.Drawing.Size(104, 24);
            this.button7.TabIndex = 10;
            this.button7.Text = "來源內容清空";
            this.button7.Click += new System.EventHandler(this.Button7Click);
            //
            // button12
            //
            this.button12.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.button12.Location = new System.Drawing.Point(232, 0);
            this.button12.Name = "button12";
            this.button12.Size = new System.Drawing.Size(112, 24);
            this.button12.TabIndex = 15;
            this.button12.Text = "從剪貼簿貼上";
            this.button12.Click += new System.EventHandler(this.Button12Click);
            //
            // button2
            //
            this.button2.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.button2.Location = new System.Drawing.Point(464, 56);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(184, 24);
            this.button2.TabIndex = 5;
            this.button2.Text = "簡體->繁體";
            this.button2.Click += new System.EventHandler(this.Button2Click);
            //
            // button3
            //
            this.button3.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.button3.Location = new System.Drawing.Point(464, 88);
            this.button3.Name = "button3";
            this.button3.Size = new System.Drawing.Size(184, 24);
            this.button3.TabIndex = 6;
            this.button3.Text = "Unicode簡體字->Unicode繁體字";
            this.button3.Click += new System.EventHandler(this.Button3Click);
            //
            // xPGradientPanel1
            //
            this.xPGradientPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.xPGradientPanel1.Location = new System.Drawing.Point(0, 0);
            this.xPGradientPanel1.Name = "xPGradientPanel1";
            this.xPGradientPanel1.Size = new System.Drawing.Size(656, 352);
            this.xPGradientPanel1.TabIndex = 17;
            //
            // MainForm
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
            this.ClientSize = new System.Drawing.Size(656, 352);
            this.Controls.Add(this.richTextBox2);
            this.Controls.Add(this.checkBox1);
            this.Controls.Add(this.button12);
            this.Controls.Add(this.button11);
            this.Controls.Add(this.button10);
            this.Controls.Add(this.button9);
            this.Controls.Add(this.button8);
            this.Controls.Add(this.button7);
            this.Controls.Add(this.button6);
            this.Controls.Add(this.button5);
            this.Controls.Add(this.button4);
            this.Controls.Add(this.button3);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.richTextBox1);
            this.Controls.Add(this.xPGradientPanel1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.MaximizeBox = false;
            this.Name = "MainForm";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "簡繁體轉換";
            this.ResumeLayout(false);
        }
        #endregion

        //繁體轉簡體
        void Button1Click(object sender, System.EventArgs e)
        {
            if (richTextBox1.Text.Length>0)
            {
             OK=source.Big5toGB(richTextBox1.Text);
             richTextBox2.Text =OK.ToString();
            }
        }
        //簡體轉繁體
        void Button2Click(object sender, System.EventArgs e)
        {
            if (richTextBox1.Text.Length>0)
            {
             OK=source.GBtoBig5(richTextBox1.Text);
             richTextBox2.Text =OK.ToString();
            }
        }
        //Unicode簡體字->Unicode繁體字
        void Button3Click(object sender, System.EventArgs e)
        {
            if (richTextBox1.Text.Length>0)
            {
             OK=source.SCtoTC(richTextBox1.Text);
             richTextBox2.Text =OK.ToString();
            }
        }
        //Unicode繁體字->Unicode簡體字
        void Button4Click(object sender, System.EventArgs e)
        {
            if (richTextBox1.Text.Length>0)
            {
             OK=source.TCtoSC(richTextBox1.Text);
             richTextBox2.Text =OK.ToString();
            }
        }
        //複製結果
        void Button5Click(object sender, System.EventArgs e)
        {
            richTextBox2.SelectAll();
            richTextBox2.Copy();
        }

        void MenuItem1Click(object sender, System.EventArgs e)
        {
            richTextBox1.Cut();
        }

        void MenuItem2Click(object sender, System.EventArgs e)
        {
            richTextBox1.Copy();
        }

        void MenuItem3Click(object sender, System.EventArgs e)
        {
            richTextBox1.Paste();
        }

        void MenuItem5Click(object sender, System.EventArgs e)
        {
            richTextBox1.SelectAll();
        }

        void Button7Click(object sender, System.EventArgs e)
        {
            richTextBox1.Clear();
        }

        void Button6Click(object sender, System.EventArgs e)
        {
            string tmp;
            tmp=richTextBox1.Text;
            richTextBox1.Text=richTextBox2.Text;
            richTextBox2.Text=tmp;
        }
        //簡體->Unicode
        void Button8Click(object sender, System.EventArgs e)
        {
            if (richTextBox1.Text.Length>0)
            {
             OK=source.GBtoUnicode(richTextBox1.Text);
             richTextBox2.Text =OK.ToString();
            }
        }
        //繁體->Unicode
        void Button9Click(object sender, System.EventArgs e)
        {
            if (richTextBox1.Text.Length>0)
            {
             OK=source.Big5toUnicode(richTextBox1.Text);
             richTextBox2.Text =OK.ToString();
            }
        }
        //Unicode->簡體
        void Button10Click(object sender, System.EventArgs e)
        {
            if (richTextBox1.Text.Length>0)
            {
             OK=source.UnicodetoGB(richTextBox1.Text);
             richTextBox2.Text =OK.ToString();
            }
        }
        //Unicode->繁體
        void Button11Click(object sender, System.EventArgs e)
        {
            if (richTextBox1.Text.Length>0)
            {
             OK=source.UnicodetoBig5(richTextBox1.Text);
             richTextBox2.Text =OK.ToString();
            }
        }

        void Button12Click(object sender, System.EventArgs e)
        {
         richTextBox1.Paste();
        }

        void CheckBox1CheckedChanged(object sender, System.EventArgs e)
        {
            if (checkBox1.Checked==true)
            {
             richTextBox1.WordWrap =true;
             richTextBox2.WordWrap =true;
             checkBox1.Text="自動換行";
            }else{
             richTextBox1.WordWrap =false;
             richTextBox2.WordWrap =false;
             checkBox1.Text="不換行";
            }
        }

    }
}


使用ADOX建立MDB資料庫
1.加入參考-->COM->選擇「Microsoft ADO Ext. 2.8 for DDL and Security 」
2.如下程式碼：

/*
 * Created by SharpDevelop.
 * User: Administrator
 * Date: 2004/8/28
 * Time: 下午 11:27
 *
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Windows.Forms;
using ADOX;
namespace DefaultNamespace
{
    /// <summary>
    /// Description of MainForm.
    /// </summary>
    public class MainForm : System.Windows.Forms.Form
    {
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.SaveFileDialog saveFileDialog1;
        public MainForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
        }

        [STAThread]
        public static void Main(string[] args)
        {
            Application.Run(new MainForm());
        }

        #region Windows Forms Designer generated code
        /// <summary>
        /// This method is required for Windows Forms designer support.
        /// Do not change the method contents inside the source code editor. The Forms designer might
        /// not be able to load this method if it was changed manually.
        /// </summary>
        private void InitializeComponent() {
            this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
            this.button1 = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // saveFileDialog1
            //
            this.saveFileDialog1.DefaultExt = "*.mdb";
            this.saveFileDialog1.Filter = "MDB檔|*.mdb";
            this.saveFileDialog1.Title = "新增MDB檔";
            //
            // button1
            //
            this.button1.Location = new System.Drawing.Point(176, 136);
            this.button1.Name = "button1";
            this.button1.TabIndex = 0;
            this.button1.Text = "button1";
            this.button1.Click += new System.EventHandler(this.Button1Click);
            //
            // MainForm
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
            this.ClientSize = new System.Drawing.Size(292, 266);
            this.Controls.Add(this.button1);
            this.Name = "MainForm";
            this.Text = "MainForm";
            this.ResumeLayout(false);
        }
        #endregion
        void Button1Click(object sender, System.EventArgs e)
        {
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
             string MDBFilePath=saveFileDialog1.FileName;
                 ADOX.CatalogClass catNewMDB;
             catNewMDB = new ADOX.CatalogClass();
             catNewMDB.Create("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + MDBFilePath);
            }
        }

    }
}


用 C# 做類別元件
1.建立新類別檔：

   (1)檔案選單->建立新檔案->合併->選取C#類別(樹狀結構)->
   (2)選取右邊 Class Library-->設定專案名稱 myclass-->點選[建立]按鈕

2.新檔：myclass.cs

3.設定名稱空間(namespace)：(在其他專案使用此元件時，都與此有關)
   把namespace MyLibrary 改為 namespace myclass

4.新類別為myComponent ：
   public class myComponent //新類別(不可與名稱空間同名稱)
  {
  }

5.加入方法(method)：(加入返回值)
  public long Add (long val1, long val2) //方法
  {
    return val1 + val2;
  }
6.加入屬性：(包含get/set)

  private bool Test = false;
  public bool Extra //屬性
  {
    get
    {
     return Test;
    }
    set
    {
     Test = Extra;
    }
  }

7. 儲存專案
8. 編譯，在SharpDevelop Projects\myclass\bin\Debug資料夾產生myclass.dll檔
/*
 * 由 SharpDevelop .NET 免費開發工具 建立的 C# .NET 程式.
 * 作    者: 縱橫程式設計領域討論
 * 建立日期: 2004/8/7
 * 建立時間: 上午 12:04
 * 功    能: 用 C# 做元件
 * 修改日期: 2004/8/7 上午 12:04
 */
using System;
namespace myclass
{
 /// <summary>
 /// Description of myComponent.
 /// </summary>
 public class myComponent //新類別
 {
  public long Add (long val1, long val2) //方法
  {
    return val1 + val2;
  }

  private bool Test = false;
  public bool Extra //屬性
  {
    get
    {
     return Test;
    }
    set
    {
     Test = Extra;
    }
  }
 }
}


C# 自製類別元件DLL的使用
1.建立新專案：

   (1)檔案選單->建立新檔案->合併->選取C#類別(樹狀結構)

   (2)選取右邊 Console Application-->設定專案名稱 myclass_Test-->點選[建立]按鈕

2.新增引用檔：
  專案書籤->參考-->滑鼠右鍵-->新增參考-->選擇myclass.dll檔

3.設定名稱空間(namespace)：
   把namespace DefaultNamespace 改為 namespace myclass
4.如下程式碼：

/*
* 由 SharpDevelop .NET 免費開發工具 建立的 C# .NET 程式.
* 作    者:
* 建立日期: 2004/8/7
* 建立時間: 上午 01:25
* 功    能: C# 自製元件的使用
* 修改日期: 2004/8/7 上午 01:25
*/
using System;
using myclass;
namespace myclass
{
class MainClass
{
  public static void Main(string[] args)
  {
  myComponent mc = new myComponent(); //新建元件
   long ir=mc.Add(10,10);
   mc.Extra=false;
   Console.WriteLine(ir.ToString());   //答案 20
  }
}
}


Resourcer for .NET
Resourcer is an editor for .resources binaries and .resX XML file formats used with the .NET platform. The program allows the integration of bitmaps, icons and text strings into resource packages. Resourcer allows editing of name/string pairs, import of various kinds of data formats (bitmaps, icons, etc) and merging of resources from different sources.

Resourcer.zip - .NET Resourcer, Version 4.1.0.0
 http://www.aisto.com/roeder/dotnet/Download.aspx?File=Resourcer
另一套 Resource .NET 1.7 來至 http://www.tiantian.cn/dotnet/
http://www.tiantian.cn/dotnet/ResourceNet.zip
Resource Editor .NET(source code)
http://www.codeproject.com/cs/miscctrl/resource_editor.asp

  • Download source files - 23 Kb
  • Download demo project - 228 Kb

Sample Image - MainScreen.jpg


Reflector for .NET
Reflector is a class browser for .NET components. It supports assembly and namespace views, type and member search, XML documentation, call and callee graphs, IL, Visual Basic, Delphi and C# disassembler, dependency trees, base type and derived type hierarchies and resource viewers.

Reflector.zip - .NET Reflector, Version 4.0.17.0

 http://www.aisto.com/roeder/dotnet/Download.aspx?File=Reflector

建議使用此工具，不用＃D 內建的 Assembly scout 查詢 .Net FrameWork 內部函數，較易讓 #D 無反應狀態。


Java 語言轉換助理
Visual Studio .NET 整合了 JLCA (Java Language Conversion
Assistant，Java 語言轉換助理) 這套工具，可以幫助我們進行
Java-To-.NET 的轉換

請參考蔡學庸先生的專欄文章:
 http://www.microsoft.com/taiwan/msdn/columns/DoNet/jlca.htm

通通轉向c#語法...


微軟 C# 手冊
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csspec/html/CSharpSpecStart.asp


MSDN - ECMA Standardization
 http://msdn.microsoft.com/net/ecma/


1.免費的C#開發環境：Mono 1.0 for Windows/Linux
http://www.mono-project.com/about/

2.C#開發工具：SharpDevelop 1.0 RC3與Antechinus C# Editor 6.0
SharpDevelop 1.0 RC3
http://www.icsharpcode.net/OpenSource/SD/
Antechinus C# Editor 6.0(非免費軟體)
http://www.c-point.com/csharp.htm

3.超強程式編輯軟體：UltraEdit 10.0 (非免費軟體)與EditPlus 2.12(非免費軟體)


Java vs C# 語法對照表
http://www.javacamp.org/javavscsharp/

http://www.25hoursaday.com/CsharpVsJava.html

java 與 c# 的 語法對照表 對已經會java 想學c# 應該是很有幫助的


書       名：SharpDevelop Bible
製       作：Qoo1234
討論網站： 縱橫程式設計領域討論
博客網站： CSharp研究室
相關資料：Delphi K.Top討論區
主要內容：
         1. 認識SharpDevelop 開發工具
         2. NET FrameWork 簡介
         3. NET Class Library(BCL) 應用
         4. C# 程式語言
         5. C# 與 資料庫
         6. C# 與 GDI+
         7. C# 與 多媒體應用
         8. C# 與 網際網路應用
         9. C# 與 XML
         10.C# 與 Win32API 應用(NET 2.0 前使用的方式)
         11.C# 類別元件製作
                         ...等等
備         註：英文文章，僅供參考之用。
===============================================================