精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>编程开发>>● Delphi>>图形界面和窗体>>取得Win95的桌面ListView句柄

主题:取得Win95的桌面ListView句柄
发信人: daji(妲姬)
整理人: teleme(2001-04-27 09:17:20), 站内信件
Windows 95 的桌面是一个ListView组件,部分函数被重写。
可以通过下面的函数取得该组件的句柄。

function GetDesktopListViewHandle: THandle; 
var 
 S: String; 
begin 
  Result := FindWindow('ProgMan', nil); 
  Result := GetWindow(Result, GW_CHILD); 
  Result := GetWindow(Result, GW_CHILD); 
  SetLength(S, 40); 
  GetClassName(Result, PChar(S), 39); 
  if PChar(S) <> 'SysListView32' then Result := 0; 
end; 

一旦取得句柄,就可以使用相应的CommCtrl单元中的API函数进行一些控制。
相关内容可查阅Win32帮助中的LVM_xxxx消息。

例如:
  SendMessage(GetDesktopListViewHandle,LVM_ALIGN,LVA_ALIGNLEFT,0); 
会使桌面的图标在Windows 95桌面的左边对齐排列。

(在Windows98中是否一样,我没试过)



----
                ^^                                    `_ ,
 ^^           |    |    |      Hello,                -(_)-
      ^^     )_)  )_)  )_)         My Friends!        ,  `
姬海涵      )___))___))___)\                  ,
           )____)____)_____)\\              __)\_
妲姬网苑 _____|____|____|____\\\__    (\_.-'    a`-.
---------\                   /--------(/~~````(/~^^`--------
  ^^^^^ ^^^^^^^^^^^^^^^^^^^^^         http://daji.xoasis.com
    ^^^^      ^^^^     ^^^    ^^      [email protected]
         ^^^^      ^^^
 

[关闭][返回]