As part of the release of gbSnippets - my new freeware text organizer and
code librarian - I'm making the following 300+ PowerBASIC source code
snippets available.
Please consider this a thank you for the help I've been given
on the forums. I hope that it especially helps folks new to PowerBASIC.
You can read the snippets online at my website:
You can also download gbSnippets and the source code library at:
The source code library also includes a variety of reference materials
that I've compiled, based on what I've found I need to work in PowerBASIC.
Having this information ready at hand has been very useful.
This is just a start, covering primarily source code for creating GUI applications.
I will expand the library greatly over the coming months, providing more coverage
of graphics, threads, COM, DLLs, SDK-style coding and Internet applications.
Snippet Categories
The snippets in the PowerBASIC library are split into the following categories:
Here's the list of individual snippets currently in the library:
*updated 3 Sept to include a list of snippet categories
code librarian - I'm making the following 300+ PowerBASIC source code
snippets available.
Please consider this a thank you for the help I've been given
on the forums. I hope that it especially helps folks new to PowerBASIC.
You can read the snippets online at my website:
You can also download gbSnippets and the source code library at:
The source code library also includes a variety of reference materials
that I've compiled, based on what I've found I need to work in PowerBASIC.
Having this information ready at hand has been very useful.
This is just a start, covering primarily source code for creating GUI applications.
I will expand the library greatly over the coming months, providing more coverage
of graphics, threads, COM, DLLs, SDK-style coding and Internet applications.
Snippet Categories
The snippets in the PowerBASIC library are split into the following categories:
Code:
References DLLs Printing API Functions Edit Controls RichEdit Control Apps/Dialogs Files/Folders Security Arrays Graphics Sorting Callbacks Internet Strings Clipboard Keystrokes System Information Controls - Basic Examples Math Templates Controls - Techniques Menus Time/Timers Debug Mouse TreeView Control Dialogs (Built-In) Multimedia
Code:
.Reference-------------------------------------------------- API - Short List (Most Useful, with snippets) API - Longer List (Desc only) Data Types Message Structure MSDN links Notifications, Messages, Styles (by Common Control) Notifications, Messages, Styles (by Sys Object) Pointer Discussion PowerBASIC Command Syntax PowerBASIC Keywords Programmer Tools Template for IDE+ Option Virtual-Key Codes Window Styles WM_ Messages (Arguments, Summary, Descriptions) API Functions-------------------------------------------------- ChildWindowFromPoint ClientToScreen GetCursorPos GetDlgCtrlID GetDlgItem GetFocus GetParent IsIconic IsZoomed MapWindowPoints ScreenToClient SendMessage SetCursorPos SetFocus WindowFromPoint Apps/Dialogs-------------------------------------------------- ..X Commands About Dialog Allow Single Instance of Application Cancel Closure (Capture Alt-F4 and "X" Button) Capture F1 Center on Screen Create Required Subfolders If Do Not Exist Display ASCII Table DragDrop File on Application Find and Replace Get Daily Message Keep on Top Limit Min/Max Size Maintain MRU List Message Pump - Dialog DoEvents Minimize/Maximize Programatically MsgBox$ - Confirmation of Action Online Update #1 - Check For Updates Online Update #2 - gbOnlineUpdate.exe Open Help Files (.chm or .hlp) Register Hotkey Resize Control When Form Resizes Run DOS Commands Save/Get Settings using INI file Select Code For Compilation Set Caption Set Z-Order Splitter Bars Start External App Test for Minimized/Maximized Arrays-------------------------------------------------- Check If Array Is Dimensioned Clear An Array Cycle Through Array Insert Specific Element Join Numeric Array Elements into a Single String Join String Array Elements into a Single String Randomly Shuffle Read/Write Array Data to File Remove Specific Element Search (Scan) Numeric Array Search (Scan) String Array Sort Numeric Array Sort String Array Callbacks-------------------------------------------------- Callback Return Values Callback Skeleton CB Functions Lo/Hi Word Extraction Pointers - Retreiving Structures from Messages Pointers - Sending Structures with Messages Clipboard-------------------------------------------------- Copy/Retrieve Text Controls - Basic Examples --------------------------------- . One of Everything . Syntax Summary Button Check3State CheckBox ComboBox Frame Graphic Image ImageX ImgButton ImgButtonX Label Line ListBox ListView Option ProgressBar ScrollBar StatusBar TAB TextBox Toolbar TreeView Controls - Techniques-------------------------------------------------- All Controls - Get/Sect Focus All Controls - SubClassing Buttons - Programmatically Click InputBox - Center Over Application Label - Active URL MessageBox - Center Over Application Synchronized Scroll (2 ListBoxes) Multiple TextBox SubClasssing Toolbar - Built-In + User Icons (from files) Toolbar - Built-In Icons (DDT) Toolbar - Built-In Icons (SDK) Toolbar - Dropdown Buttons Toolbar - Tooltips (DDT) Toolbar - Tooltips (SDK) Debug-------------------------------------------------- Monitor Messages - Callback (GetMsgText) Monitor Messages - Console Method (WinMsg) Dialogs (built-in)-------------------------------------------------- Browse Folders Dialog Color Dialog Font Dialog Open File Dialog Printer Dialog Save File Dialog Edit Controls-------------------------------------------------- .64K Limit Issues .Compilable Edit Control Example (Skeleton) .Edit Control vs RichEdit Control Messages .Notifications AutoHighlight Text Basic 1: Get Text/Boundaries: AllText, Selection, Caret, Current Line, LineM, LinesM-N, CharsM-N Basic 2: Replace Text: All, Selection, Current Line, LinesM-N, CharM-N Basic 3: Select Text: All, Current Line, LineM, LinesM-N, CharsM-N Customize Context menu (Textbox) Find Text Flicker Control Force Case on Text Input Get Line Count Get TopMost Line Remove Highlighting of TextBox on Startup Save/Restore Position Set Text Limit SubClassing Unselect Text Files/Folders-------------------------------------------------- Backup/Restore a File Combine Path/File Parts Confirm Overwrite Of a File Create Large Empty File Delete Folder & Sub-Folders Determine If File Is Open Determine If File or Folder Exists Extract Parts of PathName Get Date/Time of File Get File Attributes Get File Size Get Mode of Open File Hex Display of String/File List Drive Letters (with type) List Files/Folders List Files/Folders (Recursive) Open DOS at Path Open Explorer at Path Open Window at Path Read Entire Text File Into Array Read Entire Text File Into String Read First n Lines of Text File Into Array Read Text File, One Line At a Time Read/Write Entire Numeric Array Send File/Folder to Recycle Bin Graphics-------------------------------------------------- .Overview Capture Dialog Capture Screen Get Image Size From File (.BMP images) Get Screen Resolution Gradient Fill Graphic Window Load Image From File (DDT) Load Image/ImageX Controls (from .pbr) Load ImgButton/ImgButtonX Controls (from .pbr) Load JPG/GIF Images (GDI+) Load JPG/GIF Images (ListView) Pixel Manipulation (Bits String) RGB/BGR/Long Conversions Set Wallpaper - from file Set Wallpaper - use dialog image Internet-------------------------------------------------- Create HTML File From Code Create URL Shortcut Open URL - Using Default Browser Send Email - Using Default Client Keystrokes-------------------------------------------------- %IDOK + %IDCancel + ESC + Enter %IDOK + Enter (Exception) .Introduction - Messages & Functions .Message Detection (TextBox SubClassing) Ctrl-V Enter F1 (Help) F2 Get Key State At Any Time Get Key State At Time of Event TAB Math-------------------------------------------------- Convert Decimal to Binary Convert Decimal to Hex Convert Hex to Decimal Convert Binary to Decimal Generate Random Number Manipulating bits in variables Round to Specified Decimals Menus-------------------------------------------------- .Really Simple Menu Example Flip menu check state Menu - Skeleton, 1-Level Menu - Skeleton, 2-Level Menu - Skeleton, Context, TextBox Show Underlines in Menu Text Activate Alt+Accelerator Key Mouse-------------------------------------------------- .Messages of Interest (wParam/lParam definitions) Detect Mouse Position (All Controls) Multimedia-------------------------------------------------- Play Sound - MIDI file Play Sound - WAV file Play Tones (WinBeep) Speech Synthesize (Read Text) Printing-------------------------------------------------- Draw text centered on printer page Send Page Eject to Printer Set Printer for 8.5x11 Page Print Text With Embedded TABs (Single Line, Set POS) Print Text With Embedded TABs (Multi-Line, Set POS) RichEdit Control-------------------------------------------------- .64K Limit Issues .Compilable RichEdit Example (Skeleton) .Compilable RichEdit Example (Smaller Skeleton) .Notifications .RichEdit vs Edit Control Messages .Shortcut Keys .Usage Summary - RichEdit Control AutoHighlight Text Basic 1: Get Text/Boundaries: AllText, Selection, Caret, Current Line, LineM, LinesM-N, CharsM-N Basic 2: Replace Text: All, Selection, Current Line, LineM, LinesM-N, CharsM-N Basic 3: Select Text: All, Current Line, LineM, LinesM-N, CharsM-N Context menu (RichEdit control) Ctrl-V Capture via Subclassing Enable Hyperlinks Flicker Control Get Line Count Get TopMost Visible Line Get/Save RTF Content Print RTF (Color) Save/Restore Position Setting TabStops Set Text Limit SubClassing Synchronized Scroll (2 RichEdit Controls) Syntax Highlighting Unselect Text Security-------------------------------------------------- Encrypte/Decrypt a File Sorting-------------------------------------------------- Numeric Sort String Sort Strings-------------------------------------------------- Convert Case Convert TABs to Spaces (GetTextExtentPoint32) Convert TABs to Spaces (DrawTextEx) Extract nth Delimited String (Field) Find nth Occurrence of Substring Within a String Find SubString Within a String Get Physical Length of String Join Array Elements Remove Leading/Trailing String/Characters Replace Substring Within a String Split String Into Array Verify String Contains Only Letters/Numbers System Information-------------------------------------------------- Computer Name Environment variables Special Folders User Name Templates (IDE)-------------------------------------------------- Dialog + Buttons Dialog + DoEvents Loop Dialog + Selected Messages Dialog Only Simple: Dialog + Button Simple: Dialog + DoEvents Loop Simple: Dialog + Selected Messages Simple: Dialog Only Time/Timers-------------------------------------------------- Convert MM-DD-YYYY to YYYY-MM-DD Convert seconds to minutes Time - Create a Timer Time - Elapsed Time Between 2 Events TreeView Control-------------------------------------------------- .Compilable TreeView Example Edit/Modify Cut/Copy/Paste/Delete Nodes (Context Menu) Delete Children of Node (including sub-nodes) Delete Node + Children (including sub-nodes) Edit Tree Label (in-place) Expand/Collapse Node Expand/Collapse Node (including sub-nodes) Save/Restore Tree Sort Children of Node (no sub-nodes) Sort Children of Node + SubNodes Turn Icon Display On/Off Information Is Node a Parent Node Child Count Node Child Count (including sub-nodes) Traverse/Walk Tree Children of Node (return last child) Children+SubNodes of Node (return last node) Node to End of Tree (return last node) One Node Down