Offline MSDN/WIN32 reference

Share your advanced PureBasic knowledge/code with the community.
Rinzwind
Enthusiast
Enthusiast
Posts: 636
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Offline MSDN/WIN32 reference

Post by Rinzwind »

Useful to some:
http://phix.x10.mx/download.php

See paragraph about 'Optional help file'. A modern offline CHM help file distilled from the online MSDN pages. If only PB would allow to use this with F1... Fred? I mean that old win32.hlp thing is way past it's expiration date! And the link in the PB help to the SDK http://www.microsoft.com/msdownload/pla ... sdkupdate/ doesn't even work anymore.

The scripting language Phix (which is similar in use to OpenEuphoria) itself is also worth a look btw.
Bitblazer
Enthusiast
Enthusiast
Posts: 733
Joined: Mon Apr 10, 2017 6:17 pm
Location: Germany
Contact:

Re: Offline MSDN/WIN32 reference

Post by Bitblazer »

Cool thanks. I will incorporate this into my own windows message debugging stuff for purebasic before releasing it. But first i have to check which one is more complete and if the licensing is compatible ;)
webpage - discord chat links -> purebasic GPT4All
User avatar
chi
Addict
Addict
Posts: 1028
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: Offline MSDN/WIN32 reference

Post by chi »

Create your own IDE Tool... viewtopic.php?p=535561#p535561
Et cetera is my worst enemy
User avatar
Zebuddi123
Enthusiast
Enthusiast
Posts: 794
Joined: Wed Feb 01, 2012 3:30 pm
Location: Nottinghamshire UK
Contact:

Re: Offline MSDN/WIN32 reference

Post by Zebuddi123 »

Hi chi thanks for the link and both chi and ts-soft for the code :)

Ctrl + F1
Brill :)

Anyone wants win32.chm ---- https://sourceforge.net/projects/win32-help-chm/

Zebuddi. :)
malleo, caput, bang. Ego, comprehendunt in tempore
Rinzwind
Enthusiast
Enthusiast
Posts: 636
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: Offline MSDN/WIN32 reference

Post by Rinzwind »

slight modification of code

Code: Select all

EnableExplicit

If CreateMutex_(0, 1, "MSDN.CHM") = 0 Or GetLastError_() <> 0
  PostMessage_(FindWindow_(0,"MSDN"), #WM_CLOSE, 0, 0)
EndIf

Prototype HtmlHelp(a, b.s, c, d)

#HH_DISPLAY_TOC    = 1
#HH_DISPLAY_TOPIC = $0
#HH_HELP_FINDER = $0
#HH_SET_WIN_TYPE = $4
#HH_GET_WIN_TYPE = $5
#HH_GET_WIN_HANDLE = $6
#HH_SYNC = $9
#HH_KEYWORD_LOOKUP = $D
#HH_DISPLAY_TEXT_POPUP = $E
#HH_HELP_CONTEXT = $F
#HH_TP_HELP_CONTEXTMENU = $10
#HH_TP_HELP_WM_HELP = $11

Structure HH_AKLINK
  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.HH_AKLINK, HtmlHelp_.HtmlHelp, hWnd
  
  Protected DLL = OpenLibrary(#PB_Any, "HHCtrl.ocx")
  If DLL
    HtmlHelp_ = GetFunction(DLL, "HtmlHelpW")
    With AKLIN
      \cbStruct = SizeOf(HH_AKLINK)
      \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.s, http.s, word.s, hWnd_chm

Select CountProgramParameters()
  Case 2
    chm = ProgramParameter(0)
    If FindString(chm, "http")
      http = chm
      chm = ""
    EndIf
    word = ProgramParameter(1)
  Default
    chm = GetPathPart(GetEnvironmentVariable("PB_TOOL_IDE")) + "Help\mini.chm"
    word = ProgramParameter(0)
    If word = ""
      word = GetEnvironmentVariable("PB_TOOL_Word")
    EndIf
EndSelect
word = RTrim(word, "_")
word = LTrim(word, "#")
If http <> ""
  http = ReplaceString(http, "$WORD", word)
  http = URLEncoder(http)
  RunProgram(http)
Else
  hWnd_chm = HtmlHelp(chm, word)
  If hWnd_chm
    ;MessageRequester("Debug", chm + #CRLF$ + word, #PB_MessageRequester_Info)
    While IsWindow_(hWnd_chm)
      Delay(1000)
    Wend
  Else
    MessageRequester("Help file not found", "Please copy mini.chm to a 'Help' folder in the PureBasic installation folder or specify help file location and keyword as program parameters." + #CRLF$ + #CRLF$ + chm + #CRLF$ + word, #PB_MessageRequester_Info)
  EndIf  
EndIf
ps. Somehow GetEnvironmentVariable("PB_TOOL_Word") always returns empty, so at the moment that variable is useless?

Anyway, compile to exe, add tool with commandline as exe's path and arguments "C:\Tools\MSDN\mini.chm" %WORD and shortcut of your choice (ALT+F1).

Online search:
Tools/configure Tools.../New/
Commandline:%path-to-whelp.exe%
Arguments:"https://duckduckgo.com/?q=! $WORD site:https://docs.microsoft.com/en-us/windows/win32/" %WORD
(example)
Shortcut: ALT+F2
Last edited by Rinzwind on Thu Aug 27, 2020 5:40 am, edited 3 times in total.
Rinzwind
Enthusiast
Enthusiast
Posts: 636
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: Offline MSDN/WIN32 reference

Post by Rinzwind »

Small change: added online search to above post.
User avatar
chi
Addict
Addict
Posts: 1028
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: Offline MSDN/WIN32 reference

Post by chi »

Rinzwind wrote:ps. Somehow GetEnvironmentVariable("PB_TOOL_Word") always returns empty, so at the moment that variable is useless?
PB_TOOL_Word usually doesn't recognize the word if the cursor is at the end of the word!

test| -> ""
tes|t -> "test"

Didn't test your code, though...
Et cetera is my worst enemy
Post Reply