最新下载
热门教程
- 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();
相关文章
- 《无限暖暖》围巾蚯蚓具体作用介绍 12-24
- 《无限暖暖》星夜守望连衣裙获得方法介绍 12-24
- 《无限暖暖》魔物试炼幻境解锁方法介绍 12-24
- 《无限暖暖》磐岩晶石获得方法介绍 12-24
- 《无限暖暖》巨石岩仔打法攻略分享 12-24
- 《无限暖暖》布布果在哪 12-24