October 27, 1999

Debugging an MTS component in Visual Basic 6.0

To debug an MTS component in Visual Basic 6.0, make sure that the MTSTransactionMode property on MTS Objects (VB 6.0 Classes) is set to a value other than 0-NotAnMtsObject. When F5 is hit to begin debugging, and this property is set to a valid value, the object will be activated

The Importance of Virtual Destructors

Some classes in the Standard Library do not have a virtual destructor or virtual member functions by design. These classes include std::string, std::complex, and all STL containers. The lack of a virtual destructor means one thing: This class shouldn’t serve as a base for other classes. Still, you can find

Use Pointers to Parents

When trying to navigate through a complex class hierarchy from any given instance of an object, it’s useful to be able to reference its parent. But how do you clean up any circular references when terminating the objects? Here is a simple way to retrieve a parent object using the

Toggle Toolbar Captions Using Tag

Many applications have an option to show the toolbars as text and image or text-only. I have seen programmers handle this with two toolbars and show them based on the user’s selection. This code uses only one toolbar. The only requirement is to store the desired Caption in each button’s

Beware of Object Slicing

Passing a derived object by value to a function that takes a base object by value may cause a problem known as “object slicing”; every additional data member declared in the derived object is omitted. The resultant object contains only the data members declared in the base class. Furthermore, the

Run Web Applications in Their Own Memory Space

You can protect the server from a crashing application by running the Web applications in their own memory space. To configure IIS to do this, launch the Internet Service Manager from the Microsoft Internet Information Server menu under Windows NT 4.0 Option Pack. Open the node for the Web server

Count Substrings

This little routine demonstrates how easily you can determine the number of substrings within a string, given any specified separator character(s). Pass the string to be parsed, and the separator, which might be multiple characters long, and DCount returns the number of substrings: Public Function DCount(ByVal vData As String, _

Killing an Object Prematurely

Sometimes, you need to force an object to destroy itself because its destructor performs an operation needed immediately. For example, when you want to release a mutex or close a file: void func(Modem& modem) { Mutex mtx(modem); // lock modem Dial(“1234567”); /* at this point, you want to release the

Construct Shortcut to an Interface

hen using a class that implements an interface, it can be frustrating to have to create two variables to reference all the properties of both the interface class and the implemented class. For example, if the CEmployee class implements the IPerson interface, then you need two variables: Dim Emp1 As

No more posts to show