S
SpotNet
Hello Newsgroup,
I have constructed a name space for the Windows Common Dialogs (Colour,
Font, Open, Save, and Browse). I have contracted these completely from the
ground up in the same fashion as the ones provided within the .NET Framework
2.0, difference being my custom ones far more flexible than the provided
..NET ones. I'll use the Colour Dialog delegate (Callback, HookProc) to
assist my question(s).
The two procedures HookProc and OwnerWndProc are invoked when\while the
dialog is 'called'. I can understand the mechanics of the HookProc, that is;
Declare the delegate,
private delegate IntPtr CCHookProc(IntPtr hWnd, Int32 iMsg, IntPtr wParam,
IntPtr lParam);
.....
Somewhere else appropriately placed, the choose colour type's lpfnHook
member is assigned as such.
this.lpccr.lpfnHook = new CCHookProc(this.HookProc);
Hence,
protected override IntPtr HookProc(IntPtr hWnd, Int32 iMsg, IntPtr wParam,
IntPtr lParam) {...}
gets called when the Dialog is initialising, initialised, interacted with,
destroyed, etc,....
The OwnerWndProc I'd like to know how this works, and how to properly call
it. I understand the definition of this procedure as stated in the
documentation.
1) Is OwnerWndProc a delegate as HookProc is? If so how does it get
assigned? Or,
2) OwnerWndProc being an owner windows procedure, gets called from within
HookProc, depending on the value of iMsg?
For example;
protected override IntPtr HookProc(IntPtr hWnd, Int32 iMsg, IntPtr wParam,
IntPtr lParam)
{
switch (iMsg)
{
...
case WM_COMMAND:
//This is where I see one puts this.
this.OwnerWndProc(hWnd, iMsg, wParam, lParam);
//OR, maybe dependent on the value of wParam, would this be
correct??
switch ((UInt32) wParam)
{
//Depending on the case, then
this.OwnerWndProc(hWnd, iMsg, wParam, lParam);
} //((UInt32) wParam)
break;
...
} //iMsg
return IntPtr.Zero; //For e.g. purposes
}//HookProc
3) None of the above, and it's something entirely different.
Thanks NewsGroup.
BTW, Windows XP SP2+, VS .N ET 2005 Pro, .NET 2.0.
Regards,
- SpotNet
I have constructed a name space for the Windows Common Dialogs (Colour,
Font, Open, Save, and Browse). I have contracted these completely from the
ground up in the same fashion as the ones provided within the .NET Framework
2.0, difference being my custom ones far more flexible than the provided
..NET ones. I'll use the Colour Dialog delegate (Callback, HookProc) to
assist my question(s).
The two procedures HookProc and OwnerWndProc are invoked when\while the
dialog is 'called'. I can understand the mechanics of the HookProc, that is;
Declare the delegate,
private delegate IntPtr CCHookProc(IntPtr hWnd, Int32 iMsg, IntPtr wParam,
IntPtr lParam);
.....
Somewhere else appropriately placed, the choose colour type's lpfnHook
member is assigned as such.
this.lpccr.lpfnHook = new CCHookProc(this.HookProc);
Hence,
protected override IntPtr HookProc(IntPtr hWnd, Int32 iMsg, IntPtr wParam,
IntPtr lParam) {...}
gets called when the Dialog is initialising, initialised, interacted with,
destroyed, etc,....
The OwnerWndProc I'd like to know how this works, and how to properly call
it. I understand the definition of this procedure as stated in the
documentation.
1) Is OwnerWndProc a delegate as HookProc is? If so how does it get
assigned? Or,
2) OwnerWndProc being an owner windows procedure, gets called from within
HookProc, depending on the value of iMsg?
For example;
protected override IntPtr HookProc(IntPtr hWnd, Int32 iMsg, IntPtr wParam,
IntPtr lParam)
{
switch (iMsg)
{
...
case WM_COMMAND:
//This is where I see one puts this.
this.OwnerWndProc(hWnd, iMsg, wParam, lParam);
//OR, maybe dependent on the value of wParam, would this be
correct??
switch ((UInt32) wParam)
{
//Depending on the case, then
this.OwnerWndProc(hWnd, iMsg, wParam, lParam);
} //((UInt32) wParam)
break;
...
} //iMsg
return IntPtr.Zero; //For e.g. purposes
}//HookProc
3) None of the above, and it's something entirely different.
Thanks NewsGroup.
BTW, Windows XP SP2+, VS .N ET 2005 Pro, .NET 2.0.
Regards,
- SpotNet