January 8, 2000

Open the default program for sending email messages

The ShellExecute API function recognizes email addresses if they are prefixed by the “mailto:” prefix, and correctly run the default program for sending email messages (e.g. Outlook). This lets you open a window for sending an email and automatically fill the address field. Here’s a wrapper routine that encapsulates the

Open Windows’s Start menu

By simulating the pressing of the “Windows” menu – or better yet, of the Ctrl-Escape key combination, which also works on older keyboards – you can programmatically bring up the Start menu. You can’t use the SendKeys function to do so, though, and you have to resort to the keybd_event

Launch the default browser on a given URL

The following routine launches the default browser and loads the specified URL in it. The argument doesn’t have to include the HTTP:// prefix. If the operation is successful it returns True. Private Declare Function ShellExecute Lib “shell32.dll” Alias “ShellExecuteA” _ (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile

Get the list of ODBC drivers

The ODBCTOOL.DLL library contains three functions that make it easier to manage DSNs. To run the following code you must add a reference to the “ODBC Driver & Data Source Name Functions” library to your References dialog box. If you don’t find this library listed in the References list, use

Get the list of ODBC DSNs

The ODBCTOOL.DLL library contains three functions that make it easier to manage DSNs. To run the following code you must add a reference to the “ODBC Driver & Data Source Name Functions” library to your References dialog box. If you don’t find this library listed in the References list, use

Add a file to the list of recent documents

The Windows shell provides a function that lets you add a file to the list of the recent documents, that is the list that you can access from the Start menu: Private Declare Function SHAddToRecentDocs Lib “shell32.dll” (ByVal dwFlags As _ Long, ByVal dwData As String) As Long To add

Change the ShowInTaskbar property at runtime

The ShowInTaskbar property lets you decide whether a form is visible in Windows taskbar or not. However, this property is read-only at runtime, so it seems that you can’t change this setting while the program is running. Luckly, you just need to change the window’s style, using a pair of

To Virtual Or Not To Virtual?

You’re probably aware of the overhead that is associated with calling a virtual member function. However, the performance penalty in this case might even be higher than you think because the comparison isn’t always between static versus dynamic binding. Usually, compilers can’t inline a virtual function call. Thus, the performance

Calling a Virtual Member Function From a Constructor

When you call a virtual member function from a class’s constructor, the actual function that gets called is the one defined in the object whose constructor is executing. Virtual member functions of an object derived from the one whose constructor is executing

No more posts to show