473,387 Members | 1,903 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

adding a checkbox to common dialog

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
2 6669
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: S.W. Rasmussen | last post by:
With the risk of being accused of multi-posting I would like to draw the attention to a serious visual basic/windows issue discussed in the microsoft.public.vb.bugs newsgroup. As pointed out below...
23
by: George | last post by:
Is there a way to customize the open file common dialog? I am trying to modify the button text so I can create a delete file common dialog. I need the same functionality of the open file common...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
2
by: Bob Hollness | last post by:
Hi group. I am a newbie to ASP.NET as you will see from some of the questions I may ask! I have a datagrid which I have populated from a database. It works great! I have added a column, via...
3
by: Ankit Aneja | last post by:
I have a strange situation and I have no idea how to solve this. Its a Recruitment Search Page,in the Admin Page, for every button click event the Admin Person has to create a checkbox on the users...
1
by: sianan | last post by:
I tried to use the following example, to add a checkbox column to a DataGrid in an ASP.NET application: http://www.codeproject.com/aspnet/datagridcheckbox.asp For some reason, I simply CAN'T get...
0
by: Bo Gusman | last post by:
A curious problem, one that I think I've seen before. I have a .250 MLOC vb6 app that uses the common dialog control. If I select File/Open in my app to display the file open dialog and then...
6
by: Steve Barnett | last post by:
I need to include a wizard in my application that will, as one of the steps, ask the user to select a file to open and (later) a file to save it as. The naff way to do this would be to have a...
4
by: mamun | last post by:
Hi All, I have the following situation and am looking for answer in C#. I have a datagrid and putting checkbox next to each record. In the header I have a Delete button. I want users to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.