最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
C#中与未操控语句交互运作
时间:2022-07-02 11:11:04 编辑:袖梨 来源:一聚教程网
using System;
using System.Runtime.InteropServices;
namespace FastCSharp
{
class Class1
{
[STAThread]
unsafe static void Main(string[] args)
{
// comInvoke();
// helloWorld();
// StructInvoke();
// classInvode();
// PointerInvoke();
unsafeMethod();
}
// 调用一个com组件
// tlbimp工具
public static void comInvoke()
{
//string fileName = "c:windowsclock.avi";
string fileName = @"C:Documents and SettingsAdministrator桌面WebApplication1心中心密咒dgmz.wma";
QuartzTypeLib.FilgraphManager graphManager = new QuartzTypeLib.FilgraphManagerClass();
QuartzTypeLib.IMediaControl mc = (QuartzTypeLib.IMediaControl)graphManager;
mc.RenderFile(fileName);
mc.Run();
Console.WriteLine("Hello World");
Console.ReadLine();
}
public static void helloWorld()
{
Win32Invoke.MessageBox(0,"Hello World","Platform Invoke Sample",0);
}
// 传递结构变量
public static void StructInvoke()
{
Point p = new Point();
p.x = 1;
p.y = 1;
Rect r = new Rect();
r.left = 0;
r.bottom = 2;
r.right = 2;
r.top = 0;
bool b = Win32Invoke.PtInRect(ref r,p);
System.Console.WriteLine("Point[1,1] is int Rect[0,0,2,2] ?" +b );
}
// 传递一个对象
public static void classInvode()
{
MySystemTime t = new MySystemTime();
using System.Runtime.InteropServices;
namespace FastCSharp
{
class Class1
{
[STAThread]
unsafe static void Main(string[] args)
{
// comInvoke();
// helloWorld();
// StructInvoke();
// classInvode();
// PointerInvoke();
unsafeMethod();
}
// 调用一个com组件
// tlbimp工具
public static void comInvoke()
{
//string fileName = "c:windowsclock.avi";
string fileName = @"C:Documents and SettingsAdministrator桌面WebApplication1心中心密咒dgmz.wma";
QuartzTypeLib.FilgraphManager graphManager = new QuartzTypeLib.FilgraphManagerClass();
QuartzTypeLib.IMediaControl mc = (QuartzTypeLib.IMediaControl)graphManager;
mc.RenderFile(fileName);
mc.Run();
Console.WriteLine("Hello World");
Console.ReadLine();
}
public static void helloWorld()
{
Win32Invoke.MessageBox(0,"Hello World","Platform Invoke Sample",0);
}
// 传递结构变量
public static void StructInvoke()
{
Point p = new Point();
p.x = 1;
p.y = 1;
Rect r = new Rect();
r.left = 0;
r.bottom = 2;
r.right = 2;
r.top = 0;
bool b = Win32Invoke.PtInRect(ref r,p);
System.Console.WriteLine("Point[1,1] is int Rect[0,0,2,2] ?" +b );
}
// 传递一个对象
public static void classInvode()
{
MySystemTime t = new MySystemTime();
相关文章
- 《绝区零》伊芙琳培养材料汇总 01-24
- 《无限暖暖》1.2春节兑换码一览 01-24
- 《网上国网》查询阶梯档位方法 01-24
- 《蛋仔派对》神游贺岁盲盒获取方法 01-24
- 《炉石传说》星际联动盗贼卡组玩法介绍 01-24
- 皮革珊瑚属于珊瑚中的 01-24