Saturday, April 19, 2014

Superior Code contest winners for Visual Basic 6.0 - April 2014

Superior Code contest winners February 2014 (For code submitted March 2013)

  Data Guard Pro 1.0 (A high class computer security application for Windows)

Data Guard Pro is a powerful and new computer security program that lets you create protected storage regions called Privacy Blocks in your local hard disk partitions where you can store your private data inside. In order to access a particular Privacy Block you must provide the correct password that you set with the Privacy Block. The program protects your private data from unauthorized access by home/casual users, malicious programs or hackers by preventing your data from being detected, modified, deleted, searched, and viewed or executed. You will find Data Guard Pro indispensable if you share your computer with others and you don't want any changes made to your files. Or, if you allow your kids to play games on your system from time to time, and want to be sure that they are away from detecting your private data. Or, if you don't want your parents to see some of your files such as your private videos and pictures. Further, Data Guard Pro can be used to backup your data in a Privacy Block when you need to format a particular hard disk partition. Here is how Data Guard Pro works - all you have to do is to put the files or folders to be protected in the Privacy Block created by Data Guard Pro and the rest is done aromatically. 


• Ability to create own Privacy Block for any local hard disk partition. (help maintaing a separate Privacy Block for each hard disk partition for storing private data including secure backups)
• Ability to create Privacy Blocks with different passwords. (may help to have multiple users of the program if needed)
• High transparent but protected single-point operations provide more flexibility in managing Privacy Blocks. (A Single login may be enough to manage all the operations of Privacy Blocks)
• Highly confidential, reliable, easy and quick Password Recovery Service which gives user(s) a complete relaxation of mind in case of losing passwords.
• Hassle free, intuitive and extremely easy-to-use user interface. (no need a rocket scientist to master)
• First time protection and ability to access, add, delete, copy, cut/paste or edit files/folders within Privacy Blocks easily.
• Protects data on all Windows platforms even when you switch from one Windows platform to the another.
• Ability to managing program from system tray.
• Configurable HotKey support.
• Strong password protection. 
• High performance in design and operations.
• Ability to erase PC tracks.
• Hack Attempt Detection feature.
• Highly portable. (no installation is required)
• All operations are fully manageable in any Windows user account. (no Administrator rights required)
• Windows 8, Windows 7, Windows Vista, Windows XP, Windows 2008 Server, Windows 2003 Server along with their 32 and 64-bit variants and is compatible on all file systems like FAT32 and NTFS.
• And many more... 

If you find any error in loading this project, please download the Data Guard Pro Executable and User's Guide from the following link by pasting it in your web browser address bar . This executable will work perfectly well.

The ultimate default Standard EXE replacement Form

  • It includes a complete replacement control set for most controls (command button, text box, etc) that have the Windows 7 aero look to them, so no need for manifests and such, as well as each control having events such as Mouse Enter, Mouse Exit, etc which the standard VB6 controls lack as well. So that's several birds with one stone.
  • Another control that has been included is the Alpha Image control, which supports alpha image formats such as PNG, and as such can display PNGs right on your form in design/run-time.
  • I have also included a subclassing control which is hidden on the form, who's events are subclassed at runtime to events such as Form move, Form size, Finished moving, etc. This control can also be used to set many other functions (min/max form size, etc) that are usually done effectively via subclassing with a module and code that makes you project more complicated code-wise.
  • In addition to all of this, I have included a class module with many many APIs and functions to utilize those APIs for basic Windows function that VB6 does not have built in (play sound, get system work area, make registry key, read/write ini files, alphablend pictureboxes, read/write flat files, get titlebar height, get computer name, add program to Windows startup, and many many other useful functions that are available through a context menu by typing API.(context appears))
  • Last but not least, I have replaced many of the forms default values such as StartUpPosition to CenterScreen and the like, as well as replaced the default icon with a more attractive and Windows 7 looking form icon with more detail. The default names are appropriately named as well (frmMain, clsFunctions etc)
  • Additionally I must thank:
    Lavolpe for his AlphaImage control
    Fauzie for the AeroSuite
    I can't find the source or author of the Subclassing control, please notify me if you are this person

    By creating a shortcut to this project file, you can use this to open up VB6, instead of a shortcut to the actual VB6.exe, which shows the pesky new project dialog with outdated and annoying default values.

You can download this project with all the compiled controls which is a single Project file at my website: (OpenZource)

ASM Threaded API Call

This class will allow you to call any API in another thread, and get a notification when finalizes.
Also you'll get the LastError caused by that API; because it's not possibly to call GetLastError from the VB thread, since each thread has its own LastError.
To utilize this class, just instanciate it, call the function ".Init" with the API name, dll and its parameter count. 
Later, just call .CallFunc whit an unique Key, timeout, and the parameters.

NOTE!: A special care must be taken with the parameters. Since we pass pointers, (EG: StrPtr(var)), VB might deallocate the variable before the API gets called. To avoid this, consider using statics variables, or arrays, if needed (EG: If you're passing longs which aren't pointers, then its not necessary).
UPDATE: Fixed a small bug that causes an error while Initializating libraries which weren't loaded previously (Added LoadLibrary previous the zFnAddr) 

Superior Code contest winners for Visual Basic 6.0 - March 2014

Superior Code contest winners February 2014 (For code submitted January 2013)

  Cheikh Mat

Pseudo Guitar TAB Encoder

App for encoding guitar tabs in 4/4. The VB code is still a rough draft although you could already start encoding a number of short tunes. The file format is a semi-readable text file. Just change the ".bug" extension to ".txt" in order to read the contents. Clipboard images can be viewed in MS-Paint or a similar program.

Compilers Demystified - Function Pointers in Visual Basic 6.0

This is a VB6+ASM source code made by Bogdan Apostol. The purpose of this investigation is to enable applications written in Visual Basic 6 to use function pointers. Other advantages may be discovered, such as embedding native code in Visual Basic applications, thus extending the world of possibilities without the need of external DLLs. For the sake of keeping this as brief and concise as possible, other variations of the techniques used have been ignored and the focus has been maintained on detailing the one methodology which handles more common situations. More on:

HTTP Request Class (ASM+Threads)

This small class will allow you to generate HTTP requests of any kind. For example, you can send POSTs queries like you would do it with ajax.
It relies on the API "HttpSendRequest", and each request is done in a separeted thread, so the main thread wont get blocked.
When each thread ends (the API returned), an event is trigger (error, succes, etc).
Each "request" has a key (string) to identify itself against the other ones, so in each event, that key is passed to know which request triggered that event.
It's IDE safe (threads won't leak memory never, and the subclass is from Paul Caton). In the example, you can do 3 things:
1 - Send one request to google (GET /), and save the result to a file
2 - Send 10 requests to google (10x GET /), and save the results to files
3 - Post a variable in a example server ( POST / , q = test), and save the result to a file
Please let me know if there is anything broken, or maybe a feature request!
UPDATE: Now a special function was added, to prevent "Acces memory violations" when trying to delete the class when threads still running (this can be disabled via one Const in the top).
UPDATE2: Now SSL and Proxy is supported. Also the functions DumpRequestToString and DumpRequestToBuffer now works fine (preivous one has a bug that writes random memory). Timeout was replaced by the API timeout parameter, and finally, the events support the lLastError from the thread, so you can know why it failed.
PS: Thanks to Cobein for the idea and some tips.
UPDATE3: Added "InternetReadFile" inside the thread assembly, so its not going to block the main VB thread while reading the response text. Also some events and properties were changed to "mimic" WinHTTP object. 
As some user pointed out, this project is very similar to WinHTTP library, but for me, this one is better, since it doesn't add any garbage to the headers (like charset=UTF-8), and its multi-request.
UPDATE4: Added CreateBasicAuth function to generate the base64 string used in some http sites as an authentication method. Also, QueryInfoAsLong was fixed.