Keyboard events from child forms in another DLL ? 
Author Message
 Keyboard events from child forms in another DLL ?

Hi,

We've got a problem here with our (fairly complex) VB app. The App has a
main application exe, which hosts a large number of forms that are held in
ActiveX DLL's. This works fine, except that when the hosted forms have
focus, the menu shortcuts for the main app don't work.

If this was a normal application, 'KeyPreview = True' would do the trick. In
our situation, though, it's quite easy to verify (with Spy++) that the
keyboard events (i.e. window messages) simply aren't getting to the host
application. I'm assuming this is because the KeyPreview mechanism requires
more 'hooking up' than we are doing (see below).

Has anyone got any ideas on how to get this sort of mechanism working? The
details of the code we use are below.

Thanks a lot,

James Chaldecott

Implementation Details:
-----------------------
In the Form_Load of the host application (i.e. before this), (the global
variable) gStepWindowHandle is initialised from the hWnd property of a
standard VB PictureBox on the main form (placed where we want the child
forms to display).

The forms then displayed by calling the following public method of the Host.

Public Sub RegisterStepForm(hWnd As Long)

    ' Make this a child window
    Dim lStyle As Long
    lStyle = GetWindowLong(hWnd, GWL_STYLE)
    lStyle = lStyle Or WS_CHILD
    Call SetWindowLong(hWnd, GWL_STYLE, lStyle)

    ' Make the hosting area the parent window
    SetParent hWnd, gStepWindowHandle

End Sub



Sat, 28 Jun 2003 23:52:55 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. MDI Form - How can I disable keyboard child form switching

2. Q: Form activate Fires On Non Child MDI Forms But Only Once On Child Mdi Forms

3. Loading MDI Child forms to a parent form from a DLL

4. Using a form contained in a VB OLE DLL as a child of the MDI form

5. Having MDI form with MDI Child form in DLL

6. keyboard events when form doesn't have the focus

7. Keyboard events in MDI forms ...

8. How to trap keyboard events in mdi form...

9. Activated event in MDI child form

10. Enter event fires twice on MDI Child form

11. Passing MDI Parents menu click events to child forms

12. MDI Help - Prevent Child Form from Exiting in Unload Event

 

 
Powered by phpBB® Forum Software