By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,364 Members | 1,521 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,364 IT Pros & Developers. It's quick & easy.

adding a checkbox to common dialog

P: n/a
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.

Oct 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
If you are comforatable with using the API, you may be able to search for
the window that contains the text "open as read only", get its window
handle, and SendMessage to change the text. Otherwise, as far as I know, you
are stuck. Just an idea.
Mike

"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.

Oct 24 '05 #2

P: n/a
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.
:

Oct 27 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.