Using System;
Using System. Runtime. InteropServices;
Namespace FastCSharp
{
Class Class1
{
[STAThread]
Unsafe static void Main (string [] args)
{
// ComInvoke ();
// HelloWorld ();
// StructInvoke ();
// ClassInvode ();
// PointerInvoke ();
UnsafeMethod ();
}
// Call a com component
// Tlbimp tool
Public static void comInvoke ()
{
// String fileName = "c: windowsclock. avi ";
String fileName = @ "C: Documents and settingsadministratorwebwebapplication1中 dgdgdgmz.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 );
}
// Transfer the structure variable
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 [] is int Rect [,]? "+ B );
}
// Pass an object
Public static void classInvode ()
{
MySystemTime t = new MySystemTime ();
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service