ÐèÇ󣺽ػñ×ÀÃæ´°¿ÚÊó±êµ¥»÷ʼþ£¬½âÎöËùÑ¡ÖеÄ×ÀÃæ
Item£¬²¢½«½âÎöºóµÄ item ÐÅÏ¢·¢Ë͸øÖ÷µ÷³ÌÐò£¬²¢½«ÐÅÏ¢ÏÔʾÔÚÒ»¸ö´°¿ÚÉÏÃæ¡£ÈçÏÂͼ£º

˼·£º
1. È·¶¨HOOKµÄÀàÐÍ¡£ºÜÃ÷ÏÔ£¬ÕâÒ»¸ö½ø³ÌÍâµÄHOOK£¬ÎÒÃǵÄÓ¦ÓóÌÐòDesktopCaptor2.exe
ÐèÒª²¶»ñ Explorer.exe Õâ¸ö½ø³ÌµÄ×ÀÃæ´°¿ÚËùÔÚµÄÏ̵߳ÄÏûÏ¢¡£Òò´Ë£¬ÐèÒª½«HOOK¹ý³Ì·ÅÔÚÒ»¸ö¶ÀÁ¢µÄDLL
ÖÐÈ¥£¬È»ºóʹÓà SetWindowsHookEx ½«HOOK¹ý³Ì°²×°µ½HOOKÁ´ÖÐÈ¥¡£
2. ÈçºÎ½âÎöµã»÷µÄ×ÀÃæ Item ÐÅÏ¢£¿Õâ¸öÆäʵҲ±È½ÏºÃ×ö£¬ÓÉÓÚ×ÀÃæ´°¿Ú±¾ÉíÊÇÒ»¸ö
listview ¿Ø¼þ£¨²»½âÊÍ£©£¬Òò´Ë£¬ÎÒÃÇ¿ÉÒÔͨ¹ý listview Äõ½×ÀÃæ´°¿ÚµÄ¼òµ¥ÐÅÏ¢¡£
3. ÈçºÎ½«½âÎöºóµÄ×ÀÃæ Item ÐÅÏ¢·¢Ë͸øÖ÷µ÷³ÌÐò£¬ÈÃËüµ¯³öÒ»¸ö´°¿Ú£¬²¢ÏÔʾ×ÀÃæ
Item ÐÅÏ¢£¿ÎÒÃÇÕâÀï²ÉÓÃWM_COPYDATA ½«´Ó×ÀÃæ½ø³Ì»ñÈ¡µ½ÐÅÏ¢·¢Ë͵½ÎÒÃǵÄÓ¦ÓóÌÐò¡£
¹¤³ÌĿ¼ÈçÏ£º

ÔÚÖ÷µ÷³ÌÐò£¨DesktopCaptor2.exe£©ÊÇÒ»¸ö¼òµ¥Win32
DialogµÄ³ÌÐò¡£ÔÚÕâ¸ö³ÌÐòÖУ¬ÎÒÃǸÉÁËÁ½¼þÊÂÇ飺
1. µ÷Óà DekstopHook ¹¤³ÌÖÐµÄ DesktopHook.h
ÖеÄÁ½¸öµ¼³öº¯Êý£¬Í¨¹ýÕâÁ½¸öº¯Êý£¬¶Ô HOOK ¹ý³Ì°²×°ºÍÐ¶ÔØ¡£
2. ½ÓÊÕÀ´×ÔÓÚExplorer.exe ½ø³Ì·¢Ë굀 WM_COPYDATA
ÏûÏ¢£¬»¹Ô×ÀÃæ Item Êý¾Ý£¬²¢½«ÔÚµã»÷×ÀÃæ Item µÄλÖõ¯³öÒ»¸ö´°¿Ú³öÀ´£¬ÏÔʾ Item ÐÅÏ¢¡£ÖÁÓÚÕâ¸ö´°¿ÚÈçºÎÖÆ×÷£¬ÎҾͲ»ÔÙÃèÊöÁË¡£
ÒÔÏÂΪ²¿·Ö´úÂ룺
#include "CommonDef.h" #include "DesktopHook.h" #include "FloatWin.h" const UINT WM_DESKTOP_CLICKED_ITEM = RegisterWindowMessage(L"WM_DESKTOP_CLICKED_ITEM"); BOOL g_isCaptured = FALSE; CFloatWin* g_floatWin = NULL; INT_PTR WINAPI DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ; int WINAPI _tWinMain(HINSTANCE hinstExe, HINSTANCE, PTSTR pszCmdLine, int) { HWND hwnd = FindWindow(TEXT("#32770"), TEXT("DesktopCaptor2")); if (IsWindow(hwnd)) { // An instance is already running, show a messagebox MessageBox(GetForegroundWindow(), L"An instance is already running", L"Error", MB_ICONERROR); } else { DialogBox(hinstExe, MAKEINTRESOURCE(IDD_DESKTOP_CAPTOR), NULL, DlgProc); } return(0); } INT_PTR CALLBACK DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam); switch (message) { case WM_INITDIALOG: { // Set icon for the application SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM) LoadIcon((HINSTANCE) GetWindowLongPtr(hDlg, GWLP_HINSTANCE), MAKEINTRESOURCE(IDI_DESKTOPCAPTOR2))); // Set dialog's position int nScreenWidth = ::GetSystemMetrics(SM_CXSCREEN); int nScreenHeight = ::GetSystemMetrics(SM_CYSCREEN); RECT rect = { 0 }; GetWindowRect(hDlg, &rect); SetWindowPos( hDlg, HWND_TOP, nScreenWidth - (rect.right - rect.left), 0, 0, 0, SWP_NOSIZE); g_floatWin = CFloatWin::getInstance(); } return (INT_PTR)TRUE; case WM_COMMAND: { UINT wmId = LOWORD(wParam); UINT wmEvent = HIWORD(wParam); switch (wmId) { case IDOK: case IDCANCEL: EndDialog(hDlg, LOWORD(wParam)); return (INT_PTR)TRUE; case IDC_START_CAPTOR: if (FALSE == g_isCaptured) { <strong> </strong>g_isCaptured = CreateDesktopEventCaptor(hDlg); } break; case IDC_STOP_CAPTOR: if (TRUE == g_isCaptured) { CloseDesktopEventCaptor(); g_isCaptured = FALSE; } break; default: return DefWindowProc(hDlg, message, wParam, lParam); } } break; case WM_COPYDATA: { COPYDATASTRUCT* pCopyData = (COPYDATASTRUCT*)lParam; if (pCopyData->dwData == WM_DESKTOP_CLICKED_ITEM) { DesktopItemData itemData(*(DesktopItemData*)pCopyData->lpData); g_floatWin->ShowWindow(TRUE, &itemData); } } break; } return (INT_PTR)FALSE; } |
ÎÒÃÇÖØµã˵Ã÷Ò»ÏÂDekstopHookDLLÖеÄÄÚÈÝ¡£
DesktopHook.h Öж¨ÒåµÄÊÇһЩµ¼³ö½Ó¿Ú£¬´úÂëÈçÏ£º
#ifndef _DESKTOPHOOK_H_ #define _DESKTOPHOOK_H_ //#ifdef __cplusplus //extern "C" { //#endif #ifdef DESKTOPHOOK_EXPORTS #define DESKTOPHOOK_API __declspec(dllexport) #else #define DESKTOPHOOK_API __declspec(dllimport) #endif typedef struct DESKTOPHOOK_API _DesktopItemData { POINT point; WCHAR szName[MAX_PATH]; // The desktop item's name. int nIndex; // The desktop item's index on desktop. _DesktopItemData() { ZeroMemory(szName, MAX_PATH); point.x = point.y = 0; nIndex = -1; } _DesktopItemData(POINT pt, WCHAR* pszName, int nIx) { if (NULL != pszName) { point.x = pt.x; point.y = pt.y; ZeroMemory(szName, MAX_PATH); _tcscpy_s(szName, MAX_PATH, pszName); nIndex = nIx; } } _DesktopItemData(const _DesktopItemData& itemDataRef) { point.x = itemDataRef.point.x; point.y = itemDataRef.point.y; ZeroMemory(szName, MAX_PATH); _tcscpy_s(szName, MAX_PATH, itemDataRef.szName); nIndex = itemDataRef.nIndex; } _DesktopItemData& operator = (const _DesktopItemData& itemDataRef) { point.x = itemDataRef.point.x; point.y = itemDataRef.point.y; ZeroMemory(szName, MAX_PATH); _tcscpy_s(szName, MAX_PATH, itemDataRef.szName); nIndex = itemDataRef.nIndex; return *this; } } DesktopItemData, *LPDesktopItemData; EXTERN_C DESKTOPHOOK_API BOOL CreateDesktopEventCaptor(HWND hNotifierhWnd); EXTERN_C DESKTOPHOOK_API void CloseDesktopEventCaptor(); //#ifdef __cplusplus //} //#endif #endif // _DESKTOPHOOK_H_ |
ÆäÖУº
1. DesktopItemData ½á¹¹ÌåÊÇÓÃÀ´´æ·Å½âÎö×ÀÃæ Item
µÄÊý¾Ý¡£
2. CreateDesktopEventCaptor º¯ÊýÊÇÓÃÀ´°²×°
HOOK£»
3. CloseDesktopEventCaptor º¯ÊýÊÇÓÃÀ´Ð¶ÔØ HOOK£»
ÒÔÏÂÊÇ DesktopHook.cpp ÖеÄʵÏÖ´úÂ룺
// DesktopHook.cpp : Defines the exported functions for the DLL application. // #include "stdafx.h" #include "DesktopHook.h" #include "DesktopItem.h" #pragma data_seg("SHARED_DATA") HWND g_hNotifierWnd = NULL; HHOOK g_hPostMsgHook = NULL; WCHAR g_szBuf[MAX_PATH] = {0}; #pragma data_seg() #pragma comment(linker, "/SECTION:SHARED_DATA,RWS") // Global data const UINT WM_DESKTOP_CLICKED_ITEM = RegisterWindowMessage(L"WM_DESKTOP_CLICKED_ITEM"); HMODULE g_hModule; HWND g_hDesktopWnd = NULL; // The low-order word specifies the x-coordinate of the cursor. // The high-order word specifies the y-coordinate of the cursor. BOOL g_bDoubleClick = FALSE; UINT_PTR g_timerID = 0; POINT g_clickPt; CDesktopItem g_singleClickDesktopItem = CDesktopItem::Empty; DesktopItemData g_desktopItemData; // Declaration of methods. static HWND FindShellWindow(); static LRESULT CALLBACK GetMsgProc(int code,WPARAM wParam,LPARAM lParam); static VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime); EXTERN_C DESKTOPHOOK_API BOOL CreateDesktopEventCaptor(HWND hNotifierhWnd) { g_hDesktopWnd = FindShellWindow(); if (NULL == g_hDesktopWnd) { OutputDebugString(L"Can not find desktop window handle"); return FALSE; } g_hNotifierWnd = hNotifierhWnd; // Get desktop handle's thread id. DWORD targetThreadid = ::GetWindowThreadProcessId(g_hDesktopWnd, NULL); // Hook post message. g_hPostMsgHook = ::SetWindowsHookEx(WH_GETMESSAGE, &GetMsgProc, g_hModule, targetThreadid); if (g_hPostMsgHook != NULL) { return TRUE; } return FALSE; } EXTERN_C DESKTOPHOOK_API void CloseDesktopEventCaptor() { if (g_hPostMsgHook != NULL) { ::UnhookWindowsHookEx(g_hPostMsgHook); } } HWND FindShellWindow() { // Sometimes, we can't find the desktop window when we use this function, but we must // find it's handle, so we do a loop to find it, but at most we find for 10 times. UINT uFindCount = 0; HWND hSysListView32Wnd = NULL; while (NULL == hSysListView32Wnd && uFindCount < 10) { HWND hParentWnd = ::GetShellWindow(); HWND hSHELLDLL_DefViewWnd = ::FindWindowEx(hParentWnd, NULL, L"SHELLDLL_DefView", NULL); hSysListView32Wnd = ::FindWindowEx(hSHELLDLL_DefViewWnd, NULL, L"SysListView32", L"FolderView"); if (NULL == hSysListView32Wnd) { hParentWnd = ::FindWindowEx(NULL, NULL, L"WorkerW", L""); while((!hSHELLDLL_DefViewWnd) && hParentWnd) { hSHELLDLL_DefViewWnd = ::FindWindowEx(hParentWnd, NULL, L"SHELLDLL_DefView", NULL); hParentWnd = FindWindowEx(NULL, hParentWnd, L"WorkerW", L""); } hSysListView32Wnd = ::FindWindowEx(hSHELLDLL_DefViewWnd, 0, L"SysListView32", L"FolderView"); } if (NULL == hSysListView32Wnd) { Sleep(1000); uFindCount++; } else { break; } } return hSysListView32Wnd; } // The message which is "Post" type can be hook in this hook procedure. LRESULT CALLBACK GetMsgProc(int code, WPARAM wParam, LPARAM lParam) { MSG* pMsg = (MSG*)lParam; if( NULL != pMsg && pMsg->hwnd != NULL ) { switch(pMsg->message) { case WM_MOUSEMOVE: { //OutputDebugStringW(L"Mouse Move"); } break; case WM_LBUTTONUP: { //OutputDebugStringW(L"WM_LBUTTONUP"); if (g_bDoubleClick) { OutputDebugString(L"g_bDoubleClick == TRUE"); g_singleClickDesktopItem = CDesktopItem::Empty; g_bDoubleClick = FALSE; ::KillTimer(NULL, g_timerID); } else { OutputDebugString(L"g_bDoubleClick == FALSE"); ::KillTimer(NULL, g_timerID); g_clickPt.x = pMsg->pt.x; g_clickPt.y = pMsg->pt.y; g_singleClickDesktopItem = pMsg; g_timerID = ::SetTimer(NULL, 1, ::GetDoubleClickTime(), TimerProc); } } break; case WM_LBUTTONDBLCLK: g_bDoubleClick = TRUE; break; } } return ::CallNextHookEx(g_hPostMsgHook, code, wParam, lParam); } VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) { UNREFERENCED_PARAMETER(hwnd); UNREFERENCED_PARAMETER(uMsg); UNREFERENCED_PARAMETER(idEvent); UNREFERENCED_PARAMETER(dwTime); if (g_timerID == idEvent && g_bDoubleClick == FALSE && g_singleClickDesktopItem != CDesktopItem::Empty) { OutputDebugString(L"SendMessageTimeout Process begin"); wstring strName = g_singleClickDesktopItem.GetItemName(); //_tcscpy_s(g_szBuf, MAX_PATH, strName.c_str()); //::PostMessage(g_hNotifierWnd, WM_DESKTOP_CLICKED_ITEM, NULL, (LPARAM)g_szBuf); ZeroMemory(&g_desktopItemData, sizeof(DesktopItemData)); g_desktopItemData.point.x = g_clickPt.x; g_desktopItemData.point.y = g_clickPt.y; _tcscpy_s(g_desktopItemData.szName, MAX_PATH, strName.c_str()); g_desktopItemData.nIndex = g_singleClickDesktopItem.GetItemIndex(); COPYDATASTRUCT copyData; copyData.dwData = (UINT_PTR)WM_DESKTOP_CLICKED_ITEM; copyData.cbData = sizeof(DesktopItemData); copyData.lpData = &g_desktopItemData; DWORD_PTR rt = -1; SetActiveWindow(g_hNotifierWnd); SetForegroundWindow(g_hNotifierWnd); //SendMessageTimeout(g_hNotifierWnd, WM_COPYDATA,
(WPARAM)g_hDesktopWnd, (LPARAM)?Data, SMTO_NORMAL, 1000, &rt); SendMessage(g_hNotifierWnd, WM_COPYDATA, (WPARAM)g_hDesktopWnd, (LPARAM)?Data); OutputDebugString(L"SendMessageTimeout Process end"); } ::KillTimer(NULL, g_timerID); } |
˵Ã÷£ºÔÚ¸ÃʵÏÖÖУ¬CreateDesktopEventCaptor º¯ÊýÓë
CloseDesktopEventCaptor º¯Êý±» DesktopCaptor2.exe ½ø³Ìµ÷Ó㬴Ëʱ£¬DesktopHook.dll
»á±»¼ÓÔØµ½ DesktopCaptor2.exe ËùÔÚ½ø³Ì£¬µ±Ê¹Óà CreateDesktopEventCaptor
º¯Êýºó£¬HOOK ¹ý³Ìº¯Êý GetMsgProc »á±»°²×°µ½ Explorer.exe ½ø³ÌÖÐÈ¥£¬´Ëʱ£¬DesktopHook.dll
»á±»¼ÓÔØµ½ Explorer.exe ÖÐÈ¥¡£µ±ÓÃÊó±êµ¥»÷×ÀÃæ Item ʱ£¬ÏûÏ¢½«±»´«µÝµ½ GetMsgProc
ÖÐÈ¥£¬È»ºó£¬ÔÚÕâ¸öº¯ÊýÖз¢ËÍÒ»¸ö WM_COPYDATA ÏûÏ¢¸øDesktopCaptor2 µÄ´°¿Ú£¬Êµ¼ÊÉÏ£¬ÕâÏ൱ÓÚÊÇ
Explorer.exe ½ø³Ì·¢Ë굀 WM_COPYDATA ÏûÏ¢µ½ DesktopCaptor2.exe
½ø³Ì ¡£ÐèҪעÒâÒ»µãµÄÊÇ£¬ÔÚ GetMsgProc Öз¢ËÍÏûÏ¢µÄʱºò£¬g_hNotifierWnd ±ØÐëÒªÉèÖóÉΪ¹²ÏíÊý¾Ý£¬ÒòΪËüÊÇDesktopCaptor2.exe
½ø³ÌÔÚµ÷Óà DesktopHook.dll µÄ CreateDesktopEventCaptor º¯ÊýµÄʱºò±»ÉèÖõģ¬ÒªÏëÔÚExplorer.exe½ø³ÌÖмÌÐøÓÐЧ£¬ÐèÒª½«Ö®ÉèÖÃΪ
DLL¹²ÏíÊý¾Ý¡£
ÁíÍ⣬ÕâÀﻹÓÐÁíÍâÁ½¸öÎÊÌ⣺
1¡¢ÈçºÎÕÒµ½ Desktop ´°¿Ú¾ä±ú£¿ ͨ¹ýSpy++£¬ÎÒÃǵõ½£º

ÆäÖУ¬À¶É«²¿·Ö¾ÍÊÇÎÒÃǵÄ×ÀÃæ´°¿Ú¾ä±ú¡£ÎÒÃÇµÄ FindShellWindow
º¯Êý¾ÍÊÇΪÁ˸ÉÕâ¸öÊÂÇ飬µ«ÊÇÓÐʱºò£¬Õâ¸öº¯Êý»áʧ°Ü£¬Òò´Ë£¬ÎÒÃÇ×î¶àÑ»·10´ÎÈ¥²éÕÒ×ÀÃæ´°¿Ú¾ä±ú¡£
2¡¢WH_GETMESSAGE ÀàÐ͵ÄÏûÏ¢ HOOK Ö»Äܹ³×¡Ê¹Óà PostMessage
·½Ê½·¢Ë͵ÄÏûÏ¢£¬ÕâµãºÜÖØÒª£¬·ñÔò£¬Èç¹ûÊÇÒÔSendMessage·¢Ë͵ķ½Ê½£¬ÔòÐèҪʹÓà WH_CALLWNDPROC
»òÕß WH_CALLWNDPROCRET µÄ HOOK ·½Ê½¡£
3¡¢ÈçºÎ½âÎöµã»÷×ÀÃæµÄ Item ÐÅÏ¢£¿
ʵ¼ÊÉÏ£¬ÓÉÓÚ×ÀÃæ´°¿Ú±¾ÉíÊÇÒ»¸ö ListView ¿Ø¼þ£¬Í¨¹ýListView
µÄ¿Ø¼þµÄAPI£¬ÎÒÃDZãÄܹ»Äõ½Ïà¹ØµÄÐÅÏ¢£¨µ±È»ÕâÀïÖ»ÊÇÒ»¸ö¼òµ¥µÄÐÅÏ¢£¬Éî²ã´ÎµÄÐÅÏ¢»¹ÐèÒªÉî¾ò£©¡£
Ê×ÏÈ£¬Í¨¹ýÏÂÃæµÄº¯Êý£¬Äܹ»Äõ½Ñ¡ÖÐµÄ Item µÄ ID£¬ÆäÖÐ hwnd
¾ÍÊÇ×ÀÃæ´°¿Ú¾ä±ú¡£
UINT ListView_GetSelectedCount( HWND hwnd ); |
Æä´Î£¬Í¨¹ýÏÂÃæµÄº¯Êý£¬´«ÈëÑ¡ÖÐµÄ Item µÄ ID£¬ÎÒÃǾÍÄÜÄõ½ Item ¶ÔÓ¦µÄÎı¾¡£
void ListView_GetItemText( HWND hwnd, int iItem, int iSubItem, LPTSTR pszText, int cchTextMax ); |
ÔÚÕâÀÎÒʹÓÃÁËÒ»¸ö CDesktopItem ÀàÀ´×¨ÃŸÉÕâ¸öÊÂÇé¡£
ÖÁ´Ë£¬¼òµ¥µÄ´úÂë½²½â¾Í½áÊøÁË¡£
ÏÂÃæËµÒ»ÏÂÈçºÎµ÷ÊÔ¡£
ÒòΪ±¾Àý×ÓÊǽø³ÌÍâµÄHOOK£¬Òò´Ëµ÷ÊÔÆðÀ´Óкܶ಻·½±ãµÄµØ·½¡£µ÷ÊÔµÄÄÑ´¦ÔÚÓÚÈçºÎµ÷ÊÔHOOK¹ý³Ìº¯Êý¡£ÏÈ˵һ¸ö¼òµ¥µÄÀý×Ó£¬¿ÉÄÜ´ó¼Ò¾³£»áÓöµ½ÕâÖÖÇé¿ö£º¼ÙÈçÒ»¸öSolutionÏÂÓÐProjectAºÍ
Project B£¬ËüÃǶ¼ÊÇexe£¬µ«Éæ¼°µ½Ï໥·¢ÏûÏ¢£¬ÓÐÈ˾ͻá´ò¿ª2¸öVisual Studio£¬Í¬Ê±½øÐе÷ÊÔ£¬ÕâÑùµÄÈ·¿ÉÒÔ×öµ½£¬µ«×ܸоõ²»Ì«·½±ã¡£Êµ¼ÊÉÏ£¬ÔÚͬһ¸öVisual
StudioÖУ¬ÊÇ¿ÉÒÔͬʱµ÷ÊÔ¶à¸ö³ÌÐòµÄ¡£¶ÔÓÚ¸Õ¸ÕÕâÖÖÇé¿ö£¬Ö»ÐèÒªÔÚÿ¸öProject A ºÍ ProjectB
ÉÏÃæ·Ö±ðÓÒ»÷->Debug->Start new instance ¼´¿É¡£
È»¶ø£¬¶ÔÓÚ±¾Àý£¬ÕâÑù×öÊDz»Ðеģ¬ÒòΪ DesktopHook ÊÇÒ»¸öDLL¹¤³Ì£¬±¾ÉíÊÇÎÞ·¨½øÐжÀÁ¢µ÷ÊԵġ£Òò´Ë£¬ÒªÏëͬʱµ÷ÊÔ
DesktopCaptor2 ¹¤³ÌºÍ DesktopHook ¹¤³Ì£¬ÐèÒª°´ÈçϲÙ×÷£º
1¡¢½«DesktopHook¹¤³ÌÉèÖÃΪĬÈÏÆô¶¯µÄ¹¤³Ì¡£Èçͼ£º

2¡¢½« DesktopCaptor2 ¹¤³Ìͨ¹ý ÓÒ»÷->Debug->Start
new instance Æô¶¯ÆðÀ´£¬µã»÷ Start Desktop Captor °´Å¥Æô¶¯HOOK£¬½«DesktopHook
.dll ×¢Èëµ½½ø³ÌExplorer.exeÖÐÈ¥¡£

3¡¢½« DesktopHook ¹¤³Ìµ½¸½¼Ó£¨Attach£©µ½Explorer.exe½ø³ÌÖÐÈ¥¡£Èçͼ£º
µã»÷ Tools->Attachto Process...

È»ºóÕÒµ½Explorer.exe£¬µã»÷Attach°´Å¥¼´¿É¡£
ͨ¹ýÉÏÃæµÄÕâÖÖ·½Ê½£¬ÎÒÃǾÍÄܹ»ºÜ¼òµ¥µÄÔÚÒ»¸ö¹¤³ÌÖУ¬µ÷ÊÔÁ½¸ö²»Í¬µÄ½ø³ÌµÄ³ÌÐò¡£Õâʱ£¬ÎÒÃǽ«¶Ïµã´òÔÚDesktopHook
¹¤³ÌµÄº¯Êý GetMsgProcÖУ¬²¢ÔÚDesktopCaptor2 ¹¤³Ì WM_COPYDATA ÄÚ²¿´òÉ϶ϵ㣬·¢ÏÖµã»÷×ÀÃæÍ¼±êʱ£¬¶Ïµã»á×ßµ½GetMsgProcÄÚ²¿£¬µ±·¢ËÍÍêÏûÏ¢ºó£¬¾ÍÄÜ×ßµ½DesktopCaptor2
¹¤³Ì WM_COPYDATA ÄÚ²¿¡£¡£
ÁíÍ⣬Äãµ÷ÊÔµÄʱºò£¬Òª×¢Òâһϵ±Ç°Óû§µÄȨÏÞÒÔ¼°Visual StudioµÄȨÏÞ¡£Èç¹ûµ±Ç°Óû§ÊǹÜÀíÔ±×éÓû§£¬¶øÄãµÄVisualStudioÊÇÒÔ¹ÜÀíÔ±Æô¶¯½øÀ´µÄ£¬ÄÇôDesktopCaptor2.exe½«Ò²ÊǹÜÀíԱȨÏÞ£¬µ«´Ëʱ£¬Explorer.exeÈ´ÊÇÆÕͨȨÏÞ£¬´Ëʱ£¬ÔÚGetMsgProcÄÚ²¿·¢ËÍWM_COPYDATAÊÇ»á³öÏÖÎÊÌâµÄ£¬ÒòΪ²»ÄÜÏò¸ßȨÏÞ½ø³Ì·¢ËÍÏûÏ¢¡£
|