Declare these APIs in any module
Public Declare Auto Function FindWindow Lib "user32" _
(ByVal ClassName As String, ByVal WindowTitle As String) As IntPtr
Public Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" _
(ByVal hwnd As IntPtr, ByVal lpString As String) As Long
Suppose we have a FolderBrowserDialog named folderDialog in a Form named mainForm
Add this In module / class that has the Sub showing the Dialog
Imports System.Threading
Use This code in sub showing dialog
...
Dim thr As New Thread(
Sub()
Dim bNoWind As Boolean = True
Dim iPtr As IntPtr
While bNoWind
iPtr = FindWindow(Nothing, "Browse For Folder")
If iPtr <> IntPtr.Zero Then
bNoWind = False
SetWindowText(iPtr, "My Folder Browser Title")
End If
End While
End Sub
)
thr.Start()
mainForm.folderDialog.ShowDialog()
...
The idea is to start a new thread before showing the Dialog, because that showing the dialog pauses until "OK" or "Cancel" is pressed. The new tread starts searching for a window with the default title. When it is shown, it changes the title and the searching routine ends.
After closing the Browser window, the tread is closed.
This thread can be moved to any general function, to change Title on any type of window that Title can't be changed:
Imports System.Threading
Module modWindow
Public Declare Auto Function FindWindow Lib "user32" _
(ByVal ClassName As String, ByVal WindowTitle As String) As IntPtr
Public Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" _
(ByVal hwnd As IntPtr, ByVal lpString As String) As Long
Public thrWindow AsTread
Sub ChangeWindowTitle(sDefault as String, sCustom as String)
thrWindow = Nothing
thrWindow = new Thread(
Sub()
Dim bNoWind As Boolean = True
Dim iPtr As IntPtr
While bNoWind
iPtr = FindWindow(Nothing, sDefault)
If iPtr <> IntPtr.Zero Then
bNoWind = False
SetWindowText(iPtr, sCustom)
End If
End While
End Sub
)
thrWindow.Start()
End Sub
End Module
And in sub showing dialog:
...
ChangeWindowTitle("Browse For Folder", "My Folder Browser Title")
mainForm.folderDialog.ShowDialog()
...