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

Customize Common Dialog

P: n/a
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 dialog but just need to
change the button text from "open" to "delete". Any ideas?

Thanks
Nov 16 '05 #1
Share this Question
Share on Google+
23 Replies


P: n/a
I guess you may inherit from FileDialog to create your "delete dialog" but I
think it's not recommended. So...changing your dialog box's title to
include "delete" seems to be the best option!

--
-----------------------------------------------------------------
Isaac Yuen
CEM
University of Alberta
iy***@ualberta.construction.ca
-----------------------------------------------------------------

| University of Alberta
| Phone: (780) 492-2276
| Fax: (780) 492-0249
"George" <ge****@yahoo.com> wrote in message
news:O1*************@tk2msftngp13.phx.gbl...
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 dialog but just need to
change the button text from "open" to "delete". Any ideas?

Thanks

Nov 16 '05 #2

P: n/a
To extend Common dialog with additional option buttons, command buttons, and
check boxes, combo boxes calender, or preview options etc etc....follow
these steps

1. Create a dialog (or Form) seperately.
2. Align all the controls you want in the dialog to be displayed while
OpenFileDialog is displayed
3. Now attach this dialog at the bottom of the common dialog.

At runtime, you will feel that its part of common dialog. Same way you can
hide some of the buttons of Common dialog like "Open" for example, and keep
your button called "delete" there. Your form will overlap those controls.

Hope you understood it.

Shak.

"George" <ge****@yahoo.com> wrote in message
news:O1*************@tk2msftngp13.phx.gbl...
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 dialog but just need to
change the button text from "open" to "delete". Any ideas?

Thanks

Nov 16 '05 #3

P: n/a
This step intrigues me:

'3. Now attach this dialog at the bottom of the common dialog.'

What incantations need to be performed to do this?

"Shakir Hussain" <sh**@fakedomain.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
To extend Common dialog with additional option buttons, command buttons,
and
check boxes, combo boxes calender, or preview options etc etc....follow
these steps

1. Create a dialog (or Form) seperately.
2. Align all the controls you want in the dialog to be displayed while
OpenFileDialog is displayed
3. Now attach this dialog at the bottom of the common dialog.

At runtime, you will feel that its part of common dialog. Same way you can
hide some of the buttons of Common dialog like "Open" for example, and
keep
your button called "delete" there. Your form will overlap those controls.

Hope you understood it.

Shak.

"George" <ge****@yahoo.com> wrote in message
news:O1*************@tk2msftngp13.phx.gbl...
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 dialog but just need to
change the button text from "open" to "delete". Any ideas?

Thanks


Nov 16 '05 #4

P: n/a
overlapping buttons? not sure about that one either.

"Steve Austin" <st**********@capecanaveral.com> wrote in message
news:Et********************@giganews.com...
This step intrigues me:

'3. Now attach this dialog at the bottom of the common dialog.'

What incantations need to be performed to do this?

"Shakir Hussain" <sh**@fakedomain.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
To extend Common dialog with additional option buttons, command buttons,
and
check boxes, combo boxes calender, or preview options etc etc....follow
these steps

1. Create a dialog (or Form) seperately.
2. Align all the controls you want in the dialog to be displayed while
OpenFileDialog is displayed
3. Now attach this dialog at the bottom of the common dialog.

At runtime, you will feel that its part of common dialog. Same way you can hide some of the buttons of Common dialog like "Open" for example, and
keep
your button called "delete" there. Your form will overlap those controls.
Hope you understood it.

Shak.

"George" <ge****@yahoo.com> wrote in message
news:O1*************@tk2msftngp13.phx.gbl...
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 dialog but just need to
change the button text from "open" to "delete". Any ideas?

Thanks



Nov 16 '05 #5

P: n/a
George,

don't customize a open file dialog to do something that doesn't involve
opening a dialog... Deleting a file still involves files though, so why not
do what the Open and Save dialog's do? Inherit from a dialog that deals with
files generally.

Create a new class, and inherit from the FileDialog class, then you can have
another class called "DeleteFileDialog".

If you need more help let me know.

Good luck!

Dan.

"George" <ge****@yahoo.com> wrote in message
news:O1*************@tk2msftngp13.phx.gbl...
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 dialog but just need to
change the button text from "open" to "delete". Any ideas?

Thanks

Nov 16 '05 #6

P: n/a
Attach your dialog id to member of open file dialog.

m_ofn.lp_TemplateName = MAKEINTRESOURCE(ID_MYDIALOG)

m_ofn is the member of OpenFileDialog. After attaching it, you can position
whereever you want, like bottom, or side etc. To make it look nice you can
add a button saying "More details". On click of that, you can show the
custom dialog.

Shak.

"Steve Austin" <st**********@capecanaveral.com> wrote in message
news:Et********************@giganews.com...
This step intrigues me:

'3. Now attach this dialog at the bottom of the common dialog.'

What incantations need to be performed to do this?

"Shakir Hussain" <sh**@fakedomain.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
To extend Common dialog with additional option buttons, command buttons,
and
check boxes, combo boxes calender, or preview options etc etc....follow
these steps

1. Create a dialog (or Form) seperately.
2. Align all the controls you want in the dialog to be displayed while
OpenFileDialog is displayed
3. Now attach this dialog at the bottom of the common dialog.

At runtime, you will feel that its part of common dialog. Same way you can hide some of the buttons of Common dialog like "Open" for example, and
keep
your button called "delete" there. Your form will overlap those controls.
Hope you understood it.

Shak.

"George" <ge****@yahoo.com> wrote in message
news:O1*************@tk2msftngp13.phx.gbl...
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 dialog but just need to
change the button text from "open" to "delete". Any ideas?

Thanks



Nov 16 '05 #7

P: n/a
Hmm, reading the documentation in the MSDN, this isn't the way to go about
it either...

Doh!

"Daniel Bass" <DanielBass TAKE at OUT CAPS WORDS Postmaster.co.uk> wrote in
message news:Ok**************@TK2MSFTNGP12.phx.gbl...
George,

don't customize a open file dialog to do something that doesn't involve
opening a dialog... Deleting a file still involves files though, so why not do what the Open and Save dialog's do? Inherit from a dialog that deals with files generally.

Create a new class, and inherit from the FileDialog class, then you can have another class called "DeleteFileDialog".

If you need more help let me know.

Good luck!

Dan.

"George" <ge****@yahoo.com> wrote in message
news:O1*************@tk2msftngp13.phx.gbl...
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 dialog but just need to
change the button text from "open" to "delete". Any ideas?

Thanks


Nov 16 '05 #8

P: n/a
Looking at all the replies, I am confused. What should I do?

Thanks

"Daniel Bass" <DanielBass TAKE at OUT CAPS WORDS Postmaster.co.uk> wrote in
message news:ON**************@TK2MSFTNGP12.phx.gbl...
Hmm, reading the documentation in the MSDN, this isn't the way to go about
it either...

Doh!

"Daniel Bass" <DanielBass TAKE at OUT CAPS WORDS Postmaster.co.uk> wrote in message news:Ok**************@TK2MSFTNGP12.phx.gbl...
George,

don't customize a open file dialog to do something that doesn't involve
opening a dialog... Deleting a file still involves files though, so why

not
do what the Open and Save dialog's do? Inherit from a dialog that deals

with
files generally.

Create a new class, and inherit from the FileDialog class, then you can

have
another class called "DeleteFileDialog".

If you need more help let me know.

Good luck!

Dan.

"George" <ge****@yahoo.com> wrote in message
news:O1*************@tk2msftngp13.phx.gbl...
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 dialog but just need to
change the button text from "open" to "delete". Any ideas?

Thanks



Nov 16 '05 #9

P: n/a
Looking at all the replies, I am confused. What should I do?

Thanks

"Daniel Bass" <DanielBass TAKE at OUT CAPS WORDS Postmaster.co.uk> wrote in
message news:ON**************@TK2MSFTNGP12.phx.gbl...
Hmm, reading the documentation in the MSDN, this isn't the way to go about
it either...

Doh!

"Daniel Bass" <DanielBass TAKE at OUT CAPS WORDS Postmaster.co.uk> wrote in message news:Ok**************@TK2MSFTNGP12.phx.gbl...
George,

don't customize a open file dialog to do something that doesn't involve
opening a dialog... Deleting a file still involves files though, so why

not
do what the Open and Save dialog's do? Inherit from a dialog that deals

with
files generally.

Create a new class, and inherit from the FileDialog class, then you can

have
another class called "DeleteFileDialog".

If you need more help let me know.

Good luck!

Dan.

"George" <ge****@yahoo.com> wrote in message
news:O1*************@tk2msftngp13.phx.gbl...
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 dialog but just need to
change the button text from "open" to "delete". Any ideas?

Thanks



Nov 16 '05 #10

P: n/a
I'm assuming George was asking how this could be achieved in C# (Windows
Forms?), the method you're describing is only applicable if you're using
C++.

"Shakir Hussain" <sh**@fakedomain.com> wrote in message
news:uL*************@tk2msftngp13.phx.gbl...
Attach your dialog id to member of open file dialog.

m_ofn.lp_TemplateName = MAKEINTRESOURCE(ID_MYDIALOG)

m_ofn is the member of OpenFileDialog. After attaching it, you can
position
whereever you want, like bottom, or side etc. To make it look nice you can
add a button saying "More details". On click of that, you can show the
custom dialog.

Shak.

"Steve Austin" <st**********@capecanaveral.com> wrote in message
news:Et********************@giganews.com...
This step intrigues me:

'3. Now attach this dialog at the bottom of the common dialog.'

What incantations need to be performed to do this?

"Shakir Hussain" <sh**@fakedomain.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
> To extend Common dialog with additional option buttons, command
> buttons,
> and
> check boxes, combo boxes calender, or preview options etc etc....follow
> these steps
>
> 1. Create a dialog (or Form) seperately.
> 2. Align all the controls you want in the dialog to be displayed while
> OpenFileDialog is displayed
> 3. Now attach this dialog at the bottom of the common dialog.
>
> At runtime, you will feel that its part of common dialog. Same way you can > hide some of the buttons of Common dialog like "Open" for example, and
> keep
> your button called "delete" there. Your form will overlap those controls. >
> Hope you understood it.
>
> Shak.
>
>
>
> "George" <ge****@yahoo.com> wrote in message
> news:O1*************@tk2msftngp13.phx.gbl...
>> 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 dialog but just need to
>> change the button text from "open" to "delete". Any ideas?
>>
>> Thanks
>>
>>
>
>



Nov 16 '05 #11

P: n/a
I'm assuming George was asking how this could be achieved in C# (Windows
Forms?), the method you're describing is only applicable if you're using
C++.

"Shakir Hussain" <sh**@fakedomain.com> wrote in message
news:uL*************@tk2msftngp13.phx.gbl...
Attach your dialog id to member of open file dialog.

m_ofn.lp_TemplateName = MAKEINTRESOURCE(ID_MYDIALOG)

m_ofn is the member of OpenFileDialog. After attaching it, you can
position
whereever you want, like bottom, or side etc. To make it look nice you can
add a button saying "More details". On click of that, you can show the
custom dialog.

Shak.

"Steve Austin" <st**********@capecanaveral.com> wrote in message
news:Et********************@giganews.com...
This step intrigues me:

'3. Now attach this dialog at the bottom of the common dialog.'

What incantations need to be performed to do this?

"Shakir Hussain" <sh**@fakedomain.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
> To extend Common dialog with additional option buttons, command
> buttons,
> and
> check boxes, combo boxes calender, or preview options etc etc....follow
> these steps
>
> 1. Create a dialog (or Form) seperately.
> 2. Align all the controls you want in the dialog to be displayed while
> OpenFileDialog is displayed
> 3. Now attach this dialog at the bottom of the common dialog.
>
> At runtime, you will feel that its part of common dialog. Same way you can > hide some of the buttons of Common dialog like "Open" for example, and
> keep
> your button called "delete" there. Your form will overlap those controls. >
> Hope you understood it.
>
> Shak.
>
>
>
> "George" <ge****@yahoo.com> wrote in message
> news:O1*************@tk2msftngp13.phx.gbl...
>> 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 dialog but just need to
>> change the button text from "open" to "delete". Any ideas?
>>
>> Thanks
>>
>>
>
>



Nov 16 '05 #12

P: n/a
George,

back to your question... no, there is no way to change the text on the
button to say delete.

Shakir's example of extended dialogs etc, wouldn't really benefit you as
you're not looking to add functionality, but rather make a simple cosmetic
change.

Apparently you cannot inherit from either OpenFileDialog, or FileDialog, but
you can from CommonDialog... This won't help you much as you really want the
file browser and folder tree view.

I've never heard of a situation where you'd need to delete files via a file
browser type dialog. What are you using this for? Perhaps there's another
way around the problem.

Dan.

"George" <ge****@yahoo.com> wrote in message
news:O1*************@tk2msftngp13.phx.gbl...
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 dialog but just need to
change the button text from "open" to "delete". Any ideas?

Thanks

Nov 16 '05 #13

P: n/a
George,

back to your question... no, there is no way to change the text on the
button to say delete.

Shakir's example of extended dialogs etc, wouldn't really benefit you as
you're not looking to add functionality, but rather make a simple cosmetic
change.

Apparently you cannot inherit from either OpenFileDialog, or FileDialog, but
you can from CommonDialog... This won't help you much as you really want the
file browser and folder tree view.

I've never heard of a situation where you'd need to delete files via a file
browser type dialog. What are you using this for? Perhaps there's another
way around the problem.

Dan.

"George" <ge****@yahoo.com> wrote in message
news:O1*************@tk2msftngp13.phx.gbl...
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 dialog but just need to
change the button text from "open" to "delete". Any ideas?

Thanks

Nov 16 '05 #14

P: n/a
Daniel,

I need a file dialog because the user needs to have the ability to search
for certain files and delete them. Back in the day, I used VB6 and created
my own form with file controls. Now, I am merging this program and a new
program into one application and I need recreate this. A work around for
this is to just use a save file dialog and delete the files selected.

Thanks

"Daniel Bass" <DanielBass TAKE at OUT CAPS WORDS Postmaster.co.uk> wrote in
message news:%2****************@TK2MSFTNGP11.phx.gbl...
George,

back to your question... no, there is no way to change the text on the
button to say delete.

Shakir's example of extended dialogs etc, wouldn't really benefit you as
you're not looking to add functionality, but rather make a simple cosmetic
change.

Apparently you cannot inherit from either OpenFileDialog, or FileDialog, but you can from CommonDialog... This won't help you much as you really want the file browser and folder tree view.

I've never heard of a situation where you'd need to delete files via a file browser type dialog. What are you using this for? Perhaps there's another
way around the problem.

Dan.

"George" <ge****@yahoo.com> wrote in message
news:O1*************@tk2msftngp13.phx.gbl...
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 dialog but just need to
change the button text from "open" to "delete". Any ideas?

Thanks


Nov 16 '05 #15

P: n/a
Could you perhaps post a pic, or a link to a pic of this form you created in
VB6? I might be able to come up with some ideas if I could see it.

"George" <ge****@yahoo.com> wrote in message
news:ec**************@TK2MSFTNGP12.phx.gbl...
Daniel,

I need a file dialog because the user needs to have the ability to search
for certain files and delete them. Back in the day, I used VB6 and
created
my own form with file controls. Now, I am merging this program and a new
program into one application and I need recreate this. A work around for
this is to just use a save file dialog and delete the files selected.

Thanks

"Daniel Bass" <DanielBass TAKE at OUT CAPS WORDS Postmaster.co.uk> wrote
in
message news:%2****************@TK2MSFTNGP11.phx.gbl...
George,

back to your question... no, there is no way to change the text on the
button to say delete.

Shakir's example of extended dialogs etc, wouldn't really benefit you as
you're not looking to add functionality, but rather make a simple
cosmetic
change.

Apparently you cannot inherit from either OpenFileDialog, or FileDialog,

but
you can from CommonDialog... This won't help you much as you really want

the
file browser and folder tree view.

I've never heard of a situation where you'd need to delete files via a

file
browser type dialog. What are you using this for? Perhaps there's another
way around the problem.

Dan.

"George" <ge****@yahoo.com> wrote in message
news:O1*************@tk2msftngp13.phx.gbl...
> 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 dialog but just need to
> change the button text from "open" to "delete". Any ideas?
>
> Thanks
>
>



Nov 16 '05 #16

P: n/a
Basically, the form mimics a common file dialog.

Thanks

"Steve Austin" <st**********@capecanaveral.com> wrote in message
news:k9********************@giganews.com...
Could you perhaps post a pic, or a link to a pic of this form you created in VB6? I might be able to come up with some ideas if I could see it.

"George" <ge****@yahoo.com> wrote in message
news:ec**************@TK2MSFTNGP12.phx.gbl...
Daniel,

I need a file dialog because the user needs to have the ability to search for certain files and delete them. Back in the day, I used VB6 and
created
my own form with file controls. Now, I am merging this program and a new program into one application and I need recreate this. A work around for this is to just use a save file dialog and delete the files selected.

Thanks

"Daniel Bass" <DanielBass TAKE at OUT CAPS WORDS Postmaster.co.uk> wrote
in
message news:%2****************@TK2MSFTNGP11.phx.gbl...
George,

back to your question... no, there is no way to change the text on the
button to say delete.

Shakir's example of extended dialogs etc, wouldn't really benefit you as you're not looking to add functionality, but rather make a simple
cosmetic
change.

Apparently you cannot inherit from either OpenFileDialog, or FileDialog,
but
you can from CommonDialog... This won't help you much as you really
want the
file browser and folder tree view.

I've never heard of a situation where you'd need to delete files via a

file
browser type dialog. What are you using this for? Perhaps there's

another way around the problem.

Dan.

"George" <ge****@yahoo.com> wrote in message
news:O1*************@tk2msftngp13.phx.gbl...
> 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 dialog but just need to > change the button text from "open" to "delete". Any ideas?
>
> Thanks
>
>



Nov 16 '05 #17

P: n/a
There are a plethora of controls on codeproject which you could probably
cobble together to provide the functionality you desire :-)

"George" <ge****@yahoo.com> wrote in message
news:OC**************@tk2msftngp13.phx.gbl...
Basically, the form mimics a common file dialog.

Thanks

"Steve Austin" <st**********@capecanaveral.com> wrote in message
news:k9********************@giganews.com...
Could you perhaps post a pic, or a link to a pic of this form you created

in
VB6? I might be able to come up with some ideas if I could see it.

"George" <ge****@yahoo.com> wrote in message
news:ec**************@TK2MSFTNGP12.phx.gbl...
> Daniel,
>
> I need a file dialog because the user needs to have the ability to search > for certain files and delete them. Back in the day, I used VB6 and
> created
> my own form with file controls. Now, I am merging this program and a new > program into one application and I need recreate this. A work around for > this is to just use a save file dialog and delete the files selected.
>
> Thanks
>
> "Daniel Bass" <DanielBass TAKE at OUT CAPS WORDS Postmaster.co.uk>
> wrote
> in
> message news:%2****************@TK2MSFTNGP11.phx.gbl...
>> George,
>>
>> back to your question... no, there is no way to change the text on
>> the
>> button to say delete.
>>
>> Shakir's example of extended dialogs etc, wouldn't really benefit you as >> you're not looking to add functionality, but rather make a simple
>> cosmetic
>> change.
>>
>> Apparently you cannot inherit from either OpenFileDialog, or FileDialog, > but
>> you can from CommonDialog... This won't help you much as you really want > the
>> file browser and folder tree view.
>>
>> I've never heard of a situation where you'd need to delete files via a
> file
>> browser type dialog. What are you using this for? Perhaps there's another >> way around the problem.
>>
>> Dan.
>>
>> "George" <ge****@yahoo.com> wrote in message
>> news:O1*************@tk2msftngp13.phx.gbl...
>> > 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 dialog but just need to >> > change the button text from "open" to "delete". Any ideas?
>> >
>> > Thanks
>> >
>> >
>>
>>
>
>



Nov 16 '05 #18

P: n/a
I have once create such a dialog for a simply paint program which basically
calls the Windows API function GetSaveFileName() and adds a hook procedure
to it which intercepts certain windows messages and this way, allows me to
change the text of the "Help"-button to options and makes it possible to run
custom actions when the user changes the index of the filetypes combo.

Here is the class:
public class NuffSaveFileDialog
{
[StructLayoutAttribute(LayoutKind.Sequential, Pack=1, Size=0,
CharSet=CharSet.Auto)]
struct OFN
{
public int lStructSize;
public IntPtr hwndOwner;
public IntPtr hInstance;
public string lpstrFilter;
public IntPtr lpstrCustomFilter;
public int nMaxCustFilter;
public int nFilterIndex;
public /*IntPtr*/string lpstrFile;
public int nMaxFile;
public IntPtr lpstrFileTitle;
public int nMaxFileTitle;
public string lpstrInitialDir;
public string lpstrTitle;
public int Flags;
public short nFileOffset;
public short nFileExtension;
public string lpstrDefExt;
public IntPtr lCustData;
public /*WndProc*//*IntPtr*/OFNHookProcOldStyle lpfnHook;
public string lpTemplateName;
public IntPtr pvReserved;
public int dwReserved;
public int FlagsEx;
}
const int OFN_READONLY = 0x00000001;
const int OFN_OVERWRITEPROMPT = 0x00000002;
const int OFN_HIDEREADONLY = 0x00000004;
const int OFN_NOCHANGEDIR = 0x00000008;
const int OFN_SHOWHELP = 0x00000010;
const int OFN_ENABLEHOOK = 0x00000020;
const int OFN_ENABLETEMPLATE = 0x00000040;
const int OFN_ENABLETEMPLATEHANDLE = 0x00000080;
const int OFN_NOVALIDATE = 0x00000100;
const int OFN_ALLOWMULTISELECT = 0x00000200;
const int OFN_EXTENSIONDIFFERENT = 0x00000400;
const int OFN_PATHMUSTEXIST = 0x00000800;
const int OFN_FILEMUSTEXIST = 0x00001000;
const int OFN_CREATEPROMPT = 0x00002000;
const int OFN_SHAREAWARE = 0x00004000;
const int OFN_NOREADONLYRETURN = 0x00008000;
const int OFN_NOTESTFILECREATE = 0x00010000;
const int OFN_NONETWORKBUTTON = 0x00020000;
const int OFN_NOLONGNAMES = 0x00040000; // force no long names for 4.x
modules;
const int OFN_EXPLORER = 0x00080000; // new look commdlg;
const int OFN_NODEREFERENCELINKS = 0x00100000;
const int OFN_LONGNAMES = 0x00200000; // force long names for 3.x modules;
const int OFN_ENABLEINCLUDENOTIFY = 0x00400000; // send include message to
callback;
const int OFN_ENABLESIZING = 0x00800000;
const int OFN_DONTADDTORECENT = 0x02000000;
const int OFN_FORCESHOWHIDDEN = 0x10000000; // Show All files including
System and hidden files;
//FlagsEx Values;
const int OFN_EX_NOPLACESBAR = 0x00000001;
[System.Runtime.InteropServices.DllImport("Comdlg32 .dll",
EntryPoint="GetSaveFileNameW")]
//[System.Runtime.InteropServices.DllImport("msvfw32. dll",
EntryPoint="GetSaveFileNamePreviewW")]
unsafe extern static int GetSaveFileName(ref OFN ofn);
[System.Runtime.InteropServices.DllImport("Kernel32 ")]
extern static int GetLastError();
[System.Runtime.InteropServices.DllImport("User32")]
extern static int SetDlgItemText(
IntPtr hDlg,
int nIDDlgItem,
string lpString
);
[System.Runtime.InteropServices.DllImport("User32")]
extern static int GetDlgItemText(
IntPtr hDlg,
int nIDDlgItem,
StringBuilder lpString,
int nMaxCount
);

[System.Runtime.InteropServices.DllImport("User32")]
extern static IntPtr GetParent(
IntPtr hWnd
);
delegate uint OFNHookProcOldStyle
(
IntPtr hdlg,
uint uiMsg,
int wParam,
int lParam
);
const int WM_INITDIALOG = 0x0110;
const int WM_NOTIFY = 0x004E;
const uint CDN_FIRST = unchecked(0u-601u);
const uint CDN_HELP = (CDN_FIRST - 0x0004);
[StructLayoutAttribute(LayoutKind.Sequential, Pack=1, Size=0,
CharSet=CharSet.Auto)]
struct NMHDR
{
public IntPtr hwndFrom;
public uint idFrom;
public uint code; // NM_ code
}
unsafe static uint OfnHook(
IntPtr hdlg,
uint uiMsg,
int wParam,
int lParam
)
{
Console.WriteLine(uiMsg+" "+wParam+" "+lParam);
// nowhere documented but seems to work
if (uiMsg==49313 && wParam==1136)
{
const int FileTitleCntrlID = 0x47c;
CurrentDialog.FilterIndex = lParam;
NuffImageEncoder nie =
(NuffImageEncoder)NuffImageEncoder.EncoderInfoList[CurrentDialog.FilterIndex
];
StringBuilder sb = new StringBuilder(255);
GetDlgItemText(GetParent(hdlg), FileTitleCntrlID, sb, 255);
string s = Path.ChangeExtension(sb.ToString(), nie.DefaultExtension);
SetDlgItemText(GetParent(hdlg), FileTitleCntrlID, s);
}
switch (uiMsg)
{
case WM_INITDIALOG:
SetDlgItemText(GetParent(hdlg), 0x40e, "Options");
break;
case WM_NOTIFY:
NMHDR nmhdr = (NMHDR)Marshal.PtrToStructure(new IntPtr(lParam),
typeof(NMHDR));
if (nmhdr.code==CDN_HELP)
{
NuffImageEncoder nie =
(NuffImageEncoder)NuffImageEncoder.EncoderInfoList[CurrentDialog.FilterIndex
];
nie.RunSettingsDialog();
}
break;
}
return 0;
}
public NuffSaveFileDialog()
{
}
static NuffSaveFileDialog CurrentDialog;
public int FilterIndex;
string fileName;
string filter;
OFN ofn;
public string Filter
{
get
{
return this.filter;
}
set
{
this.filter=value;
}
}
public string FileName
{
get
{
return this.fileName;
}
}
public unsafe DialogResult ShowDialog()
{
ofn = new OFN();
ofn.hInstance = Marshal.GetHINSTANCE(typeof(MainWindow).Module);
ofn.lStructSize = Marshal.SizeOf(typeof(OFN));
//ofn.hwndOwner = form.Handle;
ofn.lpstrFilter = filter;
ofn.lpfnHook = new OFNHookProcOldStyle(OfnHook);
ofn.Flags |=
OFN_EXPLORER|OFN_ENABLEHOOK|OFN_EXTENSIONDIFFERENT |OFN_SHOWHELP|OFN_OVERWRIT
EPROMPT|OFN_ENABLESIZING;
const int MaxFile = 8192;
NuffImageEncoder nie =
(NuffImageEncoder)NuffImageEncoder.EncoderInfoList[0];
string Unnamed = "Unnamed."+nie.DefaultExtension;
ofn.nMaxFileTitle = 260;
ofn.nMaxFile = MaxFile;
ofn.lpstrFile = Unnamed+new string(new char[MaxFile-Unnamed.Length-1]);
CurrentDialog = this;
int res = GetSaveFileName(ref ofn);
if (res!=0)
{
this.fileName = ofn.lpstrFile;
return DialogResult.OK;
}
else
{
return DialogResult.Cancel;
}
}
}

//-------- end code -------------------------------------//

you simply call it like:

NuffSaveFileDialog dlg = new NuffSaveFileDialog();
dlg.ShowDialog();
--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
Nov 16 '05 #19

P: n/a
You can try our Dialog Workshop .NET product. "Dock" your own WinForm
to the bottom, right, left or top of the common dialog.
You can extend both Open/Save as well as Print, Font, etc. dialogs.

Please visit our homepage for details about this product:
http://www.componentage.com

Serg

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 dialog but just need to
change the button text from "open" to "delete". Any ideas?

Thanks

Nov 16 '05 #20

P: n/a
> Are you still looking for a solution?
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 dialog but just need to
change the button text from "open" to "delete". Any ideas?


Do you have one?

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
Nov 16 '05 #21

P: n/a
Yes

"Steve" <St***@discussions.microsoft.com> wrote in message
news:7C**********************************@microsof t.com...
Are you still looking for a solution?
BTW, your Ge****@yahoo.com bounced back.

"George" wrote:
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 dialog but just need to
change the button text from "open" to "delete". Any ideas?

Thanks

Nov 16 '05 #22

P: n/a
Do you? If so, can you share?

"cody" <pl*************************@gmx.de> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Are you still looking for a solution?
> 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 dialog but just need to
> change the button text from "open" to "delete". Any ideas?


Do you have one?

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk

Nov 16 '05 #23

P: n/a
> >> Are you still looking for a solution?

> 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 dialog but just need

to > change the button text from "open" to "delete". Any ideas?


Do you have one?


Do you? If so, can you share?


I have no real solution but I workaround which I already posted in this
thread. But I would be glad if somebody would have a real solution for this.

--
cody

Freeware Tools, Games and Humour
http://www.deutronium.de.vu || http://www.deutronium.tk
Nov 16 '05 #24

This discussion thread is closed

Replies have been disabled for this discussion.