March 23, 2000

Tile With Lightweight Image Control Arrays

I write apps for companies where computer know-how is at an all-time low. Most applications scare people to death. However, Web-style forms and graphic buttons present soothing enough interfaces that they can be inviting to users. I wanted my forms to look just like a Web page, so I devised

Enter Data on an MSFlexGrid

You can use MSFlexGrid for data entry without using additional ActiveX controls. For this, use the KeyPress and KeyUp events. To use the MSFlexGrid for data entry, add the grid?named FlxGrdDemo?to a form and copy this code: Private Sub FlxGrdDemo_KeyPress(KeyAscii As Integer) Select Case KeyAscii Case vbKeyReturn ‘ When the

The reverse() Algorithm

Another useful STL algorithm is reverse(). This algorithm reverses the order of elements in a specified sequence. reverse() takes two iterators that mark the sequence’s beginning and end, respectively. Here is an example of reversing the order of a char array: #include #include using namespace std; int main() { char

Use the VB Response Object to Generate Dynamic HTML Pages

I researched Windows Script Components (WSC) and was interested in their capability to integrate with ASP. I tried integrating a VB DLL with ASP. I included a reference to the Microsoft Active Server Pages Object Library (ASP.dll) in the DLL and used the Response object to write my HTML. I

Convert a Decimal Number to Base N

Here’s a function that converts a decimal number (base 10) to another base number system. Each digit position corresponds to a power of N, where N is a number between 2 and 36. In other words, if a number system’s base is N, then N digits are used to write

A C++ Virtual Machine?

It was a question of time until a C++ virtual machine would appear. Implementing a Java-style virtual machine for C++ is a trivial task. The problem is that such a virtual machine would suffer from the well-known ailments of Java: bloated and inherently slow code. At present, there are at

Implement a Context Stack

Isolating the source of an error in a method containing many nested method calls can be difficult. If you haven’t written comprehensive error-handling code in every method and property you write, or if you propagate errors up the call chain, an error handler in a high-level method won’t be able

Ensuring Proper Initialization of Template Arguments

In the following template member function, the parameter T can be a class or a built-in type: void vector< T >::resize (size_type new_size) { T val; // oops! What if T is a built-in type? if (new_size > size()) insert(end(), new_size – size(), val); else // ..more stuff } This

Wrap Date Functions in a Class

I’ve been working on a class module called clsDateInfo that returns various properties of a given date, and using it in some monthly trend graphs. I had to come up with the number of weekdays?not counting weekends?a given date was from the first of the month. The clsDateInfo.WeekDayOfMonth property returns

No more posts to show