我正在使用C#WPF [英] I am using C# WPF

查看:127
本文介绍了我正在使用C#WPF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在wpf中添加任何应用程序快捷方式,例如,一个用户将点击 按钮,然后选择安装和选择哪个应用程序,程序将 用exe图标创建带有原始图标的快捷方式,当用户点击shourtcut时程序
将启动并开启。

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

推荐答案

嗨    aaydinalp,



>>我正在尝试添加任何应用程序快捷方式例如,在wpf中,一个用户将点击 按钮,然后选择安装和选择哪个应用程序,程序将 使用exe图标创建原始
的快捷方式,并在用户点击shourtcut 程序将启动并打开。




你可以帮帮我吗?我 不知道怎么做,图标应该移动 用鼠标....



您可以尝试参考以下步骤并进行测试你自己。



1:您可以尝试使用注册表来读取已安装的应用程序列表。以下链接供您参考。



C#获取安装的程序:
$


使用C#代码获取本地计算机中已安装软件的列表
$


如何查找已安装程序的路径
in C#


$


2:然后,获取文件路径和默认的exe图标。并且图标随鼠标移动。

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 - 拖动图像

$


3:最后,添加到您的"快捷方式"中。逻辑。



注册表重定向器:

$


此外,如果您可以通过将有用的帖子标记为答案来关闭该主题,将不胜感激。如果他们遇到类似问题,这将有助于其他成员快速找到解决方案。如果您有新问题,可以启动一个新的
线程,其中包含所有必要的代码片段,以便能够从头开始重现您的问题以及有关结果的详细说明,包括任何异常消息。请不要在同一个帖子中提出几个问题。






最好的问候,


Yong Lu



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


这篇关于我正在使用C#WPF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆