The control ID of the 'open as read-only' checkbox is &H410. Knowing this,
and applying a dialog hook, you can easily change the caption:
Create the demo at
http://vbnet.mvps.org/code/hooks/fil...avedlghook.htm
exactly as indicated, then once you've got it working and saved replace the
OFNWindowProc routine in that code with this one (watch for line wrapping).
(or alternatively, merge the code under the WM_INITDIALOG message into the
existing routine if you want to keep the centred dialog):
Public Function OFNHookProc(ByVal hwnd As Long, _
ByVal uMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Dim hwndParent As Long
Dim hwndCheckbox As Long
Select Case uMsg
Case WM_INITDIALOG
hwndparent = GetParent(hwnd)
hwndCheckbox = GetDlgItem(hwndparent, &H410)
Call SetWindowText(hwndCheckbox, ByVal "Check to Delete selected
files")
Case Else
End Select
End Function
You'll need to paste this into the bas file in order for this to work ...
Private Declare Function GetDlgItem Lib "user32" _
(ByVal hDlg As Long, _
ByVal nIDDlgItem As Long) As Long
--
Randy Birch
MS MVP Visual Basic
http://vbnet.mvps.org/
----------------------------------------------------------------------------
Read. Decide. Sign the petition to Microsoft.
http://classicvb.org/petition/
----------------------------------------------------------------------------
"Robin" <me@nowhere.com> wrote in message
news:b0********************************@4ax.com...
:I need to add a checkbox to the common dialog control for
: opening files.
: I know it is possible to customize the common dialog thru API.
: But the sample codes I have seen were too long and elaborate.
: One was for adding a preview pane for images to show thumbnails.
: All I want is a simple checkbox. Heck, I will settle for the built-in
: "open as read only" checkbox if I could just change its caption.
: