locked
Can I control the order that Icons are added to the desktop? RRS feed

  • Question

  • I am using Visual Studio 2008.  I have a setup project that installs four different applications and three documentation files.  The setup will place icons on the desktop to run the applications and open the doc files.  The icons appear to be placed on the desktop in alphabetical order.  Can I specifiy the order of placement (not alphabetical)?

    Thanks, Dave


    Dave R&D SW Engineer Agilent Technologies
    Monday, August 22, 2011 9:57 PM

Answers

  • 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. 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#.

    I think the replay from Davy Landman in this discussion can solve your request.

    Or you can use this solution:

    http://www.mjtnet.com/blog/2006/01/19/set-desktop-icon-positions/

    http://www.hackishcode.com/showstory.php?id=66&

     

    And this aspect questions is Windows development questions, not the deployment questions, so if you have any more the Windows development questions, you can go to this forum for expert help:

    http://social.msdn.microsoft.com/Forums/en-US/windowsgeneraldevelopmentissues/threads

     

    Best wishes,


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    • Marked as answer by Mike Dos Zhang Thursday, September 1, 2011 5:20 AM
    Tuesday, August 23, 2011 5:58 AM
  • Maybe there's a product has combine this feature in their installer tool, and made it as a built in function for their installer tool.

    And according to this, I think it also said that the setting icon position function is not a built in feature in common installer tools, the programmer need to do it with the installer tool:

    http://www.mjtnet.com/blog/2006/01/19/set-desktop-icon-positions/

    Well if you’re automating software installations for your end-user or customer machines you may want to make sure the desktop icons are always in the same place. You may want to put a link to your support site in the top right of the screen, for example, so that your customer can always find it.

    So, I can make sure your doubt that the Visual Studio Setup project has no this built in feature. You will need to program it yourself as I said before if you want it in feature, or not if you will remove this feature.

     

    If you want discontinue this case, and would you mind any helpful replies will be marked as answer, those will be helpful to peoples who want to implement this function.

    Thanks!

     

    Have a nice weekend!


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    • Marked as answer by Mike Dos Zhang Thursday, September 1, 2011 5:21 AM
    Saturday, August 27, 2011 5:06 AM

All replies

  • 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. 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#.

    I think the replay from Davy Landman in this discussion can solve your request.

    Or you can use this solution:

    http://www.mjtnet.com/blog/2006/01/19/set-desktop-icon-positions/

    http://www.hackishcode.com/showstory.php?id=66&

     

    And this aspect questions is Windows development questions, not the deployment questions, so if you have any more the Windows development questions, you can go to this forum for expert help:

    http://social.msdn.microsoft.com/Forums/en-US/windowsgeneraldevelopmentissues/threads

     

    Best wishes,


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    • Marked as answer by Mike Dos Zhang Thursday, September 1, 2011 5:20 AM
    Tuesday, August 23, 2011 5:58 AM
  • Mike,

    I feel this is most definitely a setup and deployment issue.  I am not wanting to wriae a program to manage desktop icon positions, I want my resulting MSI package to place the 7 icons on the desktop in a particular order, not necessarily at a specific location.  The way the MSI currently places the icons on the desktop appears to be in the alphabetical order of the icon labels.

    Dave


    Dave R&D SW Engineer Agilent Technologies
    Tuesday, August 23, 2011 4:39 PM
  • If you just want order yours icons, and do not want to effect others files on the desktop, then you will need manage the icon location like my last post described.

    And if you do not mind effect others files on the desktop, then you can change the registry key value as this discussion's solution:

    http://stackoverflow.com/questions/294116/where-does-the-system-store-the-icons-position

    All these are manipulate the Windows System, and the functions writing and testing should be in a common application instead of the Installer project, and the last step is move the code to the Custom Action, the installer only has the response to execute the function codes, so this is why it is a Windows development question. The deployment only like a copy/move files process, the other function is only combined with the installer, but the technical is not the same.

    I do not mean I will not give you any more help, I just want you to know which forum will show you more expert help to solve your requirement more quickly.

     

    If there's any concern, please feel free to let me know.

    Best wishes,


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, August 24, 2011 5:27 AM
  • Hi DaveTMG,

    I am writing to check the status of the issue on your side. 

    What about this problem now?

     

    Best wishes,


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, August 26, 2011 3:49 AM
  • Mike,

    If the install cannot control the order of icon placement on the Desktop, then I do not want to take this issue any further.  I do not have the time now to design, code and test an application to control the order of the icon placement.  It seems to me that this capability would be a standard feature supported by the setup and deployment tools.

    Dave


    Dave R&D SW Engineer Agilent Technologies
    Friday, August 26, 2011 4:30 PM
  • Maybe there's a product has combine this feature in their installer tool, and made it as a built in function for their installer tool.

    And according to this, I think it also said that the setting icon position function is not a built in feature in common installer tools, the programmer need to do it with the installer tool:

    http://www.mjtnet.com/blog/2006/01/19/set-desktop-icon-positions/

    Well if you’re automating software installations for your end-user or customer machines you may want to make sure the desktop icons are always in the same place. You may want to put a link to your support site in the top right of the screen, for example, so that your customer can always find it.

    So, I can make sure your doubt that the Visual Studio Setup project has no this built in feature. You will need to program it yourself as I said before if you want it in feature, or not if you will remove this feature.

     

    If you want discontinue this case, and would you mind any helpful replies will be marked as answer, those will be helpful to peoples who want to implement this function.

    Thanks!

     

    Have a nice weekend!


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    • Marked as answer by Mike Dos Zhang Thursday, September 1, 2011 5:21 AM
    Saturday, August 27, 2011 5:06 AM
  • I have used many install tools over the years, and I have never come across one that allows control of the order of icons on the desktop. I don't believe there is one. In any case the desktop arrangement is owned by the user and Microsoft generally doesn't allow programs to manipulate it. Raymond Chen's blog "The Old New Thing" has plenty of cases where people believed that their apps are so special they should be allowed to do whatever they want to the user's desktop.
    Phil Wilson
    Monday, August 29, 2011 7:50 PM