在之前的问题中,有一份关于如何隐藏桌面项的解释:
如何以编程方式隐藏桌面图标?
由于某种原因,这段代码对我无效。
我本来想在上面的链接中发表评论,但我没有足够的权限评论其他人的问题...
有什么想法是怎么出了问题?桌面根本没有被隐藏。
更新:此外,我尝试使用以下代码(正如此处所建议的),但仍然没有效果:
我本来想在上面的链接中发表评论,但我没有足够的权限评论其他人的问题...
有什么想法是怎么出了问题?桌面根本没有被隐藏。
更新:此外,我尝试使用以下代码(正如此处所建议的),但仍然没有效果:
struct SHELLSTATE
{
bool fShowAllObjects;
bool fShowExtensions;
bool fNoConfirmRecycle;
bool fShowSysFiles;
bool fShowCompColor;
bool fDoubleClickInWebView;
bool fDesktopHTML;
bool fWin95Classic;
bool fDontPrettyPath;
bool fShowAttribCol;
bool fMapNetDrvBtn;
bool fShowInfoTip1;
bool fHideIcons1;
bool fWebView1;
bool fFilter1;
bool fShowSuperHidden1;
bool fNoNetCrawling1;
UInt32 dwWin95Unused;
uint uWin95Unused;
long lParamSort;
int iSortDirection;
uint version;
uint uNotUsed;
bool fSepProcess;
bool fStartPanelOn;
bool fShowStartPage;
bool fAutoCheckSelect;
bool fIconsOnly;
bool fShowTypeOverlay;
uint fSpareFlags;
}
class MyClass
{
const UInt32 SSF_HIDEICONS = 0x00004000;
[DllImport("Shell32.dll")]
static extern void SHGetSetSettings(ref SHELLSTATE state, UInt32 dwMask, bool bSet);
static void Foobar()
{
SHELLSTATE stateOfMind = new SHELLSTATE();
Console.WriteLine("Set to true:");
SHGetSetSettings(ref stateOfMind, SSF_HIDEICONS, true);
Console.ReadKey();
Console.WriteLine("Set to false:");
SHGetSetSettings(ref stateOfMind, SSF_HIDEICONAS, false);
Console.ReadKey();
}
}