C#調用Windows API函數的基本方式

一般整型参数声明:

[DllImport("user32.dll", CallingConvention = CallingConvention.StdCall] 
privatestaticexternint ShowWindow(IntPtr hWnd, int nShowCmd);

 

带字符串参数的API函数声明:

[DllImport("user32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
private static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);

 

posted @ 2018-03-15 18:26  寒风gg  阅读(122)  评论(0)    收藏  举报