如何以编程方式操作 Windows 桌面图标位置? [英] How can I programmatically manipulate Windows desktop icon locations?

查看:47
本文介绍了如何以编程方式操作 Windows 桌面图标位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几年前,我无意中尝试编写一个小应用程序来保存我的策略放置的桌面图标,因为我厌倦了在某些事件重置它们时将它们拖回原来的位置.我花了太多时间没有找到查询方法,更不用说保存和重置图标的桌面位置了,我放弃了.

Several years back, I innocently tried to write a little app to save my tactically placed desktop icons because I was sick of dragging them back to their locations when some event reset them. I gave up after buring WAY too much time having failed to find a way to query, much less save and reset, my icons' desktop position.

有谁知道 Windows 在哪里保存这些信息,以及是否有 API 来设置它们?

Anyone know where Windows persists this info and if there's an API to set them?

谢谢,理查德

推荐答案

如果我没记错的话,桌面只是一个 ListView,你必须发送 LVM_SETITEMPOSITION 消息到桌面句柄.

If I'm not mistaken the desktop is just a ListView, and you'll have to send the LVM_SETITEMPOSITION message to the handle of the desktop.

我在谷歌上搜索了一些 c# 代码,但找不到示例,但我确实找到了以下文章.Torry:...获取/设置桌面图标的位置?.它是 delphi 代码,但我发现它非常易读,并且通过一些 P/Invokes,您将能够将其转换为 c#.

I googled a bit for some c# code and couldn't find a example, but I did found the following article. Torry: ...get/set the positions of desktop icons?. It's delphi code, but I find it very readable and with some P/Invokes you'll be able to translate it to c#.

这篇关于如何以编程方式操作 Windows 桌面图标位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆