gbCompare is an extremely simple freeware application for entering and saving text. Encryption of the saved text files is supported. Standard text files are supported, as well as encrypted files saved by gbCompare.

Download (v1.3, 140K)

gbCompare uses a single main screen, consisting of a toolbar and an edit control.


Using gbCompare

Using gbCompare couldn't be simpler.
  1. "Open" any existing text file, or use "New" to create a new file.
  2. Edit the content
  3. Press the "Encrypt" toolbar button to optionally encrypt content when saved
  4. Press "Save" on the toolbar to save the file

That's it. When gbCompare is opened, it automatically opens the file it was editing in the last session. Note that if encryption is enabled, a password will be required to save a file. Each file can have its own password, which must be entered before a file can be opened.

gbCompare can detect whether a file is encrypted and when an encrypted file is selected to be opened, the user will be asked to supply the password associated with that file.


Almost all of the commands and settings available in gbCompare are accessed through the toolbar buttons.


Creates a new file. Unless AutoSave is on, requests permission to save changes to the current file. If changes are saved and encrypt is enabled, the user must supply a password.

Opens an existing file. Unless AutoSave is on, requests permission to save changes to the current file. If changes are saved and encrypt is enabled, the user must supply a password.

The Open File dialog opens in the folder of the currently opened file.

Existing files may also be opened by dragging them to the gbEncrpt EXE icon or shortcut icon.

Saves the current file without prompting for user approval to save changes. If changes are saved and encrypt is enabled, the user must supply a password. If the currently opened file has been changed by the user, the Save icon on the toolbar is grayed out.

The Save As file dialog opens in the folder of the currently opened file.

Saves the current file under a new name.

Standard windows commands for editing the content of the textbox.

In work ...

Opens a Find & Replace dialog.

Toggles whether encryption will be applied when the file is saved. The dropdown menu attached to the encrypt toolbar button also provides the following options which define the criteria used to validate a password used to save a file.

All of these options are off by default.

Open a Font Selection dialog.

Toggles whether changes are automatically saved when the user exits from gbCompare. Even if AutoSave is enabled, if Encrypt is enabled, the user must enter a password for the file to be saved.

Provides a dropdown menu with the following options:

When clicked, opens the online Help page in the user's default browser. F1 may also be pressed to open the online Help page. The following dropdown menu is available:

File Format

gbCompare can Open standard, unencrypted text files. When unencrypted files are Saved, they are saved with no modification to the content - just as with any other text editor.

But when a file is encrypted and saved to disk, gbCompare places a validation string at the front of the file. The validation string is used by gbCompare to know when an encrypted file is about to be opened. The process is somewhat transparent to the user, except for the need to enter a password when entering/opening an encrypted file.

For those interested in the details, gbCompare places a null character at the start of the file, followed by a validation string of characters which are encrypted using the password supplied by the user. Text content of the files follows immediately after the validation string. When gbCompare Opens a file, it checks that a null character is present as the first character in the file. if the null character is found, gbCompare assumes that the file is encrypted and then tests the characters immediately behind the null characters for the encrypted validation string (requesting that the user enter a password as part of the process). If the user entered password does not return the expected validation string, gbCompare will not open the selected file and will instead create a new, unencrypted file.

Text Editor

The gbCompare application consists of just a toolbar and a text edit control. The text edit control always fills the client area of the application.

A context menu (right mouse click) is available that provides the following menu options:

Short Cut Keys

These short cut keys / key combinations are supported:

Other Comments

Misecellaneous information is provided in this section.

When gbCompare starts, it opens the file it was editing in the last session. The gbCompare window size and position are also restored.

Password Entry
When entering a password needed to open or save a file, gbCompare does not limit the number of times a password may be entered.

New File
New files are given a name such as "default_001.txt". gbCompare looks in the path of the currently opened file and finds the first available number (i.e., 001, 002, ...) to assign to the new file name.

New files are, by default, unencrypted. If New is executed, the Encrypt toolbar button will be released.

If New/Open are executed and the current file has been changed and Encrypt is on, the user MUST enter a password or the New/Open operation is aborted.

Encryption Effect on Changes Flag
Changing the Encrypt toolbar button sets the "Changes" flag, indicating to gbCompare that the file content has changed.

Encrypt Speed
In the PowerBASIC forums I created a thread that discussed various encryption routines, focussing on speed of encryption. For gbCompare I used a medium speed encryption algorithm just to keep the routine simple. See the forum thread if faster Save/Open speeds are critical to you.

When Saving an encrypted file, which requires a password, failure to provide the password will abort the Save operation. This includes a Save that is required (when changes have been made to the current file) before Opening a new file, Opening an existing file, performing a SaveAs operation, or exiting the application.

INI File
gbCompare application settings are saved in an INI file, kept in the same folder as the gbCompare application.

In the source code and possibly in the Help file, you'll see the letters CFN. This stands for the "Current File Name" - the file being viewed in gbCompare.

Programmer Comments
The code for New/Open and to exit from gbCompare are very similar. I could have combined the code for those three actions, but decided it was easier to debug/maintain if I kept the code separate for each.


Comments and suggestions are welcome!