当前位置: 首页>>代码示例>>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;未经允许,请勿转载。