January 9, 2001

Converting Strings From One Character Set To Another

The following function is an efficient way of converting strings from one character set to another. Using an array of 256 characters as a conversion table, the attached function replaces any invalid file name characters in lpszString with an underscore character. Of course, the conversion table can be modified to

Avoiding Crashes Due to Multiple Deletes

Many times, a program crashes due to multiple deletes on the same pointer. In some cases, this is due to a programming error that can be removed. There are situations, however, where it may be unclear whether to delete a pointer or not. Let’s consider the code given below: void

Using Memset On Class Objects

It’s common practice in C, to do a memset on structures, in order to initialize all member variables to some default value, usually NULL. Similarly, you can use memset to initialize class objects. But what happens if the class contains some virtual functions?Let’s take an example: class GraphicsObject{protected: char *m_pcName;

Structs and Unions

It is common knowledge that the only difference between a struct and a union in C is that all elements of a union share the same memory location but the elements of struct do not. In C++, a struct is very similar to a class, the only difference being that

Creating an MSACCESS Database through VB

I have frequently seen bulletin board requests on how to create MSACCESS databases with VB. To do this, add a reference to the Microsoft DAO _._ Object Library (I am using Version 3.6 for the sample code below). Add the sample code where appropriate (e.g., call it from button click

ComboBox Autofill

ComboBox controls, out of the box, don’t help complete phrases as they are typed in. The sample code below accomplishes that task. cmb is the name of the ComboBox to which Autofill is added. mbNoManualChange is a modular level variable used as a status flag, preventing the UpdateText routine from

Use Recursion to Simplify Object Deletion Using ADSI and VBScript

An object in a Netscape Directory Server can only be deleted if it is a terminal node. This restriction causes the writing of source code to delete an object and all of the object’s children in the directory to be very complex. However, recursion can greatly simplify this operation.In the

A Quick Way to Register and Unregister DLLs

It’s really a pain to continually register, unregister, and reregister a DLL (or worse, many DLLs) using REGSVR32. Importing the following into your registry, allows you to set up options in the context (right-click) menu for registering (or unregistering) DLLs quickly and easily. Just copy the text below into a

No more posts to show