Saturday, April 19, 2014

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. 

No comments:

Post a Comment