Windows API Guide: SHQueryRecycleBin Function


Declare Function UnregisterClass Lib "user32.dll" Alias "UnregisterClassA" (ByVal lpClassName As Any, ByVal hInstance As Long) As Long

Platforms

  • Windows 95: Supported.
  • Windows 98: Supported.
  • Windows NT: Requires Windows NT 3.1 or later.
  • Windows 2000: Supported.
  • Windows CE: Requires Windows CE 1.0 or later.

Description & Usage

UnregisterClass unregisters a window class, after which it can no longer be used. Obviously, a window class cannot be unregistered if windows still exist which belong to the class. All window classes created by an application should be unregistered after the application is completely finished using them.

Return Value

If an error occured, the function returns 0 (use GetLastError to get the error code). If successful, the function returns a non-zero value.

Visual Basic-Specific Issues

None.

Parameters

lpClassName
The name of the window class to unregister, or an atom identifying the window class to unregister.
hInstance
A handle to the instance which originally registered the window class.

Example

' This code is licensed according to the terms and conditions listed here. ' Register a new window class.  The various properties to ' give it will be explained in the code. ' *** Place the following code in a module. *** ' Define the window procedure to use for the class.  Here, we'll ' just make a wrapper for the default window procedure. Public Function WindowProc (ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long   ' Return whatever the default window procedure returns.   WindowProc = DefWindowProc(hWnd, uMsg, wParam, lParam) End Function ' *** Place the following code where you want to register the class. *** Dim classinfo As WNDCLASSEX ' holds info about the class Dim classatom As Long  ' receives an atom to the class just registered ' Set the various data members of the structure. ' Of course, set the size of the structure. classinfo.cbSize = Len(classinfo) ' Class style: give each window its own DC; redraw when resized. classinfo.style = CS_OWNDC Or CS_HREDRAW Or CS_VREDRAW ' Use the window procedure above to process messages. classinfo.lpfnWndProc = AddressOf WindowProc ' We aren't using any extra information. classinfo.cbClsExtra = 0 classinfo.cbWndExtra = 0 ' Handle to the instance of this application. classinfo.hInstance = App.hInstance ' Use the icon stored in C:\MyApp\deficon.ico. classinfo.hIcon = ExtractIcon(App.hInstance, "C:\MyApp\deficon.ico", 0) ' Use the cursor stored in C:\MyApp\mouse.cur. classinfo.hCursor = LoadCursorFromFile("C:\MyApp\mouse.cur") ' Fill the background with the system color for an application's workspace. classinfo.hbrBackground = COLOR_APPWORKSPACE ' No menu resource to use. classinfo.lpszMenuName = "" ' Give the class a name. classinfo.lpszClassName = "CustomClass" ' Use the small icon stored in C:\MyApp\deficonsm.ico. classinfo.hIconSm = ExtractIcon(App.hInstance, "C:\MyApp\deficonsm.ico", 0) ' Finally, register the class. classatom = RegisterClassEx(classinfo) ' Now the class CustomClass can be used to create windows. ' *** Place the following code where you wish to unregister the window class. *** Dim retval As Long ' Unregister the window class. retval = UnregisterClass("CustomClass", App.hInstance)

See Also

RegisterClass, RegisterClassEx

Category

Window Classes

Go back to the alphabetical Function listing.
Go back to the Reference section index.


Last Modified: August 24, 1999
This page is copyright © 1999 Paul Kuliniewicz. Copyright Information Revised October 29, 2000
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/u/unregisterclass.html



Windows API Guide
Windows API Guide - Reference - Volume 1: Version 3.0 For the MS-DOS and PC-DOS Operating Systems
ISBN: B001V0KQIY
EAN: N/A
Year: 1998
Pages: 610

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net