none
I am using C# WPF

    Question

  • I am trying to add any application shortcut in wpf for example one user will click  button and then select which app exe install and select and program will  create shortcut with original with exe icons and when user click shourtcut  program will start and open.

    Can you help me about it?I  don't know how to do it and icon should move  with mouse....

    Thursday, December 6, 2018 1:01 PM

All replies

  • Hi   aaydinalp,

    >>I am trying to add any application shortcut in wpf for example one user will click  button and then select which app exe install and select and program will  create shortcut with original with exe icons and when user click shourtcut  program will start and open.

    Can you help me about it?I  don't know how to do it and icon should move  with mouse....

    You can try to refer the following steps and make a test by yourself.

    1: You can try to use of registry to read the list of installed applications. The following links for your reference.

    C# Get Installed Programs:

    Get List of Installed Software in Local Machine using C# Code

    How To Find Path Of Installed Program(s) in C#


    2: Then, get the filepath and default exe icons. And icon move with mouse.

              var sysicon = System.Drawing.Icon.ExtractAssociatedIcon(@"D:\SQLServer2017-SSEI-Expr.exe");
                                var bmpSrc = System.Windows.Interop.Imaging.CreateBitmapSourceFromHIcon(
                                            sysicon.Handle,
                                            System.Windows.Int32Rect.Empty,
                                            System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
                                sysicon.Dispose();
    
    C# WPF -Drag an image


    3: Finally, add to your "shortcut" logic.

    Registry Redirector:


    Besides, It would be appreciated if you could close the thread by marking helpful posts as an answer. This will help other members to find the solution quickly if they have faced the similar issue. If you have a new question you can start a new thread with all necessary code snippets for anyone else to be able to reproduce your issue from scratch along with a detailed description about the results including any exception messages. Please don't ask several questions in the same thread.


    Best Regards,

    Yong Lu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, December 7, 2018 2:56 AM
    Moderator
  • great answer but how can I add to SQL database about your answer
    Friday, December 7, 2018 10:11 AM

  • Hi   aaydinalp,

    >>but how can I add to SQL database about your answer

    Not very clear about what you want described.

    The above suggestions give you ideas, you can try and make a test on my side.

    If you have a new question you can start a new thread. Please don't ask several questions in the same thread.

    Thank you for your understanding.


    Best Regards,

    Yong Lu

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, December 10, 2018 6:11 AM
    Moderator