msjammu
asked on
When any Control gets focus
Hi Experts,
I want to perform a specific operation when any control on a window gets focus. Plz anybody explain what messages I handle.
Only Win32
Thanks & Regards,
I want to perform a specific operation when any control on a window gets focus. Plz anybody explain what messages I handle.
Only Win32
Thanks & Regards,
You will recieve a WM_SETFOCUS message whenever a window gains the focus
ASKER
But this is not what I get! I noticed only event number Hex "D" comming out when I shift between controls on the form. What is wrong here. MY problem is solved with event number 13 (D)
Many Thanks
Many Thanks
ASKER
Feldspar:
I was wrong ! In VS API veiwer displays message number 13 for WM_GETTEXT:
Public Const WM_GETTEXT = &HD
Actually I could have ellaborated more,
AS I told I want to perform a specific operation when any control on a window gets focus. The thing I am trying is in VB, I have created a custom windows procedure for one of my target forms. For every control placed on my current form I want to perform a common operation to all the controls, in form's custom windows procedure I have created. I want a kind of notification that every control generated to notify the main parent window (in my case when it gets focus). The control may lay on a picture box on the form or in a frame, but that event must be for "form window" so that I can handle as I have custom winProc only for main window.
The WM_SETFOCUS message is sent to a window after it has gained the keyboard focus. (I think this I am not looking for)
I want something like: The WM_XXX message is sent to main parent window of the window after it has gained the keyboard focus.
Any help wud be appreciated,
I was wrong ! In VS API veiwer displays message number 13 for WM_GETTEXT:
Public Const WM_GETTEXT = &HD
Actually I could have ellaborated more,
AS I told I want to perform a specific operation when any control on a window gets focus. The thing I am trying is in VB, I have created a custom windows procedure for one of my target forms. For every control placed on my current form I want to perform a common operation to all the controls, in form's custom windows procedure I have created. I want a kind of notification that every control generated to notify the main parent window (in my case when it gets focus). The control may lay on a picture box on the form or in a frame, but that event must be for "form window" so that I can handle as I have custom winProc only for main window.
The WM_SETFOCUS message is sent to a window after it has gained the keyboard focus. (I think this I am not looking for)
I want something like: The WM_XXX message is sent to main parent window of the window after it has gained the keyboard focus.
Any help wud be appreciated,
ASKER
I have solved my problem by subclassing all the child controls on the form,
I request the moderator to delete this question and refund points
Thanks you Feldspar for commenting but the solution you gave me was not what I was looking for,
I request the moderator to delete this question and refund points
Thanks you Feldspar for commenting but the solution you gave me was not what I was looking for,
ASKER
Please delete What I got a solution myself is given here as VB Code:
Simple and handy and It work for me
-------------------------- ---------- ---------- ---------- ---------- ---------- ---
If GetAsyncKeyState(VK_SHIFT) < 0 Then
'Debug.Print " Shift Key pressed"
ShiftDown = True
End If
If GetKeyState(VK_TAB) < 0 Then
'Debug.Print " Tab Key pressed"
If TabOutside Then
If ShiftDown Then
If FormInQuestion.ActiveContr ol.tabInde x = MinControlIndex Then
'MDIPreviousTabControl.Set Focus
Else
HandleTab
End If
Else
If FormInQuestion.ActiveContr ol.tabInde x = MaxControlIndex Then
'MDINextTabControl.SetFocu s
Else
HandleTab
End If
End If
Else
HandleTab
End If
End If
-------------------------- ---------- ---------- ---------- ---------- ---------- ------
Experts:
Thanks for the help
Regards,
Simple and handy and It work for me
--------------------------
If GetAsyncKeyState(VK_SHIFT)
'Debug.Print " Shift Key pressed"
ShiftDown = True
End If
If GetKeyState(VK_TAB) < 0 Then
'Debug.Print " Tab Key pressed"
If TabOutside Then
If ShiftDown Then
If FormInQuestion.ActiveContr
'MDIPreviousTabControl.Set
Else
HandleTab
End If
Else
If FormInQuestion.ActiveContr
'MDINextTabControl.SetFocu
Else
HandleTab
End If
End If
Else
HandleTab
End If
End If
--------------------------
Experts:
Thanks for the help
Regards,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.