::HtmlHelp function returning NULL which resulted failed to launch .CHM file

James J 586 Reputation points
2022-09-20T09:12:14.93+00:00

We have 32 bit desktop application which we are using ::HtmlHelp API to launch the Html help content. This was working prior and I have observed that some what Windows 2019 edition, We are not able to launch the help content. Which always returning NULL. Find the below code snippet for your reference.

CString chmPath = "C:\Sample.chm";
DWORD data = 1000;
HWND window = ::HtmlHelp(NULL, chmPath, HH_HELP_CONTEXT, data);
Now, Always window returns NULL which resulted failed to launch Html help content.

The below ShellExecute command is working. But, I would like to know. What is the best option to launch the HTML content in MFC and C++ application. Because we are using :::HtmlHelp many years, we did not see any issues.

DWORD data = 1000;
char path[]= "C:\Sample.chm";
sprintf_s(parms, _T("-helpID %d Help content path:%s"), data,path);
HINSTANCE retval = ::ShellExecute(NULL, _T("open"), _T("hh.exe"), parms, NULL, SW_SHOW)

Can you please help meon this.

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,897 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,575 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,683 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 44,206 Reputation points
    2022-09-21T10:33:36.317+00:00

    Hi

    Thank you for posting your query.

    Kindly follow the steps provided below to resolve your issue which I found in a forum with the same issue you have here is the link for that https://social.msdn.microsoft.com/Forums/en-US/8c0e5c00-57bc-4308-86fc-9cea43f3ce42/failed-to-launch-help?forum=vcmfcatl

    To eliminate the 'Failed to launch help' popup, make a MyApp::OnHelp() handler. This bypasses the default F1 OnHelp MFC code.

    Go to this link for your reference https://learn.microsoft.com/en-us/cpp/mfc/reference/cwinapp-class?view=msvc-170

    Do not hesitate to message us if you need further assistance.

    -----------------------------------------------------------------------------------------------------------------------------------------------

    If the answer is helpful kindly click "Accept as Answer" and upvote it. Thanks.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.