Click here to Skip to main content
15,861,367 members
Articles / Desktop Programming / MFC

Codez Bank: A Code Snippet Bank Application

Rate me:
Please Sign up or sign in to vote.
4.88/5 (56 votes)
22 Aug 2022CPOL3 min read 103.4K   3.5K   119   45
An application that stores and manages useful code snippets and keeps them always handy
This article is about a small application that keeps code snippets organized and handy, even when you are offline or in a remote location without connectivity.

codez_bank/codezbankfolders.png

Folders view

codez_bank/codezbankcode.png

Snippet view

Image 3

Black Office Skin with new skinned CListView

Image 4

Office 2003 skin with skinned splitter

Introduction

CodezBank is just a small application that stores source code snippets organized in a hierarchical manner with basic search ability. You just copy and paste the code snippet into or from this application via the Clipboard. If you have a bag of coding tricks, then you want to keep them in this app.

Background

Every time I work on some project, I always find myself digging through books and my old files to see how I did one or another piece of code. Although it works, it usually requires a lot of time. Sites like CodeProject keep code always available, but if I am offline or in a remote location without connectivity, then I have always wanted a small application that keeps the code snippets organized and handy.

Features

  • Added sorting arrows to columns:

    Image 5

  • Created options property pages to load last file on startup:

    Image 6

  • Created text editor configuration property page instead of using the hardcoded values:

    Image 7

  • Fonts and colors are now configurable:

    Image 8

Points of Interest

This application is a medium to advanced MFC project that covers advanced usage of libraries provided by Microsoft.

  • Storing data in a binary tree
  • SDI Explorer like interface with multiple views in the right pane (Color syntax and List view)
  • Colored syntax editor
  • Tree drag drop that rearranges the data in the binary tree
  • Usage of Regular Expressions provided by the vbscript.dll #import. Replaced with std::regex classes

History

Version 1.0.0.1 - 7th April, 2008

  • Initial code

Version 1.0.0.2 - 22nd April, 2008

  • Fixed undo bug in the code editor. Thanks to ndrsoft for pointing out a solution.

1.0.0.3 - 30th June, 2008

  • Added more C++/C keywords as was suggested by the readers
  • Changed tool bar to have a 256 color bitmap instead of 16 color
  • Added documentation panel to the Source view. You can put all the explanation down there instead of comments so the code looks cleaner for the eye. I found it useful to paste there the whole MSDN or other documentation page(s) and links. Then, you will have the whole shebang in one tree node.
  • Moved to GitHub
  • Upgraded the solution file to Visual Studio 2022

13th August, 2022

  • Updated the project to include 64 bit build
  • Changed main windows to incorporate latest MFC skin styles
  • Cleaned up some old junk code

22nd August, 2022

  • Added option to automatically load last file on startup
  • Removed VBScript regular expressions and replaced it with std::regex classes
  • Moved syntax parser into the separate class
  • Added configuration property sheets to replace hardcoded values

Bugs

  • Syntax editor very limited as far as undo actions. (I am figuring this out. If anyone knows how to fix that, drop me a note) So do not Ctrl+Z, it won't work. Fixed.
  • Syntax editor currently highlights a subset of C and C++ keywords. I will add VB and C# later.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect Robotz Software
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionQuestion for Auther Pin
Crimson1st30-Jan-24 4:20
Crimson1st30-Jan-24 4:20 
AnswerRe: Question for Auther Pin
steveb30-Jan-24 8:33
mvesteveb30-Jan-24 8:33 
QuestionWhy is that still NOT a VS extension? Pin
Andreas Saurwein30-Aug-22 2:40
Andreas Saurwein30-Aug-22 2:40 
AnswerMy vote of 5 Pin
Michael Haephrati22-Aug-22 3:19
professionalMichael Haephrati22-Aug-22 3:19 
GeneralRe: My vote of 5 Pin
steveb22-Aug-22 3:58
mvesteveb22-Aug-22 3:58 
GeneralMy vote of 5 Pin
Michael Haephrati22-Aug-22 3:19
professionalMichael Haephrati22-Aug-22 3:19 
QuestionMy vote of 5 Pin
Mike Hankey21-Aug-22 9:13
mveMike Hankey21-Aug-22 9:13 
AnswerRe: My vote of 5 Pin
steveb21-Aug-22 17:20
mvesteveb21-Aug-22 17:20 
GeneralRe: My vote of 5 Pin
Mike Hankey21-Aug-22 17:35
mveMike Hankey21-Aug-22 17:35 
QuestionGREAT DISCUSSION Pin
Digismartek12-Sep-16 2:05
Digismartek12-Sep-16 2:05 
GeneralMy vote of 5 Pin
Guyverthree11-Apr-11 5:51
Guyverthree11-Apr-11 5:51 
GeneralMy vote of 5 Pin
Shao Voon Wong2-Jan-11 14:41
mvaShao Voon Wong2-Jan-11 14:41 
GeneralConsider adding word wrap to bottom section Pin
Lyle M24-Feb-09 6:05
Lyle M24-Feb-09 6:05 
GeneralThanks... exactly what I needed Pin
netizenk20-Nov-08 12:00
professionalnetizenk20-Nov-08 12:00 
Questionthanks and question Pin
vinicius6-Nov-08 6:13
vinicius6-Nov-08 6:13 
AnswerRe: thanks and question Pin
steveb6-Nov-08 13:11
mvesteveb6-Nov-08 13:11 
GeneralNice to have features Pin
Steve H.6-Oct-08 5:36
Steve H.6-Oct-08 5:36 
GeneralAttachments Pin
thund3rstruck2-Oct-08 8:29
thund3rstruck2-Oct-08 8:29 
QuestionHow about adding a sort feature to the snippet titles Pin
Lyle M7-Aug-08 7:33
Lyle M7-Aug-08 7:33 
GeneralNew Version Won't Run on Vista 64 bit Pin
JeffBilkey7-Jul-08 14:11
JeffBilkey7-Jul-08 14:11 
GeneralRe: New Version Won't Run on Vista 64 bit Pin
steveb7-Jul-08 15:53
mvesteveb7-Jul-08 15:53 
GeneralWishlist Pin
Warrick Procter1-Jul-08 10:00
Warrick Procter1-Jul-08 10:00 
GeneralVery Good Pin
JBAK_CP1-Jul-08 8:45
JBAK_CP1-Jul-08 8:45 
GeneralGreat Pin
Saurabh.Garg1-Jul-08 1:27
Saurabh.Garg1-Jul-08 1:27 
GeneralRe: Great Pin
steveb1-Jul-08 1:49
mvesteveb1-Jul-08 1:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.