Главная страница | назад





Article #17106: Windows 95 Desktop, ListView

 Question and Answer Database
FAQ2106C.txt Windows 95 Desktop, ListView
Category :Windows API
Platform :All
Product :C++Builder 1.x
Question:
How do I get a handle to the Windows 95 Desktop to access the
Desktop icons?
Answer:
The Windows 95 Desktop is overlayed with a ListView component.
You simply need to get a handle to the ListView. Example:
HWND GetDesktopListViewHandle();
HWND TForm1::GetDesktopListViewHandle()
{
HWND hwnd;
hwnd = FindWindow("ProgMan",NULL);
hwnd = GetWindow(hwnd, GW_CHILD);
hwnd = GetWindow(hwnd, GW_CHILD);
return hwnd;
}
Once you have the handle, you can use the list view-related API
functions in the CommCtrl unit to manipulate the desktop. See
the LVM_xxxx messages in the Win32 online help.
For example the following line of code:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
SendMessage(GetDesktopListViewHandle(),
LVM_ARRANGE,
LVA_ALIGNLEFT,
0);
}
will align the desktop icons to the left side of the
Windows 95 desktop.
7/2/98 10:32:32 AM

Last Modified: 01-SEP-99