Applications that display tool edit controls should monitor the use of User and GDI handles to ensure that VisionPro tool edit windows can be opened. You can use the GetGuiResources function to obtain the number of user or GDI handles currently in use by a process, as in the following example.
Note: GetGuiResources is available only in Windows 2000 and later. It is not available in Windows NT.
Private Declare Function GetGuiResources Lib "user32" (ByVal hProcess As Long, _
ByVal Flags As Long) As Long
Private Const GR_GDIOBJECTS = 0
Private Const GR_USEROBJECTS = 1
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
Sub OpenToolEditDialog()
Dim NumGDIHandles As Long, NumUserHandles As Long
NumGDIHandles = GetGuiResources(GetCurrentProcess, GR_GDIOBJECTS)
NumUserHandles = GetGuiResources(GetCurrentProcess, GR_USEROBJECTS)
If NumGDIHandles > 8000 Or NumUserHandles > 8000 Then
MsgBox "Please close some windows before editing the tool."
Exit Sub
End If
' Have enough resources so open a new dialog
End SubIf your application exhausts User or GDI handles, it may display the following error message:
Unexpected error in control_name Edit Control ....UserControl_Initialize Failed to load control 'name' from CogWidgets.ocx. Your version of CogWidgets.ocx may be outdated. Make sure you are using the version of the control that was provided with your application.
where control_name is a VisionPro tool edit control.