Home > Software engineering >  Qt reading drag and drop files, but the file was not drag qt application interface, how to implement
Qt reading drag and drop files, but the file was not drag qt application interface, how to implement

Time:09-25

I use a hook function, but can't get the file
Qt load the DLL, the DLL in the set of hook:

Install hooks is written so
 
G_hDesktopWnd=: : FindWindow ((LPCWSTR) "Progman", NULL);
If (NULL==g_hDesktopWnd)
{
OutputDebugString (L "Can not find the 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);


Desktop mouse and keyboard has been on the news, but access to the file is less than,
 
LRESULT a CALLBACK GetMsgProc (int code, WPARAM WPARAM, LPARAM LPARAM)
{
LParam MSG * pMsg=(MSG *);
If (NULL!=pMsg & amp; & PMsg - & gt; The HWND!=NULL)
{
Cout<" Message==============="& lt; The switch (pMsg - & gt; 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, buf LPWSTR, 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 and ListView_GetItemCount couldn't get anything,
Using spy++ see


Have a great god help me to look at ah, where is the problem
  • Related