我使用的是鉤子函式,但是獲取不到檔案
qt加載dll,dll里設定的鉤子:
安裝鉤子是這么寫的
g_hDesktopWnd = ::FindWindow((LPCWSTR)"Progman",NULL);
if (NULL == g_hDesktopWnd)
{
OutputDebugString(L"Can not find desktop window handle");
g_hDesktopWnd = FindShellWindow();
if (NULL == g_hDesktopWnd)
return FALSE;
}
DWORD targetThreadid = GetWindowThreadProcessId(g_hDesktopWnd, NULL);
g_Hook = SetWindowsHookEx(WH_GETMESSAGE, GetMsgProc, g_Inst, targetThreadid);
桌面滑鼠鍵盤的訊息已勾到,但是獲取檔案就是獲取不到,
LRESULT CALLBACK GetMsgProc(int code, WPARAM wParam, LPARAM lParam)
{
MSG* pMsg = (MSG*)lParam;
if( NULL != pMsg && pMsg->hwnd != NULL )
{
cout<<"message =============== "<<pMsg->message<<endl;
switch(pMsg->message)
{
case WM_LBUTTONUP:
HWND hDeskTop = 0;
hDeskTop = ::FindWindowEx(hDeskTop,0,(LPCWSTR)"Progman",NULL);
hDeskTop = ::FindWindowEx(hDeskTop,0,(LPCWSTR)"SHELLDLL_DefView",NULL);
hDeskTop = ::FindWindowEx(hDeskTop,0,(LPCWSTR)"SysListView32",NULL);
char buf[100] = {0};
ListView_GetItemText(hDeskTop,1,0,(LPWSTR)buf,100);
int TotalNum = ListView_GetItemCount( hDeskTop );
sprintf(buf,"%d",TotalNum);
MessageBoxA(NULL, buf, "tip", MB_OK);
break;
}
}
return ::CallNextHookEx(g_Hook, code, wParam, lParam);
ListView_GetItemText和ListView_GetItemCount什么都獲取不到,
使用spy++查看

有沒有大神幫我看看啊,問題出在哪里
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/122652.html
標籤:進程/線程/DLL
上一篇:如何實作播放記憶體中視頻資料?
下一篇:如何判斷整個的滑鼠事件?
