473,413 Members | 1,799 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,413 software developers and data experts.

Customize Common Dialog

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

Similar topics

1
by: smjmitchell | last post by:
Hi All, I am using the common dialog color pallete and open forms in VB6.0. I have two questions: 1. How can the position of these forms on the screen be specified when they are loaded. By...
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...
2
by: Robin | last post by:
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...
3
by: CaribSoft | last post by:
I want to create my own common dialog to use in an application . How do I show a custom dialog (form) in a class based on the common dialog class?
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...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.