locked
WPF Hosting Winforms App - NoTextInput RRS feed

  • Question

  • I currently developing a WPF app that launches a WinForm dll in a separate app domain.

    When  I launch the WinForms app I can no longer type in any of the WPF textboxes.  I do infact see KeyDowns in the WPF side but no TextInput.  When I "pause" the WinForms App keyboard input works as expected.

    I'm seeing a similar problem as noted in the following links but my situation is backwards (WPF Window is created first and WinForms app second) and I can't determine where I can hook in to the event handler to get the textinput messages and get them to WPF.

    http://forums.msdn.microsoft.com/en-US/wpf/thread/cfd20c98-a809-481c-8f68-34e473c182fa/
    http://devonethatdevelops.wordpress.com/2007/10/30/wpf-win32-interop-with-hwndsource/

    I tried the suggestions noted above without success but I could just be missing something.
    It appears as long as the WinForms app is running its message loop its eating the textinput messages

    Any help would be greatly appreciated
    Tuesday, June 17, 2008 6:29 PM

Answers

  • Ignore the post

    I've solved the issue in a completely different manner then what I was finding on MSDN

    On my WinForms app I created a MessageFilter and it sees the WM_CHAR message.
    I then just manually dispatched the message using pinvoke

            [DllImport("user32", EntryPoint = "DispatchMessage")]
            public static extern int DispatchMessageA (ref Message lpMsg);

    and now WPF is getting input as expected.
    • Marked as answer by Marco Zhou Tuesday, June 24, 2008 10:46 AM
    Tuesday, June 17, 2008 7:32 PM