At the moment autocomplete/quickhelp for the following API's is included:
- Window Properties
- Visual Styles
- Window Procedure Functions (added 2013.08.04 07:25)
- Font and Text Functions (added 2013.08.04 07:25)
ApiListingExpand.pb
Code: Select all
;*****************************************************************************
;*
;* ApiListingExpand.pb
;* Created by Josh
;*
;* Created : 03.08.2013
;* Last update : 03.08.2013
;*
;* http://www.purebasic.fr/english/viewtopic.php?f=27&t=55771
;*
;*
;* PB supports API's which are not shown with autocomplete and supports much more
;* API's where the parameters are not displayed in the helpline.
;*
;* This program adds missing information to the file APIFunctionListing.txt. Save
;* this file to any directory and copy the file ApiListingExpand.txt to the same
;* directory. After running this program, the items in ApiListingExpand.txt are
;* added to APIFunctionListing.txt. You will see the changes after PB is restartet.
;*
;* Items in ApiListingExpand.txt can be marked with [checked]. In this case always
;* this item is used, although the original PB file has other params.
;*
;* A backup file is made from APIFunctionListing.txt. The new file has to write in
;* the PB programdirectory, so you need to run this program in administrator mode.
;*
;*****************************************************************************
EnableExplicit
Structure APIS
ApiName .s
TextOri .s
TextExt .s
ParamsOri .s
ParamsExt .s
ParamsNew .s
CheckedExt.i
EndStructure
Structure APIS_LIST
TextSort .s
TextNew .s
EndStructure
NewMap Apis .APIS()
NewList ApisList .APIS_LIST()
Define FileNameOri.s
Define FileNameBak.s
Define FileNameUsr.s
Define TextOri .s
Define TextExt .s
Define ApiName .s
Define ParamsOri .s
Define ParamsExt .s
Define msg .s
Define CheckedExt .i
;Check OS
If #PB_Compiler_OS <> #PB_OS_Windows
msg = "This program supports only Windows API's"
MessageRequester ("ApiListingExpand", msg, #MB_ICONERROR)
End
EndIf
;Check admin status
If OSVersion () >= #PB_OS_Windows_Vista
If IsUserAnAdmin_() = #False
msg = "You have to start the program with admin rights."
MessageRequester ("ExpandApiListing", msg, #MB_ICONERROR)
End
EndIf
EndIf
;Define filenames
FileNameOri = #PB_Compiler_Home + "Compilers\APIFunctionListing.txt"
FileNameBak = #PB_Compiler_Home + "Compilers\APIFunctionListing.bak"
FileNameUsr = #PB_Compiler_FilePath + "ApiListingExpand.txt"
;If BAK file doesn't exist, rename the original file
If FileSize (FileNameBak) = -1
If RenameFile (FileNameOri, FileNameBak) = 0
msg = "The following file couldn't be renamed" + #CRLF$ + FileNameOri
MessageRequester ("ApiListingExpand", msg, #MB_ICONERROR)
End
EndIf
EndIf
;__________________
;Read original file
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
;Open the original file and read the first line
If ReadFile (0, FileNameBak) = 0
msg = "Can't open the following file" + #CRLF$ + FileNameBak
MessageRequester ("ApiListingExpand", msg, #MB_ICONERROR)
End
EndIf
ReadString (0)
;Read the original file into the map
While Eof (0) = 0
TextOri = ReadString (0)
TextOri = Trim (TextOri)
If TextOri = "" : Continue : EndIf
ApiName = StringField (TextOri, 1, "")
ApiName = StringField (ApiName, 1, "(")
ApiName = Trim (ApiName)
ParamsOri = RemoveString (TextOri, ApiName)
ParamsOri = Trim (ParamsOri)
Apis(ApiName)\TextOri = TextOri
Apis(ApiName)\ApiName = ApiName
Apis(ApiName)\ParamsOri = ParamsOri
Wend
;Close the original file
CloseFile (0)
;________________
;Read expand file
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
;Open the expand file
If ReadFile (0, FileNameUsr) = 0
msg = "The following file couldn't be opened," + #CRLF$
msg + FileNameUsr + #CRLF$ + #CRLF$
msg + "The original file will be restored."
MessageRequester ("ApiListingExpand", msg, #MB_ICONINFORMATION)
CopyFile (FileNameBak, FileNameOri)
End
EndIf
;Read the expand file into the map
While Eof (0) = 0
TextExt = ReadString (0)
TextExt = Trim (TextExt)
If Left (TextExt, 1) = ";" : Continue : EndIf
If TextExt = "" : Continue : EndIf
If FindString (TextExt, "[checked]", 1, #PB_String_NoCase)
TextExt = RemoveString (TextExt, "[checked]", #PB_String_NoCase)
CheckedExt = #True
Else
CheckedExt = #False
EndIf
ApiName = StringField (TextExt, 1, "")
ApiName = StringField (ApiName, 1, "(")
ApiName = Trim (ApiName)
ParamsExt = RemoveString (TextExt, ApiName)
ParamsExt = Trim (ParamsExt)
Apis(ApiName)\TextExt = TextExt
Apis(ApiName)\ApiName = ApiName
Apis(ApiName)\ParamsExt = ParamsExt
Apis(ApiName)\CheckedExt = CheckedExt
Wend
;Close the expand file
CloseFile (0)
;_________________
;Create new params
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
ForEach Apis()
If Apis()\CheckedExt = #True
Apis()\ParamsNew = Apis()\ParamsExt
Continue
EndIf
If Apis()\ParamsOri And Apis()\ParamsExt = ""
Apis()\ParamsNew = Apis()\ParamsOri
Continue
EndIf
If Apis()\ParamsOri = "" And Apis()\ParamsExt
Apis()\ParamsNew = Apis()\ParamsExt
Continue
EndIf
If Apis()\ParamsOri And Apis()\ParamsExt And Apis()\ParamsOri <> Apis()\ParamsExt And UCase (Apis()\ParamsOri) = UCase (Apis()\ParamsExt)
Apis()\ParamsNew = Apis()\ParamsExt
Continue
EndIf
If Apis()\ParamsOri And Apis()\ParamsExt And Apis()\ParamsOri <> Apis()\ParamsExt
Apis()\ParamsNew = Apis()\ParamsOri + " ;***** differences in ApiListingExpand.txt"
Continue
EndIf
If Apis()\ParamsOri And Apis()\ParamsExt And Apis()\ParamsOri = Apis()\ParamsExt
Apis()\ParamsNew = Apis()\ParamsOri + " ;***** please remove in ApiListingExpand.txt"
Continue
EndIf
Next
;_______________________________________
;Write in list, sort and create textfile
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
;Create list
ForEach Apis()
AddElement (ApisList())
ApisList()\TextSort = UCase (Apis()\ApiName)
ApisList()\TextNew = Apis()\ApiName + " " + Apis()\ParamsNew
Next
;Sort List (underscores at the end)
SortStructuredList (ApisList(), #PB_Sort_Ascending, OffsetOf (APIS_LIST\TextSort), #PB_String)
;Write in textfile
CreateFile (0, FileNameOri)
WriteString (0, Str (ListSize (ApisList())+1) + #CRLF$)
ForEach ApisList()
WriteString (0, ApisList()\TextNew + #CRLF$)
Next
CloseFile (0)
Code: Select all
;>>>>>>>>>> Added 03.08.2013 <<<<<<<<<<
;_________________________
;Window Property Functions
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
EnumProps (hWnd, lpEnumFunc)
EnumPropsEx (hWnd, lpEnumFunc, lParam)
GetProp (hWnd, lpString)
RemoveProp (hWnd, lpString)
SetProp (hWnd, lpString, hData)
;______________________
;Visual Style Functions
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
CloseThemeData (hTheme)
DrawThemeBackground (hTheme, hDc, iPartId, iStateId, *pRect, *pClipRect)
DrawThemeBackgroundEx (hTheme, hDc, iPartId, iStateId, *pRect, *pOptions)
DrawThemeEdge (hTheme, hDc, iPartId, iStateId, pDestRect, uEdge, uFlags, pContentRect)
DrawThemeIcon (hTheme, hDc, iPartId, iStateId, pRect, himl, iImageIndex)
DrawThemeParentBackground (hWnd, hDc, *prc)
DrawThemeText (hTheme, hDc, iPartId, iStateId, pszText, iCharCount, dwTextFlags, dwTextFlags2, pRect)
EnableThemeDialogTexture (hWnd, dwFlags)
EnableTheming (fEnable)
GetCurrentThemeName (pszThemeFileName, dwMaxNameChars, pszColorBuff, cchMaxColorChars, pszSizeBuff, cchMaxSizeChars)
GetThemeAppProperties ()
GetThemeBackgroundContentRect (hTheme, hDc, iPartId, iStateId, pBoundingRect, pContentRect)
GetThemeBackgroundExtent (hTheme, hDc, iPartId, iStateId, pContentRect, pExtentRect)
GetThemeBackgroundRegion (hTheme, hDc, iPartId, iStateId, pRect, *pRegion)
GetThemeBool (hTheme, iPartId, iStateId, iPropId, *pfVal)
GetThemeColor (hTheme, iPartId, iStateId, iPropId, *pColor)
GetThemeDocumentationProperty (pszThemeName, pszPropertyName, pszValueBuff, cchMaxValChars)
GetThemeEnumValue (hTheme, iPartId, iStateId, iPropId, *piVal)
GetThemeFilename (hTheme, iPartId, iStateId, iPropId, pszThemeFilename, cchMaxBuffChars)
GetThemeFont (hTheme, hDc, iPartId, iStateId, iPropId, *pFont)
GetThemeInt (hTheme, iPartId, iStateId, iPropId, *piVal)
GetThemeIntList (hTheme, iPartId, iStateId, iPropId, *pIntList)
GetThemeMargins (hTheme, hDc, iPartId, iStateId, iPropId, prc, *pMargins)
GetThemeMetric (hTheme, hDc, iPartId, iStateId, iPropId, *piVal)
GetThemePartSize (hTheme, hDc, iPartId, iStateId, prc, eSize, *psz)
GetThemePosition (hTheme, iPartId, iStateId, iPropId, *pPoint)
GetThemePropertyOrigin (hTheme, iPartId, iStateId, iPropId, *pOrigin)
GetThemeRect (hTheme, iPartId, iStateId, iPropId, pRect)
GetThemeString (hTheme, iPartId, iStateId, iPropId, pszBuff, cchMaxBuffChars)
GetThemeSysBool (hTheme, iBoolID)
GetThemeSysColor (hTheme, iColorID)
GetThemeSysColorBrush (hTheme, iColorID)
GetThemeSysFont (hTheme, iFontID, *plf)
GetThemeSysInt (hTheme, iIntID, *piValue)
GetThemeSysSize (hTheme, iSizeID)
GetThemeSysString (hTheme, iStringID, pszStringBuff, cchMaxStringChars)
GetThemeTextExtent (hTheme, hDc, iPartId, iStateId, pszText, iCharCount, dwTextFlags, pBoundingRect, pExtentRect)
GetThemeTextMetrics (hTheme, hDc, iPartId, iStateId, *ptm)
GetWindowTheme (hWnd)
IsAppThemed ()
IsThemeActive ()
IsThemeBackgroundPartiallyTransparent (hTheme, iPartId, iStateId)
IsThemeDialogTextureEnabled (hWnd)
IsThemePartDefined (hTheme, iPartId, iStateId)
OpenThemeData (hWnd, pszClassList)
SetThemeAppProperties (dwFlags)
SetWindowTheme (hWnd, pszSubAppName, pszSubIdList)
;>>>>>>>>>> Added 04.08.2013 <<<<<<<<<<
;__________________________
;Window Procedure Functions
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
CallWindowProc (lpPrevWndFunc, hWnd, uMsg, wParam, lParam)
DefWindowProc (hWnd, uMsg, wParam, lParam)
;_______________________
;Font and Text Functions
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
AddFontMemResourceEx (pbFont, cbFont, pdv, *pcFonts)
AddFontResource (lpszFilename)
CreateScalableFontResource (fdwHidden, lpszFontRes, lpszFontFile, lpszCurrentPath)
DrawText (hDc, lpchText, nCount, lpRect, uFormat)
DrawTextEx (hDc, lpchText, cchText, lprc, dwDTFormat, lpDTParams)
EnumFontFamilies (hDc, lpszFamily, lpEnumFontFamProc, lParam)
EnumFontFamiliesEx (hDc, lpLogfont, lpEnumFontFamExProc, lParam, dwFlags)
EnumFonts (hDc, lpFaceName, lpFontFunc, lParam)
GetAspectRatioFilterEx (hDc, lpAspectRatio) [checked]
GetCharABCWidths (hDc, UuFirstChar, UuLastChar, lpabc)
GetCharABCWidthsFloat (hDc, UiFirstChar, UiLastChar, lpABCF)
GetCharacterPlacement (hDc, lpString, nCount, nMaxExtent, lpResults, dwFlags)
GetCharWidth (hDc, UiFirstChar, UiLastChar, lpBuffer)
GetCharWidth32 (hDc, UiFirstChar, UiLastChar, lpBuffer)
GetCharWidthFloat (hDc, UiFirstChar, UiLastChar, pxBuffer)
GetFontData (hDc, dwTable, dwOffset, lpvBuffer, cbData) [checked]
GetFontLanguageInfo (hDc)
GetGlyphOutline (hDc, UuChar, UuFormat, lpgm, cbBuffer, lpvBuffer, *lpmat2)
GetKerningPairs (hDc, nNumPairs, lpkrnpair)
GetRasterizerCaps (lprs, Ucb) [checked]
GetTabbedTextExtent (hDc, lpString, nCount, nTabPositions, lpnTabStopPositions)
GetTextCharacterExtra (hDc)
GetTextColor (hDc)
GetTextExtentExPoint (hDc, lpszStr, cchString, nMaxExtent, lpnFit, alpDx, lpSize)
GetTextExtentPoint (hDc, lpString, cbString, lpSize)
GetTextExtentPoint32 (hDc, lpString, c, lpSize)
GetTextFace (hDc, nCount, lpFaceName)
GetTextMetrics (hDc, lptm)
PolyTextOut (hDc, *pptxt, cStrings)
RemoveFontMemResourceEx (fh)
RemoveFontResource (lpFileName)
SetMapperFlags (hDc, dwFlag) [checked]
SetTextCharacterExtra (hDc, nCharExtra) [checked]
SetTextColor (hDc, crColor) [checked]
SetTextJustification (hDc, nBreakExtra, nBreakCount) [checked]
TabbedTextOut (hDc, X, Y, lpString, nCount, nTabPositions, lpnTabStopPositions, nTabOrigin)
TextOut (hDc, nXStart, nYStart, lpString, cchString)