how to get the current opened applications in windows using c++ or vb.net?

前端 未结 1 333
失恋的感觉
失恋的感觉 2021-01-21 09:10

i need the current opened applications(those that appear in the task bar) and NOT the currently running processes.

thanks

相关标签:
1条回答
  • 2021-01-21 09:34

    You need to enumerate all the top level windows (with the EnumWindows function); you have to skip:

    • the invisible windows (check the return value of the IsWindowVisible function or directly check if the window has the WS_VISIBLE style);
    • the windows with the extended style WS_EX_TOOLWINDOW, unless they have also the WS_EX_APPWINDOW extended style.

    All the others should be the ones shown in the taskbar (here's the full story).

    Then, if you want to get the process/thread owning each of the window, you can use the GetWindowThreadProcessId function.

    0 讨论(0)
提交回复
热议问题