Advertisement

Results for "Author: rde"

4_2005-2006 #168767
Arithmetic operations on memory address pointers

Function to enable valid addition and subtraction of unsigned long integers. Treats the passed value as an unsigned long and returns an unsigned long. Allows safe arithmetic operations on memory address pointers. Assumes valid pointer and pointer offset. Rather fast too, has very small performance hit compared to unsafe in-line calculation, even in intensive loops. The code for addition came from PSC (LukeH) but I needed subtraction as well, thought I'd share. Confirmation that this produces valid results would be appreciated.

4_2005-2006 #168768
Fast Sub-String Count (aka InStrCount)

This function searches the passed string for occurences of the specified sub-string. It has the ability to make case-sensitive or case-insensitive searches. It can also perform whole-word-only matching ... This SubStrCount implementation offers extended functionality which allows it to be used in a similar way to other token style functions ... SubStrCount will return the number of matches or zero if none.

4_2005-2006 #168769
A ShellSort with a twist - Revised and even faster! (7 March 2009)

This shell algorithm is founded on a very solid performer that was originally developed by vb2themax, and optimized further by several very talented coders, before I twisted a little more out of it in this hybrid version. ---- This latest version employs a clever SAFEARRAY substitution technique to trick VB into thinking the four-byte string pointers in the string array are just VB longs in a native VB long array, and is now much faster. ---- Also uses valid addition and subtraction of unsigned long integers to guarantee safe arithmetic operations on memory address pointers. ---- Includes both Shell and ShellHyb algorithms with indexed versions in 25kb class and demo project. ---- Update 21 June 2008 inspired by comments from Roger Gilchrist. Improved indexed sorting support routine to better exploit fast re-sorting performance, and added much needed index sorting documentation. ---- Obscure Bug Fix 7 March 09. I documented they 'can sort sub-sets of the array data' but with the indexed versions if you do an error *could* occur without this very small change.

4_2005-2006 #168770
Addin Extensibility Quick Reference + Tutorials

Addin Extensibility Quick Reference + Tutorials The VB5/6 IDE exposes a powerful object model that lets you manipulate VB's environment. It gives you control of your projects, components, modules, procedures, and even individual lines of code. You can customize all the menus and toolbars of the environment; trap nearly every user action, such as adding a new component or renaming an old one; open, scroll, move, and close all the code windows ... All this power comes at a price, however: the extensibility object model is rather complex, and you must spend some time acquainting yourself with how it works ... Hopefully, this extensibility quick reference will help you familiarise yourself more quickly and offers this information in a handy code format ... Now includes some tips and a couple of small MSDN tutorials ... Please report any errors or omissions - happy coding.

4_2005-2006 #168771
Working with the Visual Basic IDE

This is a guide to help total beginners familiarize themselves with the Visual Basic development environment.

4_2005-2006 #168772
MultiInStr (Update Nov 7, 2009)

This is an improvement on the MultiInStr function that appears in other peoples code now and again ... I don't know who the original author was, so I hope who-ever you are you don't mind ... The original code would search through a string looking for occurences of single characters, while this pair of functions search for single-or-multi character terms within the given string ... Included are MultiInStr and MultiInStrR functions ... Hope someone finds them useful ... Update 25 May - improved versions added thanks to contributions from Kenneth Buckmaster ... Update 7 Nov - Reset string len bug fix in Ken's MultiInStr ... Happy coding

4_2005-2006 #168773
A Complete set of VB6 functions not available in VB5

Demonstrates how simple functions written in pure VB can be faster than many of VB's built in functions. For example, the super short and simple Split function is 30% faster than VB's. The Replace function with no API optimizations is 2 times faster than VB's, and over 3 times faster on large strings ... All functions are written in pure VB. Also declares the GetLocaleInfo API for use with the First Day Of The Week related functions, and for default system settings for the Formatting functions ... This would be a great learning tool for newbies. Of course, it would also be a great resourse for anyone using VB5, just plug this module into any project to enable all the VB6 functions it uses.

4_2005-2006 #168774
Fix Line Endings Program

This VB5 program can parse large text files reading in a chunk at a time and will replace UNIX Lf chars with Windows CrLf's, or vice-versa. It uses API to boost performance and is very fast. Demonstrates finding and replacing text that crosses over the chunk boundaries - and is further complicated by the need to access the previous char to avoid replacing a Lf with CrLf if already preceded by a Cr. Uses no VB6 only functions and is just 32k compiled with no compiler optimizations. Includes word list to parse - a tiny file really at 4.5 MB but parses in a blink even in the IDE. Hope someone finds it interesting, or even useful! Happy coding, Rd :)

4_2005-2006 #168775
Extremely Fast Case-Insensitive Unicode String Array Sorting Class

Extremely Fast Case-Insensitive Unicode String Array Sorting Class (Revision II) *********************************************** This string sorting class is extremely fast at case-insensitive sorting operations due to the combination of a highly optimized Blizzard quicksort algorithm, extremely fast in-place unicode comparison thanks to Ralph Eastwood, and a unique textual compare lookup table that is built only once at initialization in just over one hundredth of a second thanks to LukeH, and stored in a long array which is accessed in-line to minimize the case-conversion impact on this supremely fast comparison algorithm. Its performance on case-insensitive operations is only slightly slower than its case-sensitive binary compare operations, and is well over two times faster than StrComp's textual compare mode when used within the very same algorithm. Turning off strict compatibility with VB's StrComp function will improve performance on case-insensitive operations even further. *********************************************** Special thanks to the following for their generous contribution to this sorting class: ***************************** QuickSort Origins ~ C.A.R. Hoare ******************** String Comparison ~ Ralph Eastwood (tcm) ************* LowerCase Conversion ~ LukeH (selftaught) ************ SafeArray Substitution ~ Luke, Ralph, & Rd *********************************************** Blizzard quicksort algorithm and in-line lookup table by Rd :) *********************************************** Revision I - Fixed potential bug! Added demo project. *********************************************** Revision II - Fixed null-string descending bug!

4_2005-2006 #168776
Kill Folder function with persistence

This is a Kill Folder function with persistence ... It will remove all sub-folders and files and then optionally delete the specified folder ... I found when removing all the files in the temp folder that some locked files would fail and cause it to not continue with the rest of the files ... This function will continue to remove all unlocked files, even after finding locked files. However, if locked files are found, the parent folder will also not get removed.

4_2005-2006 #168777
API data types

Explains the use of non-VB data types to help in converting C declarations to Visual Basic. 10k zip

4_2005-2006 #168778
Tips

Some very basic but handy tips for newbies (and maybe not so newbies). Hope you learn something. I've added quite a bit more to the article, mostly very basic info on the vb language, but we all had to learn this stuff when we started out.

4_2005-2006 #168779
JpgStrip v1 Freeware Source Code

This JPEG strip code is in response to a recent submission on JPEG info extraction. This code was developed by David Crowell using vb5, so don't vote. I posted it for those interested in learning more about the internals of the JPEG graphic format. Please follow Davids request to leave this zip archive intact if you re-distribute it. This is version 1, and David is still developing it, he has a freeware exe version 1.3 available at: www.ksurf.net/~bermania/prog/dessin/jpgstrip.zip I don't know whether sourse code is available.

4_2005-2006 #168780
InstallFile module - Install files on end user's machine w/o copy older version over a new version.

When installing a file on an end user's machine, you should not copy an older version of the file over a new version. The InstallFile wrapper in the InstFile.bas module uses the VerFindFile and VerInstallFile API functions provided by Version.dll to copy files to the user's machine, and will not overwrite an existing file with an older version. The InstFile.bas module requires the GetVersionInfo wrapper in the VerInfo.bas module (also included) which uses several API functions also provided by Version.dll, most importantly the GetFileVersionInfo function.

5_2007-2008 #190480
An Inter-App Messaging Control v3 - Update 7 Nov 2009

This is a complete and functional control that uses the Copy Data Structure to pass data between applications that utilize this control. It allows you to pass numeric data, strings, dates, currency, in fact all data types (except variants), including arrays and udts, and arrays of udts (except arrays of variants and strings). Update v3 removed the parent hook, and fixed a bug in passing UDTs and now works in both VB5 and VB6. Updated demo thanks to Zhu now shows Unicode strings.

5_2007-2008 #190481
Setting and getting file attributes w/o affecting other attributes - Updated

These two simple wrappers can be used for setting and retrieving individual or selected file attributes without affecting the other attributes of the file. For example, to set the Archive bit of a file you should not just set its attributes to vbArchive (32), as this will turn off any other attributes currently set. Normally you would need to get the file attributes, add the desired attribute to the current attributes, then set them again. These wrappers just hide the details of this process. Update thanks to redbird77. +++++++++++++++++++++++++++++++++++++++++++++++++++ With the GetAttrib wrapper you can easily test the current state of an attribute. You simply specify the attribute(s) and the function will return True if the specified attribute(s) is set to on. You can specify more than one attribute and True will be returned only if all specified attributes are turned on. +++++++++++++++++++++++++++++++++++++++++++++++++++ The SetAttrib wrapper simplifies the setting of an attribute to on or off, and will be set as desired irrespective of its current state. You can set more than one attibute at a time (eg. SetAttrib(sFile, vbReadOnly Or vbHidden) will set these attributes to on, no matter if they are on or off, without affecting other attributes that may be set. +++++++++++++++++++++++++++++++++++++++++++++++++++ My first version of the SetAttrib function used 'Xor' to turn attributes off, but thanks to redbird77, I have updated it to 'Not' which has eliminated a limitation of my version. The bottom line is that you can set a files attribute(s) to on or off without needing to know the current state of the specified attributes, while not affecting other attributes that may be set.

5_2007-2008 #190482
The Question of Existence

I have come across several different solutions for testing for a file's existance, from Dir to opening the file, testing for error, then closing the file again. I remembered an article/comment by Bruce McKinney that influenced my solution to this problem and thought I would share it.

5_2007-2008 #191270
Demonstrating Objects and Arrays

This demonstrates the use of Objects and Arrays using simple examples. Shows the differences between objects and arrays, adding properties and methods, explains associative arrays, constructor functions, all by example. Although I have put it in the beginners section, experienced js scripters may find some interesting facts about arrays lengths, deleting items and more. Hope you find it helpful.

5_2007-2008 #191271
FileSync Utility v5 Unicode Enabled

Simple synchronize backups and remove duplicates utility Added option to remove empty folders after delete operations v3 adds the option to use file CRCs for exact matching - this helps in situations where time stamps are different when files are still identical. v4 updates the whole project to use the 'W' API functions to preserve unicode. v5 fixes a bug introduced in v4

5_2007-2008 #191272
Unpack specified file from RAR Archive

This module is a wrapper for the unrar.dll freely available from www.rarlab.com Enables unpacking a specified file from a RAR archive, both to disk as a file or only to memory (string variable) as the file text. There are a couple of other posts on RAR archives, and extracting a single file from an archive has not been demonstrated, and I needed this functionality for my ZipSearch project. Thought others might be interested in this functionality - reuse as you see fit. Note that the declares for the library functions are named unrar and unrar3 depending on the version you have. Get a free copy of this DLL from: www.rarlab.com - Extras www.rarlab.com/rar_add.htm - UnRAR.dll ftp://ftp.rarlab.com/rar/UnRARDLL.exe Happy coding :)

Languages
Top Categories
Global Discovery