devxlogo

The Latest

Prefer Initialization to Assignment of Objects

In general, assignment requires the creation and destruction of a temporary object, whereas initialization does not. This is true for not just for strings, but for every object type, so

Simulating Virtual Constructors

A constructor may not be declared virtual. The easiest way to simulate virtual construction is by defining a virtual member function that returns a constructed object of its class type:

Member and Non-Member Overloaded Operators

Most of the overloaded operators can be declared either as non-static class members or as non-member functions. In this example, operator == is overloaded as a non-static class member: class

Create Automatic Hourglass Cursors

If you create an ActiveX control that uses a custom MousePointer property, place the control on a form, and at run time change the Screen.MousePointer property to an hourglass. You’ll

Translate Color Values

With the RGB function, VB provides a neat and valuable tool for converting separate Red, Green, and Blue values into a single Long color value.. However, VB won’t let you

Extend Intrinsics in UserControl Wrappers

Sometimes you might want to create autoselecting combo boxes, like those in Intuit Quicken or Microsoft Access, where items in the list are selected as you type. Typically, techniques to

Provide Status Messages for Menus

Subclassing a form lets you give a helpful message whenever a user highlights a menu item. Use the Caption property to identify the menu item, then display the help message

Access Properties Only Through the Object Browser

You can access certain properties of forms, modules, classes, and events within them only through the Object Browser. To see and update the properties, right-click on the element and select

Cross-Platform Font Uniformity

The fact that HTML fonts display smaller on Macintosh monitors than on PC monitors can cause problems for Web site designers. The cause of the problem is Macintosh monitors default

Simplifying Switch Options

C/C++ programmers are used to parsing command line arguments using the “int argc” and “char *argv[]” parameters to the main() function. Java programmers can use a similar syntax to greatly

Setting Your Default URL

Question: How can I set my home page as my default URL? Answer: Setting your default URL is done differently in Microsoft Internet Explorer and Netscape Navigator. From within Microsoft

Cross Browser Database Application

Question: I am about to embark on a new Web-based application using Internet Information Server (IIS), Active Server Pages (ASP), SQL Server, and Visual InterDev. So, the back end is

Increasing Internet Speed

Question: I own a 366MMX Pentium Intel II computer and the Internet still seems slow. Is there any way I can increase the speed of searches and downloading? Answer: The

Drawing With JavaScript

Question: It seems to me that you should be able to draw images in JavaScript by positioning single-pixel GIF images according to a given algorithm. First, how would you generate

Determining the Version of JavaScript Running

Question: How can I tell which version of JavaScript I am running? I have written JavaScript that runs under Netscape 3 and all the more recent browsers. Answer: In the

Printing Out a Column in an Array

Question: What is the command for printing out a column? Answer: In general, you’ll probably use an HTML table, with a single cell in each row, to display your data.

Distributed Client/Server Architecture

Question: What are the features of a distributed client/server architecture? Answer: The Web is an ideal environment to implement applications that take advantage of a distributed client/server architecture. In fact,

Making an Alert Pop Up With a Message

Question: How do I make an alert that pops up and says “this site best viewed with IE4 at 1024 x 768”? Answer: Making such a popup is easy. Just

You Cannot Change the Title of an Alert Box

Question: How can I change the title of a JavaScript alert box from “www.www.www (JavaScript Application)” to whatever I want? Answer: Simple?you can’t. Unfortunately, JavaScript coders don’t have any control

Internationalizing Currency Value Displays

As with dates, different countries and regions use different symbols and formats when displaying currency values. Java 1.1 provides a simple facility for displaying a currency value in a manner

The qq Function for Long Strings in Perl

If you write CGI programs in Perl, you probably find yourself using a lot of long print statements for outputting HTML. HTML uses a lot of double quotes, so it’s

Assigning the Size of an Array at Run Time

When delaring an array of primitive types in C and C++, you have to assign a constant for the array size. Since Java treats arrays as objects, the size of

Generating a Series of Unique Colors

Graphs, charts, and maps often use color to help the user tell data points apart. For instance, a line graph comparing processor benchmarks might show the Motorola processor in red,

URL Redirection With Perl

Once your Perl CGI program has run and you’re ready to display the results, you have a couple of choices. If the results are dynamic and different for every user,

Layers or DIVs?

The world of DHTML is a chaotic one right now. Netscape Navigator 4.x and Internet Explorer 4.x have sufficiently different implementations of the Document Object Model (DOM) that cross-browser DHTML

Use MouseMove for Easy StatusBar Updates

You can easily make your program show descriptive text on a StatusBar control in response to mouse movement. Assign the text to the appropriate panel in the MouseMove events of

Easy Confirmation

Sometimes you want to give your users the chance to confirm that they wish to proceed with the closure of a form. Instead of using a MsgBox function and a