[API]
EnumChildWindows

[INCLUDE]
GetWindowText
SetWindowText
LoadResEx_String
LoadResEx_WindowIcon

[DEFINE]
Private Const LoadResEx_ClassicStringsToVBForm_ReplaceExString As String = "$"

[CODE]
Public Sub LoadResEx_ClassicStringsToVBForm(ByVal xWindow As Form, Optional ByVal MainIconResID As Long = -1&)
  Dim xObj1 As Control
  
    For Each xObj1 In xWindow.Controls
      If (TypeOf xObj1 Is Label) Or (TypeOf xObj1 Is Menu) Then
        If Len(xObj1.Caption) > 1& Then
          If Left(xObj1.Caption, 1&) = LoadResEx_ClassicStringsToVBForm_ReplaceExString Then
            xObj1.Caption = LoadResEx_String(Val(Mid(xObj1.Caption, 2&)))
            End If
          End If
        End If
      Next
    
    Call LoadResEx_ClassicStringsToVBForm_InternalCallback_EnumChildProc(xWindow.hWnd, ptrTemp)
    Call EnumChildWindows(xWindow.hWnd, AddressOf LoadResEx_ClassicStringsToVBForm_InternalCallback_EnumChildProc, ptrTemp)

  If Not MainIconResID = 0& Then
    Call LoadResEx_WindowIcon(xWindow.hWnd, MainIconResID)
    End If
  End Sub
  
Private Function LoadResEx_ClassicStringsToVBForm_InternalCallback_EnumChildProc(ByVal hWnd As Long, ByVal xParam As Long) As Long
  Dim xChar1 As String
  
  xChar1 = Getwindowtext(hWnd)
  If Left(xChar1, 1&) = LoadResEx_ClassicStringsToVBForm_ReplaceExString Then
    Call Setwindowtext(hWnd, LoadResEx_String(Val(Mid(xChar1, 2&))))
    End If
  LoadResEx_ClassicStringsToVBForm_InternalCallback_EnumChildProc = True
  End Function
