Page 1 of 1

.CHM file problem in Windows 8

Posted: Sat Apr 13, 2013 12:13 pm
by charvista
While programming, we all are using very regularly the important help file "PureBasic.chm".

I just installed Windows 8 x64 and PureBasic 5.11 x64.
PureBasic is working like a charm, and when pressing the F1-key, the help file could be loaded but could NOT be displayed in the large right panel. It says "This program cannot display the webpage". Needless to say that this is frustrating.

I searched the internet for a solution and found out that we could "Unblock" the .chm file by right-clicking on it, click Properties, click Unblock. BUT... there is NO Unblock button anymore!

Another solution was to use PowerShell, and use the cmdlet "Unblock-File /<path>/PureBasic.chm" (without the quotes) but this has no effect either.

How can I read the .chm file???

Thanks.

Re: .CHM file problem in Windows 8

Posted: Sat Apr 13, 2013 12:45 pm
by IdeasVacuum
It might just be related to this: http://www.purebasic.fr/english/viewtop ... 47#p410147

Can you run the .chm independently of PB? How about .chm files from other apps?

Re: .CHM file problem in Windows 8

Posted: Sat Apr 13, 2013 12:54 pm
by ts-soft
Right Click, Properties/Security
User/yourepc/user
Set to read and read and run.

I can't say the orginal verbs, my system is german.

Re: .CHM file problem in Windows 8

Posted: Sun Apr 14, 2013 12:26 am
by charvista
Sorry guys, I was unable to make the CHM file from Windows open'able. Very frustrating, as I have spent several hours on the internet to find a solution from forums, and thank you IdeasVacuum and TS-Soft, but your solutions were not successful either.

I installed a French version of Windows 8 (because there was no English version available), then I downloaded and installed the English version successfully, as well put the Region data to English. Everything became English, except the words "Administrateurs" and "Utilisateurs" which were still in French in the Security tab of the properties of the PureBasic.chm file. Perhaps due to this fact, I could not change the access behaviours, as if it was looking for "Administrators"? Anyway, a good advice: *Always* buy Windows in the original language version to avoid "forgotten" places or stupid "remnants"... :evil: (User Account "Guest" was also still "Invité"!!!)

The final solution was to try a third-party software, that still could open and read chm-files. The best one that I could find so far is KCHMviewer, at http://www.ulduzsoft.com/linux/kchmviewer/, it is a nice professional looking freeware without ads. The download link on their website is located on the right panel, under the 'Navigation' panel, the 4th line that reads "Getting kchmviewer", there is also a Windows program.

The big problem now is that when I press the F1-key in the PB editor, it automatically launches the Microsoft CHM viewer. Can I change this behaviour to open kchmviewer.exe from within the PB editor?


Thanks.

Re: .CHM file problem in Windows 8

Posted: Sun Apr 14, 2013 12:35 am
by Danilo
Can you open the .CHM if you log in as administrator? Unblock it as admin?

Re: .CHM file problem in Windows 8

Posted: Sun Apr 14, 2013 12:41 am
by charvista
No, because I am the Administrator. On my computer anyway :mrgreen:
But your question gave me an idea. Do you know what is the filename of the Microsoft CHM viewer? I would like to rename my kchmviewer to that filename and see what happens.

Re: .CHM file problem in Windows 8

Posted: Sun Apr 14, 2013 1:06 am
by Danilo
charvista wrote:No, because I am the Administrator. On my computer anyway :mrgreen:
You are real admin when elevated, otherwise only virtual admin. ;)
Can you right click PureBasic.exe -> "Run as administrator" and open help then?
charvista wrote:But your question gave me an idea. Do you know what is the filename of the Microsoft CHM viewer? I would like to rename my kchmviewer to that filename and see what happens.
It is usually hh.exe

Maybe just change file assoziation for .chm files. Try right clicking on PureBasic.chm with SHIFT key down -> Open With -> Choose default program.

Re: .CHM file problem in Windows 8

Posted: Sun Apr 14, 2013 1:21 am
by charvista
Danilo wrote:You are real admin when elevated, otherwise only virtual admin. ;)
You are right! I forgot that. :oops: When I am looking at User Account, it is said that I am Administrator. So, I need to be Super-Admin :wink:
Danilo wrote:Can you right click PureBasic.exe -> "Run as administrator" and open help then?
Yes, PureBasic could be launched with "Run as Administrator", but NO, the Help file is still not showing its contents. :cry:
Danilo wrote:Maybe just change file assoziation for .chm files.
I tried that, too. When double-clicking the PureBasic.chm file from the Explorer, the kchmviewer is lauched and displaying the chm file as expected.
But not from the PB-editor. I think that PB forcingly launches hh.exe, and not loading the associated file from the register.
Now I am going to try to rename kchmviewer.exe to hh.exe and put it in Window's directory and see what happens. I think this behavior should be changed.
I keep you informed.

Re: .CHM file problem in Windows 8

Posted: Sun Apr 14, 2013 1:46 am
by charvista
Unable to rename hh.exe, even with cmd.exe in Super-Admin mode: access is denied.

I was also unable to modify the rights of hh.exe (but I do not know how to get into the properties window in elevated mode). Microsoft has blocked a lot. I need permission from TrustedInstaller to make changes to this file. This is really going too far for a simple help file!

If I could redirect hh.exe to kchmviewer.exe, it would be solved. But how? I cannot edit the PB-editor! :mrgreen:
I fear this is something for Fred/Freak.

Edit : I also tried to put the environment variable PATH so that the directory of kchmviewer is set before Windows, and renamed to hh.exe, but no success. This means that the full path to hh.exe is included in the editor! :evil:

Re: .CHM file problem in Windows 8

Posted: Sun Apr 14, 2013 2:44 am
by Danilo
charvista wrote:This means that the full path to hh.exe is included in the editor! :evil:
No, you call HtmlHelp_() API to open HTML HELP:

Code: Select all

Prototype protoHtmlHelpA(hwndCaller, pszFile.p-ascii  , uCommand.l, *dwData)
Prototype protoHtmlHelpW(hwndCaller, pszFile.p-unicode, uCommand.l, *dwData)

#HH_DISPLAY_TOPIC       = $0000
#HH_HELP_FINDER         = $0000  ; WinHelp equivalent
#HH_DISPLAY_TOC         = $0001  
#HH_DISPLAY_INDEX       = $0002  
#HH_DISPLAY_SEARCH      = $0003  

lib = LoadLibrary_("hhctrl.ocx")
If lib
    HtmlHelpA_.protoHtmlHelpA = GetProcAddress_(lib,14)
    HtmlHelpW_.protoHtmlHelpW = GetProcAddress_(lib,15)
    Macro HtmlHelp_(a,b,c,d)
        CompilerIf #PB_Compiler_Unicode
            HtmlHelpW_(a,b,c,d)
        CompilerElse
            HtmlHelpA_(a,b,c,d)
        CompilerEndIf
    EndMacro    
    
    topic.s = "::/help/openhelp.html"
    ;topic.s = ""
    
    
    ;
    ; http://helpware.net/htmlhelp/linktochm.htm
    ;
    ; Conclusion: For IE5.
    ;
    ;   1. Must have UNIX slashes not DOS slashes.
    ;
    ;
    home.s = ReplaceString(#PB_Compiler_Home,"\","/")
    
    HtmlHelp_(0,home + "PureBasic.chm" + topic, #HH_DISPLAY_TOPIC, 0)
    
    Delay(3000)
    
    FreeLibrary_(lib)
EndIf
HtmlHelp_() API can do more than just opening .chm (see WinSDK, htmlhelp.h).


PS:
- Is IE correctly installed on your system? HtmlHelp_() requires correct IE install and registered DLLs.
- Also, .chm is sometimes blocked when on network drive.

EDIT 2:
Just found an (maybe important) detail:
http://helpware.net/htmlhelp/linktochm.htm
Conclusion: For IE5.
1. Must have UNIX slashes not DOS slashes.
Can you try the last code again, please? Includes: home.s = ReplaceString(#PB_Compiler_Home,"\","/")

Re: .CHM file problem in Windows 8

Posted: Sun Apr 14, 2013 9:45 am
by charvista
Danilo,
This morning, I tried your code, and still no luck. Still the infamous "The page cannot be displayed" message...
Then I thought, that's not possible. Something must be wrong. But what? I reinstalled PureBasic, and tried F1 as a reflex. Surprise, it worked!
Then, I was thinking why it now works and yesterday it did not. No, not because it was the 13th LOL.
The only thing I did since this brand new installation of Windows 8 is that I installed PB somewhere else than in /Program Files/. I installed it in C:\#BIN\PB\. And then suddenly, I knew the reason! C:\#BIN\PB\ contains the #-character! I remember that I read in the forums that the FILENAME may not contain the #-character as it is a special Html character. But the FILENAME is "PureBasic.chm", and they never spoke about the PATH!!!
As you see, the exact TERMINOLOGY is so important. "Filename, including the path (, including the drive letter?)" would have been more accurate.

Danilo, I am so sorry to have kept you awake trying to find a solution, as I see it was very late when you posted it. I am so ashamed, but I thank you for your cooperation. Without your interesting last post, I would probably not have thought about that #-character in the path.

May this topic be a good lesson for everybody who might encounter the same problem. It was certainly not futile. Again, thank you all of you.

PS: still, it is not normal that I cannot use the chm-viewer of my choice.

Re: .CHM file problem in Windows 8

Posted: Sun Apr 14, 2013 10:26 am
by helpy
Hello,
you could use the HtmlHelp viewer KeyHH!

I installed KeyHH as PureBasic tool. Now I can call the english help with F1 and the german help with Ctrl+F1.

Steps to get german AND english help:
  • Install PureBasic with german help
  • Copy the german help file PureBasic.chm to different folder or rename it.
  • Re-Install PureBasic with the english help
Steps to install KeyHH:
  • Download KeyHH
  • Unpack the ZIP-File
  • Unpack the Setup file witz 7-zip (you do not need to install the tool).
  • Copy the folder where you want
  • Add KeyHH as PureBasic tool with the following settings:
    • Commandline: [full path to KeyHH.exe]
    • Arguments: -PureBasicHelp -#klink "%WORD" "full path to german PureBasic.chm"
    • Name: German PureBasic Help
    • Event to trigger to tool: Menu or Shortcut
    • ShortCut: Ctrl+F1
    • ==> no other options
Test the help:
  • Open a PureBasic source code file or write a purebasic command
  • set the cursor in the purebasic command
  • Press F1 to open english help for the purebasic command
    ==> standard microsoft htmlhelpl viewer hh.exe is used!
  • Press Ctrl+F1 to open german help for the purebasic command
    ==> KeyHH.exe is used to display help
This works for me!

If you want to call KeyHH with F1 you have to add KeyHH as PureBasic tool and use shortcut F1.
Before you can use shortcut F1 for a PureBasic tool you have to delete the shortcut F1 in PureBasic preferences.

Hope this helps you,
greeting from germany/bavaria,
guido

Re: .CHM file problem in Windows 8

Posted: Wed Apr 17, 2013 2:10 pm
by NuclearFusion
Hi,

when you run a Google search with the string
"This program cannot display the webpage"
you will see that there seems to be malware that generates that message exactly.
In my opinion the free downloadable MBAM antmalware here
would be a good choice to try and remove the malware.

Regards,
Arie

Re: .CHM file problem in Windows 8

Posted: Wed Apr 17, 2013 3:14 pm
by helpy
charvista wrote:And then suddenly, I knew the reason! C:\#BIN\PB\ contains the #-character! I remember that I read in the forums that the FILENAME may not contain the #-character as it is a special Html character. But the FILENAME is "PureBasic.chm", and they never spoke about the PATH!!!
There are also other pathnames which will cause the same problem ;-)
Here some examples which cause the same problem:
  • ..path\test.chm\PureBasic.chm
  • ..path\test.chm.test\PureBasic.chm
If the path contains ".chm" the same problem occurs!
May be there are some more strings which would cause this problem ;-) ...
charvista wrote:PS: still, it is not normal that I cannot use the chm-viewer of my choice.
See my post ==> http://www.purebasic.fr/english/viewtop ... 88#p410788