August 28, 1999

Display the “Shut down Windows” dialog

To programmatically display the “Shut down Windows” standard dialog box you can use the SHShutDownDialog undocumented API function, whose declaration is: Declare Function SHShutDownDialog Lib “shell32” Alias “#60” (ByVal lType As _ Long) As Long Its only argument can be one of these constants: Public Const EWX_LOGOFF = 0Public Const

Hide or disable the desktop icons

The Desktop is a window like any other window in the system, so you can hide/show and enable/disable it. The only details you need to know is how to retrieve the handle to the Desktop window. It turns out that this window is the first child window of the “Program

Format a drive using an undocumented function

SHFormatDrive is an undocumented but simple API function that allows you to format a drive. This function simply opens “Format Drive” diaolog window. Being undocument you won’t find its Declare with the API Viewer utility: Private Declare Function SHFormatDrive Lib “Shell32.dll” (ByVal hWnd As Long, _ ByVal Drive As Integer,

Add pizazz to your apps with an animated cursor

Who said you can’t use an animated cursor with Visual Basic? Actually, it’s so simple! You just have to load your animated cursor through LoadCursorFromFile API function, then you get the current cursor using GetCursor, and finally you can set your cursor using SetSystemCursor. This is all the code that

Hide or disable the Windows’ application bar

The Windows’ application bar (or Startbar) is a window like any other window in the system, so you can hide/show and enable/disable it. The only thing you need to know is that that the class name of the Start bar window is “Shell_TrayWnd” and that its window name is a

How to apply the flat style to a toolbar

All recent Windows applications use a flat toolbar similar to Internet Explorer ‘s and Microsoft Word’s ones. Visual Basic 6 includes a Toolbar control that supports the flat look, but if you are still using VB4 or VB5 and you want to use a flat toolbar without buying a new

Get IP Address Via The Hostname

The class java.net.InetAddress represents an Internet Protocol (IP) address. You can use this class to find the IP address of a host using the hostname. The following code demonstrates this: try{ java.net.InetAddress inetAdd =java.net.InetAddress.getByName(“www.ibm.com”); System.out.println (“IP Address is : ” + inetAdd.getHostAddress());}catch(catch(java.net.UnknownHostException uhe){ //handle exception}

Get the Hostname via IP Address

The class java.net.InetAddress represents an Internet Protocol (IP) address. You can use this class to find the hostname of an IP address. The following code demonstrates this: try{ java.net.InetAddress inetAdd =java.net.InetAddress.getByName(“127.0.0.1”); //127.0.0.1 is loop back address System.out.println (“Hostname is: ” + inetAdd.getHostName());}catch(catch(java.net.UnknownHostException uhe){ //handle exception}