June 8, 1999

Use Command Lines for MTS Operations in NT Systems

If you’re using Microsoft Transaction Server technology, opening up MTS explorer and using refresh is an overhead on the system compared to command line options. Instead, you can use “mtxstop”, which stops the transaction server and “mtxrereg”, which reregisters the MTS components. This technique is useful if you extensively use

Forms Not Showing Up in Taskbar

In VB3 you can set up an executable project to start up in the main subroutine, and it shows up in the Windows 95 taskbar: Public Sub Main() Load frmFoo frmFoo.Show 1 Unload frmFooEnd Sub However, if you show a form modally in VB5, no matter if it’s the first

Form-Level Variables Won’t Clear

When you use multiple forms in a project, make sure you explicitly set a form to Nothing after you unload it. If you don’t, simply unloading the form won’t necessarily clear out variables from the form. Setting it to Nothing does reset form-level variables: Private Sub ShowNewForm() Load Form2 Form2.Show

Overloading the Subscript Operator the Right Way

It is customary to overload the subscript operator, [], in classes that hold a sequence of elements. Vector and String are examples of such classes. When you overload operator [], remember to define two versions thereof: a non-const version and a const one. For example: class MyString{private: char * buff;

Use Refresh, Not DoEvents

When executing code and tying up the system, developers often use a label or status bar to display messages. If you simply assign your text or message to the control (for example, lblMsg.Caption = “Still working…”), you won’t see the text because your code loop isn’t allowing the form to

Accessing a C++ Object in C Code: Support for Virtual Base Classes

C code should not access objects that have a virtual base class. The reason is that a virtual base is usually represented in the form of a pointer to a shared instance of the virtual subobject. The position of this pointer among user-defined data members is implementation-dependent. Furthermore, the pointer

Accessing a C++ Object in C Code: Different Access Specifiers

The fourth restriction on the legality of accessing C++ objects from C code states that all the data members of the class must be declared without an intervening access specifier. This means, theoretically, that the memory layout of a class that looks similar to this example might differ from a

Accessing a C++ Object in C Code: Support for Virtual Member Functions

In the case of virtual functions, an additional member is inserted into the class: a pointer to the virtual table, or _vptr. The _vptr holds the address of a static table of function pointers. The exact position of the _vptr among the class’ data members is implementation-dependent. Traditionally, it was

Be Careful When Mimicking Tool-Tip Help

Be careful about tips to easily duplicate tool-tip help with only tip control and mouse events. If your “tip” control doesn’t have the same parent as the control you’re moving over, you’ll put your tip control in the wrong spot! The coordinates for a control refer to its parent, so