首页 新闻 赞助 找找看

怎么获得当前激活程序的名字呀

0
悬赏园豆:20 [已解决问题] 解决于 2015-11-18 10:36

怎么获得当前激活程序的名字呀比如我现在打开outlook,QQ,IE,什么的 当我激活IE窗口的时候 得到IE 知道我当前激活的窗口是IE呢

暗夜中的精灵的主页 暗夜中的精灵 | 初学一级 | 园豆:77
提问于:2015-11-17 13:48
< >
分享
最佳答案
0

[DllImport("user32.dll", EntryPoint = "GetForegroundWindow")]
public static extern IntPtr GetForegroundWindow();

GetForegroundWindow() //可以获取当前激活窗体的句柄

[DllImport("user32.dll", EntryPoint = "GetWindowText")]
public static extern int GetWindowText(IntPtr hwnd, StringBuilder lpString, int cch);

GetWindowText//可以根据窗体的句柄获取窗体标题。

收获园豆:20
凝冰 | 小虾三级 |园豆:685 | 2015-11-17 17:28
其他回答(1)
0

GetForegroundWindow

geeksnail | 园豆:368 (菜鸟二级) | 2015-11-17 13:52
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册