Welcome to shell: revealed Sign in | Join | Help
in Search

Retrieve desktop items to save them

Last post 03-23-2008, 8:57 AM by Tom87. 5 replies.
Sort Posts: Previous Next
  •  02-25-2008, 10:47 AM 7753

    Retrieve desktop items to save them

    Hi !

     

    I'm new to Shell Programming in C++, but I've some things to do with it.

    I need to know the position of each item on the Windows desktop (current and all users) in order to be able to hide or show them like I want.

     

    I've find how to enumerate objects on the Desktop (with a SHGetDesktopFolder and EnumObjects), but I don't know what to do after that.

    I'm able to use SHGetFileInfo and SHGetDataFromIDList on the objects, but I can't do what I want :

    • save icons (shortcuts, files, directories...) position
    • hide / show some icons

    Thanks for answers or ideas Smile
  •  02-29-2008, 1:58 PM 7769 in reply to 7753

    Re: Retrieve desktop items to save them

    I'm not too clear on your goals here, but you could QI on the IShellFolder to get IFolderView/IShellView which provide some of the functionality you describe.
    Christopher Davis (Shell)
  •  03-01-2008, 10:12 AM 7772 in reply to 7769

    Re: Retrieve desktop items to save them

    Hi,

    In fact, I want to modify and save the desktop Uset Interface. I'd like to be able to change icons' position, show/hide desktop items....

    With SHGetDesktopFolder and EnumObjects, I can know what is on the desktop (visible or not) , like "My Computer" special folder, shortcuts, and other files on the desktop.

    I want to retrieve/set the position of the icon corresponding to each enumerated object on the desktop view.

    I've tried with the standard Win32 API way, by sending messages on the ListView corresponding to the desktop, but I could only Set an item position : I couldn't retrieve it.

    I've read that it could work if I hook explorer.exe, but I don't see how to do that correctly.

     

    I've tried to query a IFolderView Interface from the  SHGetDesktopFolder return, but it returns that IFolderView isn't supported.

     

    Thanks for answer

    @+ 

  •  03-02-2008, 6:41 AM 7773 in reply to 7772

    Re: Retrieve desktop items to save them

    Ok, this time I can set and retrieve Items position on the desktop !

    I'm using the Win32 API, with SendMessage and a part of memory allocated in explorer.exe space with VirtualAllocEx.

    Tell me if you're interested in the source code.

    In brief I use the following functions : OpenProcess( explorer.exe ), VirtualAllocEx( hProcess ) / VirtualFreeEx, SendMessage(...), and ReadProcessMemory.

  •  03-03-2008, 1:01 PM 7776 in reply to 7773

    Re: Retrieve desktop items to save them

    That will work for some circumstances, but I would strongly suggest getting the IFolderView to perform these actions.

     I wasn't clear earlier.  You should call GetUIObjectOf for the IShellView of the namespace, and then QI for the IFolderView interface.


    Christopher Davis (Shell)
  •  03-23-2008, 8:57 AM 7831 in reply to 7776

    Re: Retrieve desktop items to save them

    Hi,

     I've made some tries with GetUIObjectOf, but I always get a "Not Implemented Yet" error.

    For the moment, I keep on the Win32 way, but I think it won't work if the user is not an administrator...

     

    If you have a sample code or a tutorial on GetUIObjectOf using in this case, could you send me the link to it ? ;)


     Thanks for help.

    Tom 

View as RSS news feed in XML
Powered by Community Server, by Telligent Systems © 2006 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement.