1

I'm trying to make a program who use SHGetSetSettings to hide desktop icons (Windows10). But my code return me -1 when I change the value.

#include <iostream>
#include <ShlObj_core.h>
#include <Windows.h>

using namespace std;

void HideDesktopIcons() {
    SHELLSTATE shellstate;
    ZeroMemory(&shellstate, sizeof(shellstate));
    shellstate.fHideIcons=TRUE;
    shellstate.fShowExtensions = TRUE; //I change also extensions for test
    SHGetSetSettings(&shellstate, SSF_HIDEICONS|SSF_SHOWEXTENSIONS,TRUE);

    SHELLFLAGSTATE shellflagState;
    SHGetSettings(&shellflagState, SSF_HIDEICONS);
    cout << shellflagState.fHideIcons <<endl;
}

int main()
{
    HideDesktopIcons();
}

Consol return "-1" and icons are still there. . . need your light. thx

Arthur
  • 23
  • 2

0 Answers0