Link to home
Start Free TrialLog in
Avatar of tocos
tocos

asked on

detect if form has the focus

Hello,

Is there a way to check if a form has the focus ..

I have made a skin OCX for my applications .. I need the skin to be in different color scheme whenever the form has the focus.

Hesham
SOLUTION
Avatar of Sethi
Sethi
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tocos
tocos

ASKER

Hello,

- Using Screen.ActiveForm.Name on my skin returns error.
- I used GetFocus in a timer control to detect the state of form as follow:

    If GetFocus = UserControl.Parent.hWnd Then
        Shape1.BackColor = vbRed
    Else
        Shape1.BackColor = vbWhite
    End If

It worked fine in design time but when I run the application it gave getfocus value different than the .hwnd

Regards,
Hesham
tocos:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?