[DllImport("user32.dll")]
private static extern long GetForegroundWindow();
private static extern long GetForegroundWindow();
解决方案 »
- C# winform 设置TextBox的字体样式
- 關於計算C#中的加減乘除
- 两个简单线程间如何切换?
- 请问如何给一个XML片段加上一个根节点啊?
- SQL语句问题,谢谢~你一看就应该知道
- 报表显示问题。寻求帮助。感激。。。
- Service与应用程序间如何通讯?(即.系统服务端写好了,但是如果编写一个控制程序,给服务端发命令?)
- 有人做过组件开发吗?
- CollectionBase,ICollection,ILIST,IEnumerator 各有什么特别?
- C# Socket.Receive 得到的数据,都是一个或多个完整的tcp包吗?
- 请问一个奇怪的问!
- File.Copy不支持http地址吗?
t=GetForeGroundWindow();
private static extern IntPtr GetForegroundWindow();[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern long SetWindowLong(IntPtr hWnd, int nIndex, long dwNewLong);[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern long GetWindowLong( IntPtr hWnd,int nIndex);
public static extern int GetWindowRect (IntPtr hWnd , ref System.Drawing.Rectangle lpRect);
public static extern int GetForegroundWindow ();
api精灵FOR C# 2.35
http://www.webtropy.com/articles/Win32-API-DllImport-art9.asp
http://msdn.microsoft.com/vstudio/default.aspx?pull=/library/en-us/dndotnet/html/win32map.asp
例如:这个函数
[DllImport("kernel32.dll", EntryPoint="GetWindowsDirectory")]
public static extern int GetWindowsDirectory (
string lpBuffer,
int nSize
);
写在那里
怎么调用啊
是不是还要使用这个using System.Runtime.InteropServices;语句啊?
在你需要使用的地方声明
[DllImport("kernel32.dll", EntryPoint="GetWindowsDirectory")]
public static extern int GetWindowsDirectory (
string lpBuffer,
int nSize
);
在需要调用的地方 int a = GetWindowsDirectory (lpBuffer,nSize);