October 13, 2001

Moving DNA applications from COM+ to .NET: Drill down to Serviced Components

he whole set of COM+ services are madeavailable in .NET via a set of classes gathered into theSystem.EnterpriceServices namespace. Such classes are implemented in the sharedassembly named System.EnterpriseServices.dll. Almost all COM+ settings have their .NETattribute counterpart. Using .NET attributes at the proper level (method,interface, class, assembly) it’s possible to control

Get the exit code of a process

In a few cases, in particular when running MsDos batch files from within a VB application, you may want to determine the ERRORLEVEL set by an external application. You can’t do it with a plain Shell statement, but the job becomes easy with the support of the GetProcessExitCode API function:

Determine whether a control has a scrollbar

There is no built-in VB function that lets you know whether a control – such as a ListBox – is currently displaying a vertical scrollbar. Here’s a pair of functions that check the control’s style bits and return a Boolean that tells if a vertical or horizontal scrollbar is visible:

Check for a valid URL

Before posting an Internet request you should check that the user has entered a valid Internet address. You can do this with a parsing routine, or use the following routine based on the IE5 library: Private Declare Function IsValidURL Lib “urlmon” (ByVal pBC As Long, _ url As Byte, ByVal

Sorting on multiple keys

Frequently you need to sort arrays of records using multiple keys. This may be required since one single key does not uniquely identify a record (e.g. you may need both LastName and FirstName to select a given employee in a large company where people with same name work), or it

Determine memory usage

The GlobalMemoryStatus API function returns detailed information about the current load on the physical and virtual memory. You can use the following code to display the current amount of free memory: Dim ms As MEMORYSTATUS Dim msg As String ‘ query for memory data ms.dwLength = Len(ms) GlobalMemoryStatus ms ‘