How to call a win32.chm file via F1 in the IDE?
How to call a win32.chm file via F1 in the IDE?
Hello everybody,
I have a question regarding the PureBasics F1 help function.
As described in the PureBasic help, one can include the old Microsoft Win32.hlp help file into PureBasics help functionality.
https://www.purebasic.com/documentation ... _help.html
The WIn32.hlp is automatically called with the correct context when the caret is on a Win API command in the IDE and the user presses F1. For Example if the user press F1 and the caret is placed on 'CreateWindowEx_('
The *.hlp help file format is very old and you will find here http://laurencejackson.com/win32/ the same Win32 help but in chm format, which is a modern help format and offers a table of contence and a better search.
Is it somehow possible to call this WIn32.CHM file via F1 instead of the old WIn32.hlp file?
Greetings, Kurzer
I have a question regarding the PureBasics F1 help function.
As described in the PureBasic help, one can include the old Microsoft Win32.hlp help file into PureBasics help functionality.
https://www.purebasic.com/documentation ... _help.html
The WIn32.hlp is automatically called with the correct context when the caret is on a Win API command in the IDE and the user presses F1. For Example if the user press F1 and the caret is placed on 'CreateWindowEx_('
The *.hlp help file format is very old and you will find here http://laurencejackson.com/win32/ the same Win32 help but in chm format, which is a modern help format and offers a table of contence and a better search.
Is it somehow possible to call this WIn32.CHM file via F1 instead of the old WIn32.hlp file?
Greetings, Kurzer
PB 6.02 x64, OS: Win 7 Pro x64 & Win 11 x64, Desktopscaling: 125%, CPU: I7 6500, RAM: 16 GB, GPU: Intel Graphics HD 520, User age in 2024: 56y
"Happiness is a pet." | "Never run a changing system!"
"Happiness is a pet." | "Never run a changing system!"
- RSBasic
- Moderator
- Posts: 1218
- Joined: Thu Dec 31, 2009 11:05 pm
- Location: Gernsbach (Germany)
- Contact:
Re: How to call a win32.chm file via F1 in the IDE?
win32.chm is very outdated. Many functions are not documented in the help file. E.g. GetLastInputInfo_(), ProcessIdToSessionId_(), GetProductInfo_(), InternetGetConnectedStateEx_(), CreateHardLink_(), ...
If you want to read information from a function that is not documented in win32.chm, you must always use Google.
I recommend Google. E.g. GetLastInputInfo msdn
Or you can create a PB tool to access the MSDN page.
If you want to read information from a function that is not documented in win32.chm, you must always use Google.
I recommend Google. E.g. GetLastInputInfo msdn
Or you can create a PB tool to access the MSDN page.
-
- Addict
- Posts: 4527
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: How to call a win32.chm file via F1 in the IDE?
See this code by ts-soft on the German forum.RSBasic wrote:Or you can create a PB tool to access the MSDN page.
Re: How to call a win32.chm file via F1 in the IDE?
Thank you for your contributions and hints.
It don't mind if I can't call the chm directly. It would have been just a "nice to have".
For me the online msdn page is a bit confusing, but I'm not a hardcore winapi user either. I mainly look into this Win32 help out of curiosity. For the F1 help I leave the old Win32.hlp file in the help folder and call the chm file manually or via the help menu of the IDE.
Out of curiosity I changed the hard coded call of the "Win32.hlp" file in the PureBasic editor with a hex editor to "Win32.chm". This works, but obviously the transfer of the topic (the winapi command under the caret) has to be done differently than with a ".hlp" file. So it didn't worked for me, except that the chm file can be called with F1 and then shows me "The topic doesn't exist".
It don't mind if I can't call the chm directly. It would have been just a "nice to have".
For me the online msdn page is a bit confusing, but I'm not a hardcore winapi user either. I mainly look into this Win32 help out of curiosity. For the F1 help I leave the old Win32.hlp file in the help folder and call the chm file manually or via the help menu of the IDE.
Out of curiosity I changed the hard coded call of the "Win32.hlp" file in the PureBasic editor with a hex editor to "Win32.chm". This works, but obviously the transfer of the topic (the winapi command under the caret) has to be done differently than with a ".hlp" file. So it didn't worked for me, except that the chm file can be called with F1 and then shows me "The topic doesn't exist".
PB 6.02 x64, OS: Win 7 Pro x64 & Win 11 x64, Desktopscaling: 125%, CPU: I7 6500, RAM: 16 GB, GPU: Intel Graphics HD 520, User age in 2024: 56y
"Happiness is a pet." | "Never run a changing system!"
"Happiness is a pet." | "Never run a changing system!"
- RSBasic
- Moderator
- Posts: 1218
- Joined: Thu Dec 31, 2009 11:05 pm
- Location: Gernsbach (Germany)
- Contact:
Re: How to call a win32.chm file via F1 in the IDE?
Good ideakurzer wrote:Out of curiosity I changed the hard coded call of the "Win32.hlp" file in the PureBasic editor with a hex editor to "Win32.chm".
You may be able to develop an application called "Win32.exe" and change it to this application in the hex editor. Your Win32.exe application only needs to forward the parameter to Win32.chm (hh.exe).kurzer wrote:kurzer wrote:Out of curiosity I changed the hard coded call of the "Win32.hlp" file in the PureBasic editor with a hex editor to "Win32.chm".
Re: How to call a win32.chm file via F1 in the IDE?
Hehe, yes good idea, RSBasic. I had this idea too, but unfortunately I don't know the convention for parameters for a CHM file call.RSBasic wrote:You may be able to develop an application called "Win32.exe" and change it to this application in the hex editor. Your Win32.exe application only needs to forward the parameter to Win32.chm (hh.exe).
PB 6.02 x64, OS: Win 7 Pro x64 & Win 11 x64, Desktopscaling: 125%, CPU: I7 6500, RAM: 16 GB, GPU: Intel Graphics HD 520, User age in 2024: 56y
"Happiness is a pet." | "Never run a changing system!"
"Happiness is a pet." | "Never run a changing system!"
Re: How to call a win32.chm file via F1 in the IDE?
If you don't mind using a different key than F1, you could use your own shortcut (e.g. Alt-F1) with this little IDE Tool (needs no arguments).
[/size]Edit: fixed mix-up with constants (#HH_DISPLAY_TOPIC = 0, #HH_DISPLAY_TOC = 1), changed the order of execution (#HH_KEYWORD_LOOKUP before #HH_DISPLAY_TOC) to provide a better experience
Code: Select all
EnableExplicit
If CreateMutex_(0, 1, "Win32.chm") = 0 Or GetLastError_() <> 0
PostMessage_(FindWindow_(0,"Win32 Programmer's Reference"), #WM_CLOSE, 0, 0)
EndIf
Prototype HtmlHelp(a, b.s, c, d)
#HH_DISPLAY_TOPIC = 0
#HH_DISPLAY_TOC = 1
#HH_KEYWORD_LOOKUP = $D
Structure tAKLIN
cbStruct.l
fReserved.l
pszKeywords.s
pszUrl.s
pszMsgText.s
pszMsgTitle.s
pszWindow.s
fIndexOnFail.l
EndStructure
Procedure HtmlHelp(HelpFile.s, Keyword.s) ;by ts-soft (https://www.purebasic.fr/english/viewtopic.php?p=355981#p355981)
Protected AKLIN.tAKLIN
Protected HtmlHelp_.HtmlHelp
Protected hWnd
Protected DLL = OpenLibrary(#PB_Any, "HHCtrl.ocx")
If DLL
CompilerIf #PB_Compiler_Unicode
HtmlHelp_ = GetFunction(DLL, "HtmlHelpW")
CompilerElse
HtmlHelp_ = GetFunction(DLL, "HtmlHelpA")
CompilerEndIf
With AKLIN
\cbStruct = SizeOf(tAKLIN)
\fReserved = 0
\pszKeywords = Keyword
\fIndexOnFail = #True
EndWith
hWnd = HtmlHelp_(0, HelpFile, #HH_KEYWORD_LOOKUP, AKLIN)
HtmlHelp_(0, HelpFile, #HH_DISPLAY_TOC, 0)
CloseLibrary(DLL)
ProcedureReturn hWnd
EndIf
EndProcedure
Define chm$ = "D:\Program Files\PureBasicTools\Win32.chm"
Define word$ = RTrim(GetEnvironmentVariable("PB_TOOL_Word"), "_")
Define hWnd_chm = HtmlHelp(chm$, word$)
If hWnd_chm
While IsWindow_(hWnd_chm)
Delay(1000)
Wend
EndIf
Last edited by chi on Mon Apr 22, 2019 6:38 am, edited 1 time in total.
Et cetera is my worst enemy
Re: How to call a win32.chm file via F1 in the IDE?
Chi and ts-soft,
thank you both. What a great solution.
This works like a charm. Jippie
thank you both. What a great solution.
This works like a charm. Jippie
PB 6.02 x64, OS: Win 7 Pro x64 & Win 11 x64, Desktopscaling: 125%, CPU: I7 6500, RAM: 16 GB, GPU: Intel Graphics HD 520, User age in 2024: 56y
"Happiness is a pet." | "Never run a changing system!"
"Happiness is a pet." | "Never run a changing system!"
Re: How to call a win32.chm file via F1 in the IDE?
@ts-soft: Thank you for creating the original snipplet, I try to understand all of it, but I did not understand exactly this part. Can you explain why you are calling HtmlHelp_() twice? The first call would display the topic content (if it were the only call), but the second call immediately commands the help to display the keyword.chi wrote: HtmlHelp_(0, HelpFile, #HH_DISPLAY_TOPIC, 0)
hWnd = HtmlHelp_(0, HelpFile, #HH_KEYWORD_LOOKUP, AKLIN)
@chi: You've implemented the ingenious mutex() check to see if the help has already been called from the PB IDE.
Will a WInAPI created mutex be automatically released when PB exits the program? To be on the safe side I added the following to the program, because I wasn't sure.
Code: Select all
Define iMutex.i = CreateMutex_(0, 1, "Win32.chm")
If iMutex = 0 Or GetLastError_() <> 0
PostMessage_(FindWindow_(0,"Win32 Programmer's Reference"), #WM_CLOSE, 0, 0)
EndIf
; ... calling the Help and wait for user quits the help window ...
If iMutex <> 0
ReleaseMutex_(iMutex)
EndIf
End
PB 6.02 x64, OS: Win 7 Pro x64 & Win 11 x64, Desktopscaling: 125%, CPU: I7 6500, RAM: 16 GB, GPU: Intel Graphics HD 520, User age in 2024: 56y
"Happiness is a pet." | "Never run a changing system!"
"Happiness is a pet." | "Never run a changing system!"
Re: How to call a win32.chm file via F1 in the IDE?
Yes. From MSDN for CreateMutex: "The system closes the handle automatically when the process terminates."kurzer wrote:Will a WInAPI created mutex be automatically released when PB exits the program?
Re: How to call a win32.chm file via F1 in the IDE?
HH_KEYWORD_LOOKUP commandkurzer wrote:Can you explain why you are calling HtmlHelp_() twice? The first call would display the topic content (if it were the only call), but the second call immediately commands the help to display the keyword.
You must first call the HH_DISPLAY_TOPIC command before calling this command to ensure that the help window is created.
Et cetera is my worst enemy
Re: How to call a win32.chm file via F1 in the IDE?
Thank you very much for the explanation, Chi.
PB 6.02 x64, OS: Win 7 Pro x64 & Win 11 x64, Desktopscaling: 125%, CPU: I7 6500, RAM: 16 GB, GPU: Intel Graphics HD 520, User age in 2024: 56y
"Happiness is a pet." | "Never run a changing system!"
"Happiness is a pet." | "Never run a changing system!"
Re: How to call a win32.chm file via F1 in the IDE?
double holds better
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Re: How to call a win32.chm file via F1 in the IDE?
made small changes... previous code updated
Et cetera is my worst enemy
Re: How to call a win32.chm file via F1 in the IDE?
Thank you, I've updated my own code.
PB 6.02 x64, OS: Win 7 Pro x64 & Win 11 x64, Desktopscaling: 125%, CPU: I7 6500, RAM: 16 GB, GPU: Intel Graphics HD 520, User age in 2024: 56y
"Happiness is a pet." | "Never run a changing system!"
"Happiness is a pet." | "Never run a changing system!"