import win32clipboard

import win32gui

获取user32.dll的API

    user32 = windll.user32

获取当前窗口句柄

    hwnd = user32.GetForegroundWindow()

获取句柄对应的应用程序

    app = win32gui.GetWindowText(hwnd)

    print app