User forums > Help

Problem with Help

<< < (2/4) > >>

gd_on:
Effectively, il I change

--- Code: ---if (fp_htmlHelp)
--- End code ---
by

--- Code: ---if (!fp_htmlHelp)
--- End code ---
At line 82, fp_htmlHelp is already set to 0 (<=> false) and setting it to 1 is not correct.
and

--- Code: ---#if defined(_WIN64) | defined(WIN64)
--- End code ---
by

--- Code: ---#if defined(_WIN64) || defined(WIN64)
--- End code ---
it works again.
It is a problem quite similar to the one described in https://forums.codeblocks.org/index.php/topic,24363.msg166592.html#msg166592, a pointer to an address with the wrong length on Windows 64 bits, which seems to be a problem on very recent gcc versions.

Miguel Gimenez:
My intention was writing
--- Code: ---if (false)
--- End code ---
so the else part was always executed, sorry for the bad wording.

So, changing only the #if defined() line fixes the issue?. I am using wx3.1.5 but on 32 bits, so I can not test.

gd_on:

--- Quote ---So, changing only the #if defined() line fixes the issue?
--- End quote ---
surprisingly, it works also with the old code (only one |), which is certainly wrong ! (but always with the !fp_htmlHelp test)
Finally, doiing if(false) or if(!fp_htmlHelp) do the same thing, I suppose, because fp_htmlHelp is volatile and created each time, no ?

Miguel Gimenez:

--- Quote ---fp_htmlHelp is volatile and created each time, no ?
--- End quote ---

No, it is the address of a procedure in HHCTRL.OCX and it is assigned once in the plugin constructor:


--- Code: ---  ocx_module = LoadLibrary(_T("HHCTRL.OCX"));

  if (ocx_module)
    fp_htmlHelp = (HTMLHELP)GetProcAddress(ocx_module, HTMLHELP_NAME);

--- End code ---

with HTMLHELP_NAME =  "HtmlHelpW".

If the OCX can't be opened or the procedure is not found then the code on line 121 uses wxWidgets' wxCHMHelpController (m_helpctl).

I wanted to force the use of m_helpctl in order to discard (or blame) the other code.

Miguel Gimenez:
Probably

--- Code: ---      #if defined(_WIN64) | defined(WIN64)
      fp_htmlHelp(0L, (const wxChar*)m_filename, cbHH_KEYWORD_LOOKUP, (DWORDLONG)&link);
      #else
      fp_htmlHelp(0L, (const wxChar*)m_filename, cbHH_KEYWORD_LOOKUP, (DWORD)&link);
      #endif

--- End code ---
can be just

--- Code: ---      fp_htmlHelp(0L, (const wxChar*)m_filename, cbHH_KEYWORD_LOOKUP, (DWORD_PTR)&link);

--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version