如何获取拷贝和粘贴消息
如题,谢谢先
程序代码:
#include <Windows.h> #include "resource.h" HINSTANCE hInst; HWND hDlg,hNext; BOOL CALLBACK DlgProc(HWND hDlg,UINT Msg,WPARAM w,LPARAM l){ switch(Msg){ case WM_INITDIALOG: hNext=SetClipboardViewer(hDlg); return TRUE; case WM_DRAWCLIPBOARD:{ OpenClipboard(hDlg); HANDLE hMem=GetClipboardData(CF_TEXT); SetDlgItemTextA(hDlg,IDC_MSG,(LPSTR)GlobalLock(hMem)); GlobalUnlock(hMem); CloseClipboard(); SendMessage(hNext,WM_DRAWCLIPBOARD,0,0); FLASHWINFO fwi; fwi.cbSize=sizeof(fwi); fwi.dwFlags=FLASHW_CAPTION; fwi.dwTimeout=10; fwi.hwnd=hDlg; fwi.uCount=5; FlashWindowEx(&fwi); return TRUE; } case WM_CLOSE: ChangeClipboardChain(hDlg,hNext); EndDialog(hDlg,w); return TRUE; } return FALSE; } int CALLBACK WinMain(HINSTANCE hInstance,HINSTANCE,LPSTR lpCmdLine,int nShowCmd){ hInst=hInstance; return (int)DialogBoxParam(hInstance,MAKEINTRESOURCE(IDD_MAIN),NULL,DlgProc,NULL); }