Click here to Skip to main content
15,890,282 members
Home / Discussions / C#
   

C#

 
GeneralRe: Practice - Simple COM Interfaces Pin
Heath Stewart6-Jan-04 2:21
protectorHeath Stewart6-Jan-04 2:21 
GeneralRe: Practice - Simple COM Interfaces Pin
Tristan Rhodes6-Jan-04 2:32
Tristan Rhodes6-Jan-04 2:32 
GeneralRe: Practice - Simple COM Interfaces Pin
Tristan Rhodes6-Jan-04 3:01
Tristan Rhodes6-Jan-04 3:01 
Generalif files exist continue else exit Pin
Leon Radley5-Jan-04 11:03
Leon Radley5-Jan-04 11:03 
GeneralRe: if files exist continue else exit Pin
Nick Parker5-Jan-04 12:54
protectorNick Parker5-Jan-04 12:54 
GeneralRe: if files exist continue else exit Pin
Leon Radley5-Jan-04 19:30
Leon Radley5-Jan-04 19:30 
GeneralRe: if files exist continue else exit Pin
Nick Parker6-Jan-04 12:56
protectorNick Parker6-Jan-04 12:56 
GeneralRe: if files exist continue else exit Pin
Niels Penneman7-Jan-04 9:10
Niels Penneman7-Jan-04 9:10 
General.NET & MSN Messenger 6.1 Pin
Niels Penneman5-Jan-04 10:27
Niels Penneman5-Jan-04 10:27 
GeneralRe: .NET & MSN Messenger 6.1 Pin
eggie56-Jan-04 13:31
eggie56-Jan-04 13:31 
GeneralGDI Layers Pin
Heroz5-Jan-04 8:30
Heroz5-Jan-04 8:30 
GeneralRe: GDI Layers Pin
Heroz5-Jan-04 9:50
Heroz5-Jan-04 9:50 
GeneralRe: GDI Layers Pin
Heath Stewart5-Jan-04 9:57
protectorHeath Stewart5-Jan-04 9:57 
Questionstarting other apps? Pin
Peter Reiter5-Jan-04 6:54
Peter Reiter5-Jan-04 6:54 
AnswerRe: starting other apps? Pin
Guillermo Rivero5-Jan-04 7:07
Guillermo Rivero5-Jan-04 7:07 
AnswerRe: starting other apps? Pin
Heath Stewart5-Jan-04 7:15
protectorHeath Stewart5-Jan-04 7:15 
GeneralRe: starting other apps? Pin
Guillermo Rivero5-Jan-04 7:22
Guillermo Rivero5-Jan-04 7:22 
QuestionBest code for this multithreading issue? Pin
profoundwhispers5-Jan-04 6:32
profoundwhispers5-Jan-04 6:32 
AnswerRe: Best code for this multithreading issue? Pin
HAHAHA_NEXT5-Jan-04 7:22
HAHAHA_NEXT5-Jan-04 7:22 
AnswerRe: Best code for this multithreading issue? Pin
Heath Stewart5-Jan-04 7:28
protectorHeath Stewart5-Jan-04 7:28 
Generalcustom save/open file dialog Pin
misterbear5-Jan-04 6:31
misterbear5-Jan-04 6:31 
GeneralRe: custom save/open file dialog Pin
Heath Stewart5-Jan-04 7:13
protectorHeath Stewart5-Jan-04 7:13 
I've been discussing this with some other developers - including some Microsoft developers in the forums - and there isn't a way without going to a LOT of work. Basically, you have to encapsulate the functionality of the GetOpenFileName and GetSaveFileName functions, as well as the OPENFILENAME struct. This is what the OpenFileDialog and the SafeFileDialog (which inherit most of the functionality from the FileDialog class) do.

The biggest problem is dealing with the dialog template you'd assign to the lpTmeplateName member of the OPENFILENAME structure. In Win32 this isn't too hard because you can use resources (stored in the .rsrc section of a PE (portable executable)). To have this managed is definitely NOT easy! The engineers I even talked to do mentioned something along the lines of "not having time" to do this for 1.0 (which, since it's still not in 1.1 and doesn't appear to be in 2.0 means, "it's too hard").

If you want this managed, there are ways of making a DLGTEMPLATE out of a dialog resource (namely, your Form or Control that will physically extend the open and safe file dialogs), but you have to worry about converting units from pixels to dlg units and a lot more. There was an example I found on the 'net but I don't remember where. Just google for it if you dare try this. You'll need to P/Invoke all that code used in the exmample, as well as things like the GetDeviceCaps to get the proper unit measurements.

My recommendation is to write a native DLL that does this instead. You can then encapsulate your own custom open or save file dialogs in a Component like Microsoft does. Just make sure you distribute this native DLL with your application, putting it in a location that can be resolved (like the current working directory or any directory in the PATH environment variable). I don't have a sample because this alternative doesn't really work for my company because we use an Internet-deployed (ala touchless deployment) app and try to avoid native resources at all costs. I found a way around using a different approach.

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralRe: custom save/open file dialog Pin
misterbear5-Jan-04 8:43
misterbear5-Jan-04 8:43 
GeneralRe: custom save/open file dialog Pin
Heath Stewart5-Jan-04 9:52
protectorHeath Stewart5-Jan-04 9:52 
GeneralEasy Form Question Pin
Guinness4Strength5-Jan-04 6:19
Guinness4Strength5-Jan-04 6:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.