Quickhelp for Win32 API commands

Working on new editor enhancements?
technopol
User
User
Posts: 20
Joined: Thu Mar 24, 2011 11:00 pm

Quickhelp for Win32 API commands

Post by technopol »

When I click a Win32 API function, all I get in the Quickhelp text gadget of the IDE is the function name with " - No Quickhelp Available"

What am I missing?
User avatar
Mijikai
Addict
Addict
Posts: 1360
Joined: Sun Sep 11, 2016 2:17 pm

Re: Quickhelp for Win32 API commands

Post by Mijikai »

Documentation for Win32 API functions are provided by Microsoft.
If you need for example informations about the MessageBox_() API:
https://docs.microsoft.com/en-us/window ... messagebox

But there are also helpful guides/tools for PureBasic, i can recommend RsBasic's website :wink:
https://www.rsbasic.de/winapi-library/
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: Quickhelp for Win32 API commands

Post by BarryG »

technopol wrote: Wed Jul 06, 2022 5:32 amWhat am I missing?
Nothing. It's just that not all the API commands have quick help defined in PureBasic to show.

The definitions are stored in this text file:

Code: Select all

PureBasic\Compilers\APIFunctionListing.txt
So you can add your own definitions, but be warned: these will be lost in future PureBasic updates (unless you back up and restore your version).
Rinzwind
Enthusiast
Enthusiast
Posts: 636
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: Quickhelp for Win32 API commands

Post by Rinzwind »

technopol
User
User
Posts: 20
Joined: Thu Mar 24, 2011 11:00 pm

Re: Quickhelp for Win32 API commands

Post by technopol »

BarryG wrote: Wed Jul 06, 2022 8:31 am
technopol wrote: Wed Jul 06, 2022 5:32 amWhat am I missing?
Nothing. It's just that not all the API commands have quick help defined in PureBasic to show.

The definitions are stored in this text file:

Code: Select all

PureBasic\Compilers\APIFunctionListing.txt
So you can add your own definitions, but be warned: these will be lost in future PureBasic updates (unless you back up and restore your version).
Barry, I love you !!!
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: Quickhelp for Win32 API commands

Post by BarryG »

technopol wrote: Wed Jul 06, 2022 5:16 pmBarry, I love you !!!
LOL! If you add definitions, make sure you contact Fred and see if he wants your updated file to be included in the official updates, so that we all benefit.
User avatar
blueb
Addict
Addict
Posts: 1041
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Re: Quickhelp for Win32 API commands

Post by blueb »

Here's a small program written by Danilo that I have found very useful... 8)

Code: Select all

;=========================================================
; GetPBInfo.pb by Danilo
; Version: PureBasic 5.10
; see: https://www.purebasic.fr/english/viewtopic.php?t=53701
;
; - add out Procedures by Denis
; - arranging out code by gurj on [pb_v5.61]
; - other various mods
;=========================================================
; works with 5.73
; works with 6.00 LTS
;
EnableExplicit

Global log.s
#Compiler = #PB_Compiler_Home + "compilers\pbcompiler.exe"

Procedure StartCompiler()
 ProcedureReturn RunProgram(#Compiler,"/STANDBY","",#PB_Program_Open|#PB_Program_Read|#PB_Program_Write|#PB_Program_Hide)
EndProcedure

Procedure StopCompiler(compiler)
 WriteProgramStringN(compiler, "END")
 WaitProgram(compiler,5000)
 CloseProgram(compiler)
EndProcedure

Procedure SendCompilerCommand(compiler,command$)
 If ProgramRunning(compiler)
  WriteProgramStringN(compiler, command$)
 EndIf
EndProcedure

Procedure.s GetCompilerOutput(compiler)
 If AvailableProgramOutput(compiler)
  ProcedureReturn ReadProgramString(compiler)
 EndIf
EndProcedure

Procedure FillList(compiler,List OUT.s(),space=0)
 Protected out$
 Protected space$=Space(space)
 While out$<>"OUTPUT"+#TAB$+"COMPLETE" And Left(out$,5)<>"ERROR"
  out$=GetCompilerOutput(compiler)
  If out$ And out$<>"OUTPUT"+#TAB$+"COMPLETE" And Left(out$,5)<>"ERROR" And FindString("0123456789",Mid(out$,1,1))=0
   AddElement(out())
   out()=space$+out$
  EndIf
 Wend
EndProcedure

Procedure FillConstantList(compiler,List OUT.s(),space=0)
 Protected out$
 Protected space$=Space(space)
 While out$<>"OUTPUT"+#TAB$+"COMPLETE" And Left(out$,5)<>"ERROR"
  out$=GetCompilerOutput(compiler)
  If out$<>"" And out$<>"OUTPUT"+#TAB$+"COMPLETE" And Left(out$,5)<>"ERROR" And FindString("0123456789",Mid(out$,2,1))=0
   If FindString("01",Mid(out$,1,1))
    out$ = "#"+Mid(out$,2,Len(out$)-1)
    out$ = ReplaceString(out$,#TAB$," = ")
    out$ = ReplaceString(out$,"# = ","#")
   ElseIf FindString("2",Mid(out$,1,1))
    Protected i, found_non_printable = #False
    Protected oldout$ = out$
    Protected sconst_value$  = StringField(oldout$,3,Chr(9))
    out$ = "#"+StringField(oldout$,2,#TAB$)
    For i = 1 To Len(sconst_value$)
     If Asc(Mid(sconst_value$,i)) < 32 Or Asc(Mid(sconst_value$,i)) > 126
      found_non_printable = #True
     EndIf
    Next i
    If out$ = "#TAB$"
     out$ + " = Chr(9)"
    ElseIf out$ = "#HT$"
     out$ + " = Chr(9)"
    ElseIf out$ = "#CRLF$"
     out$ + " = Chr(13) + Chr(10)"
    ElseIf out$ = "#LFCR$"
     out$ + " = Chr(10) + Chr(13)"
    ElseIf out$ = "#LF$"
     out$ + " = Chr(10)"
    ElseIf out$ = "#CR$"
     out$ + " = Chr(13)"
    ElseIf out$ = "#DOUBLEQUOTE$"
     out$ + " = Chr(34)"
    ElseIf out$ = "#DQUOTE$"
     out$ + " = Chr(34)"
    ElseIf found_non_printable = #False
     out$ + " = " + #DQUOTE$ + StringField(oldout$,3,#TAB$) + #DQUOTE$
    Else
     out$ + " ="
     Protected temp$ = StringField(oldout$,3,#TAB$)
     For i = 0 To Len(sconst_value$)-1
      out$ + " Chr("+Str(PeekB(@temp$+(i*SizeOf(Character)))) + ") +"
     Next
    EndIf
    out$ = RTrim(out$,"+")
    out$ = Trim(out$)
   Else
    log + out$+#LF$
   EndIf
   out$ = Trim(out$)
   If out$
    AddElement(out())
    out()=space$+out$
   EndIf
  EndIf
 Wend
EndProcedure

Procedure GetStructureList(compiler,List OUT.s())
 If ProgramRunning(compiler)
  SendCompilerCommand(compiler,"STRUCTURELIST")
  FillList(compiler,out())
 EndIf
EndProcedure

Procedure GetProcedureList(compiler,List OUT.s())
 If ProgramRunning(compiler)
  SendCompilerCommand(compiler,"FUNCTIONLIST")
  FillList(compiler,out())
 EndIf
EndProcedure

Procedure GetConstantsList(compiler,List OUT.s())
 If ProgramRunning(compiler)
  SendCompilerCommand(compiler,"CONSTANTLIST")
  FillConstantList(compiler,out())
 EndIf
EndProcedure


Procedure GetInterfaceList(compiler,List OUT.s())
 If ProgramRunning(compiler)
  SendCompilerCommand(compiler,"INTERFACELIST")
  FillList(compiler,out())
 EndIf
EndProcedure

Procedure GetStructureInfo(compiler,struct$,List OUT.s())
 If ProgramRunning(compiler)
  SendCompilerCommand(compiler,"STRUCTURE"+#TAB$+struct$)
  FillList(compiler,out(),4)
 EndIf
EndProcedure

Procedure GetInterfaceInfo(compiler,interf$,List OUT.s())
 If ProgramRunning(compiler)
  SendCompilerCommand(compiler,"INTERFACE"+#TAB$+interf$)
  FillList(compiler,out(),4)
 EndIf
EndProcedure


Procedure WaitCompilerReady(compiler)
 Protected out$
 While out$<>"READY" And Left(out$,5)<>"ERROR"
  out$ = GetCompilerOutput(compiler)
  If out$
   log + out$+#LF$
  EndIf
 Wend
EndProcedure

Define  pb, out$
NewList constants.s()
NewList structures.s()
NewList procedures.s()
NewList interfaces.s()

NewList structureInfo.s()
NewList interfaceInfo.s()

pb = StartCompiler()
If pb
 WaitCompilerReady(pb)
 
 GetStructureList(pb,structures())
 log + "found "+Str(ListSize(structures()))+" structures"+#LF$
 
 GetProcedureList(pb,procedures())
 log + "found "+Str(ListSize(procedures()))+" procedures"+#LF$
 
 GetConstantsList(pb,constants())
 log + "found "+Str(ListSize(constants()))+" constants"+#LF$
 SortList(constants(),#PB_Sort_Ascending|#PB_Sort_NoCase)
 
 GetInterfaceList(pb,interfaces())
 log + "found "+Str(ListSize(interfaces()))+" interfaces"+#LF$
 
 ClearList(structureInfo())
 ForEach structures()
  AddElement(structureInfo())
  structureInfo()="Structure "+structures()
  GetStructureInfo(pb,structures(),structureInfo())
  AddElement(structureInfo())
  structureInfo()="EndStructure"
  AddElement(structureInfo())
  structureInfo()=""
 Next
 
 ClearList(interfaceInfo())
 ForEach interfaces()
  AddElement(interfaceInfo())
  interfaceInfo()="Interface "+interfaces()
  GetInterfaceInfo(pb,interfaces(),interfaceInfo())
  AddElement(interfaceInfo())
  interfaceInfo()="EndInterface"
  AddElement(interfaceInfo())
  interfaceInfo()=""
 Next
 
 If CreateFile(0,"pb"+#PB_Compiler_Version+" Structures.txt")
  ForEach structureInfo()
   WriteStringN(0,structureInfo())
  Next
  CloseFile(0)
 EndIf
 
 If CreateFile(0,"pb"+#PB_Compiler_Version+" Interfaces.txt")
  ForEach interfaceInfo()
   WriteStringN(0,interfaceInfo())
  Next
  CloseFile(0)
 EndIf
 
 If CreateFile(0,"pb"+#PB_Compiler_Version+" Constants.txt")
  ForEach constants()
   WriteStringN(0,constants())
  Next
  CloseFile(0)
 EndIf
 
 If CreateFile(0,"pb"+#PB_Compiler_Version+" Procedures.txt")
  ForEach procedures()
   WriteStringN(0,procedures())
  Next
  CloseFile(0)
 EndIf
 
 If CreateFile(0,"pb"+#PB_Compiler_Version+".log")
  WriteString(0,log)
  CloseFile(0)
 EndIf
 
 StopCompiler(pb)
 MessageRequester( "GetPBInfo","Done, open the folder to view the results.")
EndIf
- It was too lonely at the top.

System : PB 6.10 Beta 9 (x64) and Win Pro 11 (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
technopol
User
User
Posts: 20
Joined: Thu Mar 24, 2011 11:00 pm

Re: Quickhelp for Win32 API commands

Post by technopol »

blueb wrote: Thu Jul 07, 2022 11:10 am Here's a small program written by Danilo that I have found very useful... 8)

Seems great! In which folder is it saved? I just can't find the result.
User avatar
blueb
Addict
Addict
Posts: 1041
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Re: Quickhelp for Win32 API commands

Post by blueb »

First save the code 'where you like'.. then run it, and the program will save all files in that directory.

What happened was that the program saved the files in your temporary directory. :mrgreen:
- It was too lonely at the top.

System : PB 6.10 Beta 9 (x64) and Win Pro 11 (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
Post Reply