bush, vbaccelerator method is using FORM.
While i'm trying to avoid using FORM
In your opinion, what is best method to popup window?
using FORM with show as modal or using object on the same FORM with combobox behaviour?
If your preferred method is using FORM how to avoid created so many FORM for each popup windows?
Add the attached module to your project. Now all you have todo is to add the following code to the click event of your button (when you want to show the Frame).
VB Code:
Private Sub Command1_Click()
Call HookMouse(Me.hWnd, Frame1.hWnd)
End Sub
You don't even have to set the Visible property of the Frame to True, everything is handled by the attached code which uses a hook to detect mouse operations within your application and it also subclasses your app to detect if another application gains focus. If the mouse is pressed anywhere inside your application the frame will be hidden, the same happens if your application loses focus.
To handle the Esc key set the KeyPreview property of the Form to True and add this code:
VB Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)