June 5, 2001

WindowsBuildNumber – Get operating system build number

Private Type OSVERSIONINFO dwOSVersionInfoSize As Long dwMajorVersion As Long dwMinorVersion As Long dwBuildNumber As Long dwPlatformId As Long szCSDVersion As String * 128End TypePrivate Declare Function GetVersionEx Lib “kernel32” Alias “GetVersionExA” _ (lpVersionInformation As OSVERSIONINFO) As Long’ Windows Build number.Function WindowsBuildNumber() As Long Dim os As OSVERSIONINFO, ver As String

Why You Shouldn

There are fundamental incompatibilities between the ways AWT and Swing draw themselves. Swing classes are pure Java classes that look the same on all operating systems. AWT Java classes are not pure Java classes. They use underlying C/C++ native code (OS dependent) that can cause different appearances in different operating

Easily Track Exceptions That Occur Deep Inside Your App

OBJECT_NAME is a module level constant and ‘PROC_NAME is a procedure level constant. You need these because not all objects know their own names, and procedures certainly don’t. Use the following error handler everywhere except on the user interface. When the error is displayed on the top level interface the

Decoding the Application/x-www-form-urlencoded Data

The java.net.URLDecoder class has a static method to perform this decoding. The following code fragment resides in the doGet() or doPost() method of a servlet. The variable request is a javax.servlet.http.HttpServletRequest object: String encodedData = request.getQueryString() String decodedData = java.net.URLDecoder.decode (encodedData) The decode(String)method does the following:1. The plus sign ‘+’

Debugging the OCX, DLL, or EXE

The same code can be used for debugging either in development or in production environments. To do so include the following subroutine in the module: Private Sub ShowMessage(msg As String) If bDebugMode Then MsgBox msg, , “This message produced because of DebugMode setting” Else Debug.Print msg End IfEnd Sub In

Creating Controls through Coding

This tip is useful for when you are going to make software with a huge facility in which users will have rights to create their own database fields. When a user creates a field in a database, it should be displayed to the user. However, you don’t know how many

Make Collections Work Like Standard VB Collections – For Each…Next

To activate For Each…Next iteration in your VB collections, place the following procedure in your collection object: ‘ NewEnum must return the IUnknown interface of a’ collection’s enumerator.Public Function NewEnum() As IUnknown Set NewEnum = YourCollectionObject.[_NewEnum]End Function To hide the NewEnum function, and to give it the appropriate procedure ID,

An Efficient Way to Find Mod Value For Using Mod of Even

To determine whether a number is divisible by some even number you have to use the Mod operator in VB. The following code is an alternate, faster way of doing this: Private Function GetRemainder(iNumber As Integer,iDivisor As Integer)As IntegerGetRemainder=iNumber And (iDivisor-1)End Function Note: This function will only work for getting

The Protected Modifier

A protected feature of a class is available to all classes in the same package, just like a friendly feature. Moreover, a protected feature is available to all subclasses of the class that own the protected feature. This access is provided even to subclasses that reside in a different package

No more posts to show