2016-11-10 9 views
-1

こんにちは私はそれぞれのアプリのAppManifest.xmlから取得したメトロアプリの名前を取得しようとしています。この目的のためにSHLoadIndirectStringが使用できることを知りました。手動でその機能をチェックすると、結果リソースを取得できませんでした。コードスニペットは次のようになります。SHLoadIndirectStringの戻り値はエラーコード

#include <iostream> 
using namespace std; 
#include <Shlwapi.h> 
int main(){ 
    LPWSTR output = L""; 
    LPWSTR input = L"@{Microsoft.BingMaps_2.1.3230.2048_x64__8wekyb3d8bbwe?ms-resource://Microsoft.BingMaps/resources/AppDisplayName}"; 
    int result = SHLoadIndirectString(input, output, sizeof(output), NULL); 
    cout<<output; 
    return 0; 
} 

戻り値「結果」は常に負の値です(アプリケーションごとに入力文字列を変更すると変更されます)。私を間違えて案内してください。ありがとう。

答えて

0

正しい答えが得られました。

#include <iostream> 

using namespace std; 
#include <Shlwapi.h> 
int main() 
{ 
    PWSTR output = (PWSTR) malloc(sizeof(WCHAR)*256); 


    PCWSTR input = L"@{C:\\Program Files\\WindowsApps\\Microsoft.BingMaps_2.1.3230.2048_x64__8wekyb3d8bbwe\\resources.pri?ms-resource://Microsoft.BingMaps/Resources/AppShortDisplayName}"; 
    int result = SHLoadIndirectString(input, output, 256, NULL); 

    cout<<output; 
    return 0; 
}