View previous topic :: View next topic |
Author |
Message |
rodneyjt
Joined: 02 Jun 2017 Posts: 3
|
Posted: Fri Jun 02, 2017 7:07 pm Post subject: Virtual Tree Not Recieving Windows Messages |
|
|
Hello,
We are using the Virtual Tree in a product that runs as an addon in other software. Specific Key strokes are not being received by the Tree when the tree is in a modeless dialog shown from the parent application. (Modal dialogs work fine.)
This is a known windows 'feature' as described here. There are methods to hook into the Windows Messages for controls and forms.
Do you have a fix or implementation of the Virtual Tree that overcomes this issue?
Thanks |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Sat Jun 03, 2017 12:18 am Post subject: |
|
|
I tried to replicate this issue by creating a modeless form (containing Virtual Tree) from within a class library DLL, which in turn was called by the main executable assembly. The problem was not evident. Does your AddIn architecture use unmanaged DLLs (rather than managed assemblies)? _________________ Infralution Support |
|
Back to top |
|
|
rodneyjt
Joined: 02 Jun 2017 Posts: 3
|
Posted: Sun Jun 04, 2017 2:10 am Post subject: |
|
|
The addin is all managed assemblies. But it's running from CAD applications in which this is a known issue from certain Windows applications the load addins through COM. We are using other controls which have the Windows hooks implemented in order to work properly. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Sun Jun 04, 2017 3:10 am Post subject: |
|
|
This issue would affect all controls within a modeless dialog launched from a DLL where that DLL is loaded via COM or unmanaged code. I think it would be better to apply the fix within your code where this situation arises rather than adding a hook to every virtual tree control when in 99.9% of the time it is not required. It would also be difficult for us to test any solution since we can't replicate it easily.
You can use the Infralution.Common.WindowsHook class to implement the hook in your dialog control _________________ Infralution Support |
|
Back to top |
|
|
rodneyjt
Joined: 02 Jun 2017 Posts: 3
|
Posted: Mon Jun 05, 2017 12:20 pm Post subject: |
|
|
Thank you for the information about the Infralution.Common.WindowsHook class. Do you have an example of how to implement this class. Should it be applied to the VirtualTree directly? |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Tue Jun 06, 2017 12:03 am Post subject: |
|
|
In your dialog class add a method to handle the hook invoke:
Code: | static void OnHookInvoked(object sender, WindowsHookEventArgs e)
{
} |
Then create and install the hook inside your dialog/form constructor:
Code: | hook = new WindowsHook(WindowsHookType.GetMessage);
hook.HookInvoked += new WindowsHookEventHandler(OnHookInvoked);
hook.Install();
|
You should also uninstall the hook in the dialog dispose method. _________________ Infralution Support |
|
Back to top |
|
|
|