DllImport使用
1.Dll引用路径
(1)exe运行程序所在的目录
(2)System32目录
(3)环境变量目录
(4)自定义路径,如:DllImport(@"C:OJBinJudge.dll")
2..DllImport用法
[DllImport("User32.dll")]
private static extern IntPtr GetWindowDC(IntPtr hwnd); //找到User32.dll后直接调用其中的GetWindowDC()方法
[DllImport("User32.dll")]
private static extern int ReleaseDC(IntPtr hwnd, IntPtr hdc);
[DllImport("Kernel32.dll")]
private static extern int GetLastError();