SOLVED

Call to HtmlHelp() fails after desktop app is installed by MSIX.

Copper Contributor

After using MSIX Packaging Tool to convert an msi installer for my Windows desktop app to an msix installer, a call my app makes to HtmlHelp() fails to display the .chm file installed along with the .exe file. That call occurs when the user clicks "User's Guide" in the Help menu, so it is an important document that needs to be accessible to the user. Is there a way to allow a desktop app installed via MSIX to display a chm file or an html file? Or any kind of document file?

6 Replies

@StevenBrown-4429

To answer my own question, I got the call to HtmlHelp() to work by making it access a chm file not installed into "Program Files\Windows Apps", a directory owned and restricted by Microsoft, but into a non-restricted directory on the computer.
 

But now there is another problem. After the MSIX install, a call my app makes to HtmlHelp() succeeds if the file already exists as C:\Users\Public\Documents\MyApp\UsersGuide.chm. However, if MyApp\UsersGuide.chm does not already exist, the MSIX install fails to create that subdirectory and file. The msi file succeeds at that task, but the msix file it is converted to fails. Why is that? Why does MSIX fail to create a subfolder and copy a chm file into a non-restricted directory?
I gained access in File Explorer to the Program Files\WindowsApps directory and found the chm file was installed into a VFS folder. Now I need to find a way for my desktop app to access that file.
The problem is, MSIX installs the chm file into VFS\Common Documents\MyApp\UsersGuide.chm, but that directory does not appear to be mapped by Windows to C:\Users\Public\Documents\MyApp\UsersGuide.chm, because when my app calls HtmlHelpW(hWnd, wch_HelpPath, HH_DISPLAY_TOPIC, NULL), where wch_HelpPath is a pointer to L"C:\Users\Public\Documents\MyApp\UsersGuide.chm", it fails.

How can a desktop app simply read a file that has been installed into the Common Documents folder in the VFS?
best response confirmed by StevenBrown-4429 (Copper Contributor)
Solution
I solved the problem by using the C:\ProgramData folder for installing the subfolder and .chm file. That is one of the folders Windows maps to the VFS (Virtual File System) that MSIX installs to.

Hi @StevenBrown-4429, thank you for your question. Here is also a solution to your problem using the package support framework: Package Support Framework - Working Directory fixup - MSIX | Microsoft Docs

 

  

1 best response

Accepted Solutions
best response confirmed by StevenBrown-4429 (Copper Contributor)
Solution
I solved the problem by using the C:\ProgramData folder for installing the subfolder and .chm file. That is one of the folders Windows maps to the VFS (Virtual File System) that MSIX installs to.

View solution in original post