プロセスが必要な場合は、この投稿を参照してください@Nick Perkins と @hb2pencil が非常に優れたソリューションを提供してくれました。
開いているすべてのアプリケーション タイトルを取得するには、以下のコードを使用できます。このコードは、ドライバーの 1 つでも使用しています。
ここにも同様の質問がある別の投稿があり、@nymk が解決策を提供しました。
import ctypes
EnumWindows = ctypes.windll.user32.EnumWindows
EnumWindowsProc = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int))
GetWindowText = ctypes.windll.user32.GetWindowTextW
GetWindowTextLength = ctypes.windll.user32.GetWindowTextLengthW
IsWindowVisible = ctypes.windll.user32.IsWindowVisible
def foreach_window(hwnd, lParam):
titles = []
if IsWindowVisible(hwnd):
length = GetWindowTextLength(hwnd)
buff = ctypes.create_unicode_buffer(length + 1)
GetWindowText(hwnd, buff, length + 1)
titles.append(buff.value)
print buff.value
return titles
def main():
EnumWindows(EnumWindowsProc(foreach_window), 0)
#end of main
if __name__ == "__main__":
main()