Click here to Skip to main content
16,007,277 members
Home / Discussions / C#
   

C#

 
GeneralRe: accessing properties of the mdiParent from the child Pin
kowplunk8-Feb-05 3:22
kowplunk8-Feb-05 3:22 
GeneralRe: accessing properties of the mdiParent from the child Pin
Skynyrd8-Feb-05 11:56
Skynyrd8-Feb-05 11:56 
GeneralDataGrid Cell being edited Pin
Keith La Force6-Feb-05 9:55
Keith La Force6-Feb-05 9:55 
GeneralRe: DataGrid Cell being edited Pin
Christian Graus6-Feb-05 14:40
protectorChristian Graus6-Feb-05 14:40 
GeneralRe: DataGrid Cell being edited Pin
Luis Alonso Ramos6-Feb-05 17:55
Luis Alonso Ramos6-Feb-05 17:55 
GeneralRe: DataGrid Cell being edited Pin
Keith La Force7-Feb-05 1:16
Keith La Force7-Feb-05 1:16 
GeneralGetOpenFileName in C# Pin
Formato6-Feb-05 9:01
Formato6-Feb-05 9:01 
GeneralRe: GetOpenFileName in C# Pin
Heath Stewart7-Feb-05 6:15
protectorHeath Stewart7-Feb-05 6:15 
Instead of using P/Invoke, you might read the documentation[^] for the OpenFileDialog component that encapsulates that API and struct. The same is true for the SaveFileDialog.

In .NET, you can set the fnHook to a delegate but you must declare the struct field as a delegate that matches the necessary signature:
struct OPENFILENAME
{
  // ...
  public OfnHookProc lpfnHook;
  // ...
}
[return: MarshalAs(UnmanagedType.SysUInt)]
delegate IntPtr OfnHookProc(IntPtr hdlg,
  [MarshalAs(UnmanagedType.U4)] int uiMsg, IntPtr wParam, IntPtr lParam);
If you don't actually need to use a hook proc to handle your own dialog you don't need ot set this.

For the template name, it's quite a bit harder. The easiest way is to create a native DLL with the resource template - if you even need one, which is merely to extend the dialog itself, which is another reason for using a hook proc - and set the hInstance field to an IntPtr for the native DLL, which you can get using LoadLibrary or LoadLibraryEx. Set the lpTemplateName field to the name of the resource in that native DLL.

Again, though - unless you actually have to extend the UI for the default Open or Save file dialogs, just use the OpenFileDialog and SaveFileDialog components. That's why they're there and don't require your assembly to be granted a privilege to call unmanaged code.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralEvents and delegates: help! Pin
Gleb Belov6-Feb-05 4:55
Gleb Belov6-Feb-05 4:55 
GeneralRe: Events and delegates: help! Pin
mav.northwind6-Feb-05 5:12
mav.northwind6-Feb-05 5:12 
GeneralRe: Events and delegates: help! Pin
Gleb Belov6-Feb-05 5:37
Gleb Belov6-Feb-05 5:37 
GeneralRe: Events and delegates: help! Pin
Skynyrd6-Feb-05 6:17
Skynyrd6-Feb-05 6:17 
GeneralEventHandler question! Pin
QzRz6-Feb-05 1:50
QzRz6-Feb-05 1:50 
GeneralRe: EventHandler question! Pin
mav.northwind6-Feb-05 3:11
mav.northwind6-Feb-05 3:11 
GeneralRe: EventHandler question! Pin
Heath Stewart6-Feb-05 7:24
protectorHeath Stewart6-Feb-05 7:24 
Generalcreate a Byte[] array Pin
Sasuko6-Feb-05 0:19
Sasuko6-Feb-05 0:19 
GeneralRe: create a Byte[] array Pin
Robert Rohde6-Feb-05 0:56
Robert Rohde6-Feb-05 0:56 
GeneralRe: create a Byte[] array Pin
Sasuko6-Feb-05 1:27
Sasuko6-Feb-05 1:27 
Generalremote user name Pin
Opa Knack6-Feb-05 0:12
Opa Knack6-Feb-05 0:12 
GeneralRe: remote user name Pin
Heath Stewart6-Feb-05 7:21
protectorHeath Stewart6-Feb-05 7:21 
QuestionCreating MMC snap-in? Pin
esjq5-Feb-05 23:33
esjq5-Feb-05 23:33 
AnswerRe: Creating MMC snap-in? Pin
Heath Stewart6-Feb-05 7:18
protectorHeath Stewart6-Feb-05 7:18 
GeneralRe: Creating MMC snap-in? Pin
esjq6-Feb-05 20:53
esjq6-Feb-05 20:53 
Generalupdate doesn't update database Pin
xrado5-Feb-05 23:14
xrado5-Feb-05 23:14 
GeneralRe: update doesn't update database Pin
Heath Stewart6-Feb-05 7:10
protectorHeath Stewart6-Feb-05 7:10 

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.