當前位置: 首頁>>代碼示例>>C#>>正文


C# EntryPointNotFoundException類代碼示例

本文整理匯總了C#中System.EntryPointNotFoundException的典型用法代碼示例。如果您正苦於以下問題:C# EntryPointNotFoundException類的具體用法?C# EntryPointNotFoundException怎麽用?C# EntryPointNotFoundException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EntryPointNotFoundException類屬於System命名空間,在下文中一共展示了EntryPointNotFoundException類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetMyNumber

//引入命名空間
using System;
using System.Runtime.InteropServices;

public class Example
{
   [DllImport("user32.dll")]
   public static extern int GetMyNumber();
   
   public static void Main()
   {
      try {
         int number = GetMyNumber();
      }
      catch (EntryPointNotFoundException e) {
         Console.WriteLine("{0}:\n   {1}", e.GetType().Name,  
                           e.Message);
      } 
   }
}
開發者ID:.NET開發者,項目名稱:System,代碼行數:20,代碼來源:EntryPointNotFoundException

輸出:

EntryPointNotFoundException:
Unable to find an entry point named 'GetMyNumber' in DLL 'User32.dll'.

示例2: Main

//引入命名空間
using System;
using System.Runtime.InteropServices;

public class Example
{
   [DllImport("TestDll.dll")]
   public static extern int Double(int number);

   public static void Main()
   {
      Console.WriteLine(Double(10));
   }
}
開發者ID:.NET開發者,項目名稱:System,代碼行數:14,代碼來源:EntryPointNotFoundException

輸出:

Unhandled Exception: System.EntryPointNotFoundException: Unable to find 
an entry point named 'Double' in DLL '.\TestDll.dll'.
at Example.Double(Int32 number)
at Example.Main()

示例3: MessageBox

//引入命名空間
using System;
using System.Runtime.InteropServices;

public class Example
{
   [DllImport("user32.dll", CharSet = CharSet.Unicode, ExactSpelling = true )]
   public static extern int MessageBox(IntPtr hwnd, String text, String caption, uint type);
 
   [DllImport("user32.dll", CharSet = CharSet.Unicode, ExactSpelling = true )]
   public static extern int MessageBoxW(IntPtr hwnd, String text, String caption, uint type);

   public static void Main()
   {
      try {
         MessageBox(new IntPtr(0), "Calling the MessageBox Function", "Example", 0);
      }
      catch (EntryPointNotFoundException e) {
         Console.WriteLine("{0}:\n   {1}", e.GetType().Name,  
                           e.Message);
      }

      try {
         MessageBoxW(new IntPtr(0), "Calling the MessageBox Function", "Example", 0);
      }
      catch (EntryPointNotFoundException e) {
         Console.WriteLine("{0}:\n   {1}", e.GetType().Name,  
                           e.Message);
      }
   }
}
開發者ID:.NET開發者,項目名稱:System,代碼行數:31,代碼來源:EntryPointNotFoundException

示例4: Main

//引入命名空間
using System;
using System.Runtime.InteropServices;

public class Example
{
   [DllImport("TestDll.dll", EntryPoint = "?Double@@YAHH@Z")]
   public static extern int Double(int number);

   public static void Main()
   {
      Console.WriteLine(Double(10));
   }
}
開發者ID:.NET開發者,項目名稱:System,代碼行數:14,代碼來源:EntryPointNotFoundException

輸出:

20

示例5: SayGoodMorning

//引入命名空間
using System;

public static class StringUtilities
{
   public static String SayGoodMorning(String name)
   {
      return String.Format("A top of the morning to you, {0}!", name);
   }
}
開發者ID:.NET開發者,項目名稱:System,代碼行數:10,代碼來源:EntryPointNotFoundException

示例6: Main

//引入命名空間
using System;
using System.Runtime.InteropServices;

public class Example
{
   [DllImport("StringUtilities.dll", CharSet = CharSet.Unicode )]
   public static extern String SayGoodMorning(String name);

   public static void Main()
   {
      Console.WriteLine(SayGoodMorning("Dakota"));
   }
}
開發者ID:.NET開發者,項目名稱:System,代碼行數:14,代碼來源:EntryPointNotFoundException

輸出:

Unhandled Exception: System.EntryPointNotFoundException: Unable to find an entry point 
named 'GoodMorning' in DLL 'StringUtilities.dll'.
at Example.GoodMorning(String& name)
at Example.Main()

示例7: Main

//引入命名空間
using System;

public class Example
{
   public static void Main()
   {
       Console.WriteLine(StringUtilities.SayGoodMorning("Dakota"));
   }
}
開發者ID:.NET開發者,項目名稱:System,代碼行數:10,代碼來源:EntryPointNotFoundException

輸出:

A top of the morning to you, Dakota!


注:本文中的System.EntryPointNotFoundException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。