我想提取UWP应用的图标以构建类似“打开方式”菜单的资源管理器。
借助于SHAssocEnumHandlers,我设法将关联的应用程序扩展到给定的文件扩展名。
使用IAssocHandler :: GetIconLocation我可以通过UWP Apps(Microsoft Edge)获得类似以下信息:
@ {Microsoft.MicrosoftEdge_41.16299.371.0_neutral__8wekyb3d8bbwe?ms-resource://Microsoft.MicrosoftEdge/Files/Assets/MicrosoftEdgeSquare44x44.png}
如果我在此字符串上使用SHLoadIndirectString,则会得到:
C:\ WINDOWS \ SystemApps \ Microsoft.MicrosoftEdge_8wekyb3d8bbwe \ Assets \ MicrosoftEdgeSquare44x44.scale-100.png
但这是错误的图标(没有颜色或对比度)。
在目录中:
C:\ WINDOWS \ SystemApps \ Microsoft.MicrosoftEdge_8wekyb3d8bbwe \ Assets \
有很多不同的图片。我不知道如何选择正确的图标。
我尝试查找“ AppxManifest.xml”,但对于不同的应用程序,我看起来完全不同。
对于非UWP应用,我得到的图标位置为:
C:\ WINDOWS \ system32 \ NOTEPAD.EXE
然后我可以使用:
Icon.ExtractAssociatedIcon()
Run Code Online (Sandbox Code Playgroud)
一切都很好。我没有找到使用UWP App执行相同操作的任何方法。
在 .proto 文件中使用导入时出现“找不到文件”错误。我正在使用 Rider,但在使用 Visual Studio 时遇到了同样的问题。
第一个原型文件:
syntax = "proto3";
import "/fileToImport.proto";
service GreeterAPI {
rpc SayHello (SayHelloRequest) returns (SayHelloResponse);
}
message SayHelloRequest {
string name = 1;
}
message SayHelloResponse {
string answer = 1;
}
Run Code Online (Sandbox Code Playgroud)
我要导入的第二个 proto 文件:
syntax = "proto3";
message Foo {
string bar = 1;
}
Run Code Online (Sandbox Code Playgroud)
这两个文件在项目目录中彼此相邻。
.csprjo 文件:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.10.1" />
<PackageReference Include="Grpc.Core" Version="2.25.0" />
<PackageReference Include="Grpc.Tools" Version="2.25.0" />
<Protobuf Include="**/*.proto" />
</ItemGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)
如果我在没有导入行的情况下构建项目,一切都很好。但是使用导入行我得到“找不到文件”
我知道我可以使用 …