在开发一个项目需要一段代码能够获得当前活动应用程序的名称,比如Word或者Notepad等多谢!!

解决方案 »

  1.   

    GetForegroundWindow Function--------------------------------------------------------------------------------The GetForegroundWindow function returns a handle to the foreground window (the window with which the user is currently working). The system assigns a slightly higher priority to the thread that creates the foreground window than it does to other threads. SyntaxHWND GetForegroundWindow(VOID);
    Return ValueThe return value is a handle to the foreground window. The foreground window can be NULL in certain circumstances, such as when a window is losing activation.