Solved

When any Control gets focus

Posted on 2004-09-25
7
228 Views
Last Modified: 2010-04-01
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,
0
Comment
Question by:msjammu
  • 4
7 Comments
 
LVL 1

Expert Comment

by:Feldspar
ID: 12152845
You will recieve a WM_SETFOCUS message whenever a window gains the focus
0
 
LVL 6

Author Comment

by:msjammu
ID: 12157853
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
0
 
LVL 6

Author Comment

by:msjammu
ID: 12160336
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,
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 6

Author Comment

by:msjammu
ID: 12190585
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,
0
 
LVL 6

Author Comment

by:msjammu
ID: 12265137
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.ActiveControl.tabIndex = MinControlIndex Then
                    'MDIPreviousTabControl.SetFocus
                Else
                    HandleTab
                End If
            Else
            If FormInQuestion.ActiveControl.tabIndex = MaxControlIndex Then
                'MDINextTabControl.SetFocus
            Else
                HandleTab
            End If
            End If
        Else
            HandleTab
        End If
    End If
----------------------------------------------------------------------------------
Experts:

Thanks for the help

Regards,
0
 

Accepted Solution

by:
ee_ai_construct earned 0 total points
ID: 12463458
Question answered by asker or dialog valuable.
Closed, 250 points refunded.
ee_ai_construct (replacement part #xm34)
Community Support Admin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
maze travler 6 51
Grammars for C C++ and java 1 113
Embarcadero C++ Builder XE2 TDateTime 8 61
c++ substatte a varabe for a string in a LPCTSTR statment 8 83
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

4 Experts available now in Live!

Get 1:1 Help Now