Code : Tout sélectionner
HWND hProgman = FindWindow(_T("Progman"), 0);
HWND hDesktopWnd = GetDesktopWindow();
// If the main Program Manager window is found
if (hProgman)
{
// Get and load the main List view window containing the icons (found using Spy++).
HWND hShellViewWin = FindWindowEx(hProgman, 0, _T("SHELLDLL_DefView"), 0);
if (hShellViewWin)
hDesktopListView = FindWindowEx(hShellViewWin, 0, _T("SysListView32"), 0);
else
// When this fails (happens in Windows-7 when picture rotation is turned ON), then look for the WorkerW windows list to get the
// correct desktop list handle.
// As there can be multiple WorkerW windows, so iterate through all to get the correct one
do
{
hWorkerW = FindWindowEx( hDesktopWnd, hWorkerW, _T("WorkerW"), NULL );
hShellViewWin = FindWindowEx(hWorkerW, 0, _T("SHELLDLL_DefView"), 0);
} while (hShellViewWin == NULL && hWorkerW != NULL);
// Get the ListView control
hDesktopListView = FindWindowEx(hShellViewWin, 0, _T("SysListView32"), 0);
}
return hDesktopListView;
Code : Tout sélectionner
Procedure GetHandle()
hDesktopWnd=GetDesktopWindow_();
Debug "hDesktopWnd = " + hDesktopWnd
hProgman = FindWindow_("Progman",0)
Debug "hProgram : " + hProgman
hShellViewWin=FindWindowEx_(hProgman, 0, "SHELLDLL_DefView", 0) ;
Debug "hShellViewWin : " + hShellViewWin
If hShellViewWin
Debug "hShellViewWin OK"
hDesktopListView= FindWindowEx_(hShellViewWin, 0, "SysListView32", 0)
Debug "hDesktopListView SysListView32: " + hDesktopListView
Else
hWorkerW = FindWindowEx_( hDesktopWnd, hWorkerW, "WorkerW", #Null )
Debug "hWorkerW" + hWorkerW
hShellViewWin = FindWindowEx_(hWorkerW, 0, "SHELLDLL_DefView", 0)
Debug "hShellViewWin : " + hShellViewWin
While hShellViewWin = NULL And hWorkerW <> NULL;
; Get the ListView control
hDesktopListView = FindWindowEx_(hShellViewWin, 0, "SysListView32", 0)
Debug "hDesktopListView : " + hDesktopListView
Wend
EndIf
Procedurereturn hDesktopListView
Code : Tout sélectionner
while (hShellViewWin == NULL && hWorkerW != NULL);
que j'ai changé en
While hShellViewWin = NULL And hWorkerW <> NULL;
Si quelqu'un à la solution ce serait top.
Merci.