Clipboard monitoring Recorder

Source: Internet
Author: User
// Getclipboarddlg. h: header file // # pragma once # include "afxwin. H "// cgetclipboarddlg dialog box class cgetclipboarddlg: Public cdialog {// construct public: cgetclipboarddlg (cwnd * pparent = NULL ); // standard constructor // data in the dialog box Enum {IDD = idd_getclipboard_dialog}; protected: Virtual void dodataexchange (cdataexchange * PDX); // DDX/DDV supports/protected: hicon m_hicon; // The generated message ing function virtual bool oninitdialog (); afx_msg void onsyscommand (uint NID, lparam); afx_msg void onpaint (); afx_msg hcursor onquerydragicon (); declare_message_map () Public: afx_msg void onbnclickedbutton1 (); file * FP; bool bstart; afx_msg void Merge (); clistbox m_list; cbutton m_start; cedit m_file; cbutton m_choice; int writefile (char * szbuf); void startlistenclipboard (void); afx_msg void upload (); Private: cstring strpremsg; public: afx_msg void onchangecbchain (hwnd hwndremove, hwnd hwndafter ); hwnd hnextwnd; afx_msg void ondestroy (); afx_msg void onbnclickedbutton4 (); cbutton m_clear ;};

Code directly. I don't want to write any text, so I'm lazy.

// Getclipboarddlg. CPP: implementation file // # include "stdafx. H "# include" getclipboard. H "# include" getclipboarddlg. H "# ifdef _ debug # define new debug_new # endif // class caboutdlg: Public cdialog {public: caboutdlg () in the caboutdlg dialog box for the" about "menu item of the application (); // dialog box data Enum {IDD = idd_aboutbox}; protected: Virtual void dodataexchange (cdataexchange * PDX); // DDX/DDV support // protected: declare_message_map ()}; caboutdlg:: caboutdlg (): CDIA Log (caboutdlg: IDD) {} void caboutdlg: dodataexchange (cdataexchange * PDX) {cdialog: dodataexchange (PDX);} Export (caboutdlg, cdialog) end_message_map () // dialog box cgetclipboarddlg: cgetclipboarddlg (cwnd * pparent/* = NULL */): cdialog (cgetclipboarddlg: IDD, pparent) {m_hicon = afxgetapp () -> loadicon (idr_mainframe);} void cgetclipboarddlg: dodataexchange (cdataexchange * PDX) {cdialog: dodat Aexchange (PDX); ddx_control (PDX, idc_list2, m_list); ddx_control (PDX, idc_button2, m_start); ddx_control (PDX, idc_edit1, m_file); ddx_control (PDX, idc_button1, m_choice); ddx_control (PDX, idc_button4, m_clear);} encode (numeric, cdialog) on_wm_syscommand () on_wm_paint () Evaluate () //} encode (idc_button1, & Signature :: onbnclickedbutton1) on_bn_clicked (IDC _ Button2, & amp; #: onbnclickedbutton2) values () on_bn_clicked (idc_button4, & tags: onbnclickedbutton4) end_message_map () // your message handler bool values :: oninitdialog () {cdialog: oninitdialog (); // set "about... "menu items are added to the system menu. // Idm_aboutbox must be in the range of system commands. Assert (idm_aboutbox & 0xfff0) = idm_aboutbox); Assert (idm_aboutbox <0xf000); cmenu * psysmenu = getsystemmenu (false); If (psysmenu! = NULL) {cstring straboutmenu; straboutmenu. loadstring (ids_aboutbox); If (! Straboutmenu. isempty () {psysmenu-> appendmenu (mf_separator); psysmenu-> appendmenu (mf_string, idm_aboutbox, straboutmenu); }}// set the icon of this dialog box. When the main window of the application is not a dialog box, the framework will automatically // execute this operation seticon (m_hicon, true); // set the big icon seticon (m_hicon, false ); // set the small icon // todo: add the additional initialization code bstart = false; FP = NULL; m_start.enablewindow (false); m_clear.enablewindow (false); hnextwnd = NULL; return true; // return true} void cgetclipboarddlg: onsyscommand (uint NID, lparam) {If (NID & 0xfff0) = idm_aboutbox) unless the focus is set to the control) {caboutdlg dlgabout; dlgabout. domodal ();} else {cdialog: onsys Command (NID, lparam) ;}// if you add the minimization button to the dialog box, you need the following code // to draw the icon. For MFC applications that use document/view models, // This will be automatically completed by the framework. Void cgetclipboarddlg: onpaint () {If (isiconic () {cpaintdc (this); // The device context sendmessage (wm_iconerasebkgnd, reinterpret_cast <wparam> (DC. getsafehdc (), 0); // center the icon in the rectangle of the workspace int cxicon = getsystemmetrics (sm_cxicon); int cyicon = getsystemmetrics (sm_cyicon); crect rect; getclientrect (& rect); int x = (rect. width ()-cxicon + 1)/2; int y = (rect. height ()-cyicon + 1)/2; // draw the icon DC. drawicon (X, Y, m_hicon) ;}Else {cdialog: onpaint () ;}// the system calls this function to display the cursor when the user drags the minimized window. Hcursor cgetclipboarddlg: onquerydragicon () {return static_cast 

:

The main problem is the clipboard, which has never been used before. The specific operation is:

Now you need to execute this-> setclipboardviewer (); // set this window to the clipboard monitoring chain

Then, the system responds to the wm_ondrawclipboard message, and there are still some aftercare measures ..

Some resources of the thunder series are not made together. You need a copy address for a set. A thunder download box will pop up to download 40 sets and 40 sets.

If all the eggs are broken, you can directly Save the resource address to the file, copy all the addresses directly, and then create a new thunder task to download all the resources, which is more convenient.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.