Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用wix获取程序文件文件夹的本地化值_Wix_Windows Installer - Fatal编程技术网

如何使用wix获取程序文件文件夹的本地化值

如何使用wix获取程序文件文件夹的本地化值,wix,windows-installer,Wix,Windows Installer,我使用wix中的ProgramFiles64文件夹来获取ProgramFiles文件夹 在我的安装程序中 问题是它显示的是c:\程序文件,而不是c:\程序 这是法国的价值观 它仍然安装到正确的文件夹,但我的用户问为什么 他们看不到法国的价值 我已经用orca打开了msi,我看到ProgramFiles64文件夹是这样的 我想这不是wix特有的问题,而是windows安装程序的问题 如何使用wix获取Program Files文件夹的本地化值?您看到的是Win32文件系统路径,它从Windows

我使用wix中的ProgramFiles64文件夹来获取ProgramFiles文件夹 在我的安装程序中

问题是它显示的是c:\程序文件,而不是c:\程序 这是法国的价值观

它仍然安装到正确的文件夹,但我的用户问为什么 他们看不到法国的价值

我已经用orca打开了msi,我看到ProgramFiles64文件夹是这样的 我想这不是wix特有的问题,而是windows安装程序的问题


如何使用wix获取Program Files文件夹的本地化值?

您看到的是Win32文件系统路径,它从Windows Vista开始不再本地化。您需要的是shell的本地化显示路径

Windows Installer在其内置UI中仅显示文件系统路径。我不太确定wixburn用户界面,但它很可能只显示文件系统路径

您可以编写DLL自定义操作(请参阅和参考)以获取显示路径

下面是一个简单的控制台应用程序的C++代码,演示如何将文件系统路径转换为显示路径。在自定义操作中,您将调用以获取包含安装路径的directory属性的值,使用类似于我的示例的代码将其转换为显示路径,最后调用以将显示路径分配给将在UI中显示的另一个属性

#include <Windows.h>
#include <ShlObj.h>    // Shell API
#include <Propkey.h>   // PKEY_* constants
#include <atlcomcli.h> // CComPtr
#include <atlbase.h>   // CComHeapPtr
#include <iostream>
#include <io.h>
#include <fcntl.h>

// Convert a filesystem path to the shell's localized display path.
HRESULT GetDisplayPathFromFileSystemPath( LPCWSTR path, PWSTR* ppszDisplayPath )
{
    CComPtr<IShellItem2> pItem;
    HRESULT hr = SHCreateItemFromParsingName( path, nullptr, IID_PPV_ARGS( &pItem ) );
    if( FAILED( hr ) )
        return hr;
    return pItem->GetString( PKEY_ItemPathDisplay, ppszDisplayPath );
}

int main()
{
    CoInitialize( nullptr );  // TODO: check return value
    _setmode( _fileno( stdout ), _O_U16TEXT );  // for proper UTF-16 console output

    LPCWSTR fileSystemPath = L"C:\\Users\\Public\\Pictures";
    CComHeapPtr<WCHAR> displayPath;
    if( SUCCEEDED( GetDisplayPathFromFileSystemPath( fileSystemPath, &displayPath ) ) )
    {
        // Output the localized display path
        std::wcout << static_cast<LPCWSTR>( displayPath ) << std::endl;
    }

    CoUninitialize();
}
#包括
#include//Shell API
#包括//PKEY_*常数

#包含以从文件系统路径创建对象。它从该对象检索属性值,该属性包含我们感兴趣的显示路径。

您可以共享MSI日志文件吗?ProgramFiles64文件夹应该是正确的。我自己永远也找不到这个文件夹。非常感谢您提供的详细答案