How to let a CStatic control accept WM_CHAR ?

Since the CStatic control fully covers my main window, it's the only
one which can get focus.
While I need to handle WM_CHAR in its parent/main window, I just found
that the static cannot get the WM_CHAR message.
Is there a way to do what I want?
Thanks guys.
0
meedeex (7)
2/13/2008 8:15:49 PM
vc.mfc 33608 articles. 0 followers. Follow

16 Replies
1483 Views

Similar Articles

[PageSpeed] 11

Maybe you could show some code to explain more.  I can't figure out why a 
static would want to get a WM_CHAR message.  Are you trying to get this in 
other controls on top of this one?  How or what are you using the CStatic 
for?

Tom

"Meal" <meedeex@gmail.com> wrote in message 
news:4033eb4f-52ae-4b84-b983-22c8624bb75e@s19g2000prg.googlegroups.com...
> Since the CStatic control fully covers my main window, it's the only
> one which can get focus.
> While I need to handle WM_CHAR in its parent/main window, I just found
> that the static cannot get the WM_CHAR message.
> Is there a way to do what I want?
> Thanks guys. 

0
tom.nospam (3240)
2/13/2008 8:41:53 PM
This is a little confusing. Normally, static controls cannot get the focus 
and I suspect this is what you are seeing. Static controls get WM_CHAR just 
fine once they have the focus.

I would recommend you try SetFocus on your static control to see if that 
helps but, honestly, I really can't imagine what it is that you are trying 
to accomplish.

-- 
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"Meal" <meedeex@gmail.com> wrote in message 
news:4033eb4f-52ae-4b84-b983-22c8624bb75e@s19g2000prg.googlegroups.com...
> Since the CStatic control fully covers my main window, it's the only
> one which can get focus.
> While I need to handle WM_CHAR in its parent/main window, I just found
> that the static cannot get the WM_CHAR message.
> Is there a way to do what I want?
> Thanks guys. 

0
jwood (1292)
2/13/2008 8:54:33 PM
Sorry, I posted my answer to your email address.
Could you please post it here and give me a further answer?
Thanks.

On Feb 13, 3:54=A0pm, "Jonathan Wood" <jw...@softcircuits.com> wrote:
> This is a little confusing. Normally, static controls cannot get the focus=

> and I suspect this is what you are seeing. Static controls get WM_CHAR jus=
t
> fine once they have the focus.
>
> I would recommend you try SetFocus on your static control to see if that
> helps but, honestly, I really can't imagine what it is that you are trying=

> to accomplish.
>
> --
> Jonathan Wood
> SoftCircuits Programminghttp://www.softcircuits.com
>
> "Meal" <meed...@gmail.com> wrote in message
>
> news:4033eb4f-52ae-4b84-b983-22c8624bb75e@s19g2000prg.googlegroups.com...
>
> > Since the CStatic control fully covers my main window, it's the only
> > one which can get focus.
> > While I need to handle WM_CHAR in its parent/main window, I just found
> > that the static cannot get the WM_CHAR message.
> > Is there a way to do what I want?
> > Thanks guys.

0
meedeex (7)
2/13/2008 9:14:59 PM
I don't see your email.

-- 
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"Meal" <meedeex@gmail.com> wrote in message 
news:12ab97ea-0b21-4826-b7f2-851f4dcb0d9d@s13g2000prd.googlegroups.com...
Sorry, I posted my answer to your email address.
Could you please post it here and give me a further answer?
Thanks.

On Feb 13, 3:54 pm, "Jonathan Wood" <jw...@softcircuits.com> wrote:
> This is a little confusing. Normally, static controls cannot get the focus
> and I suspect this is what you are seeing. Static controls get WM_CHAR 
> just
> fine once they have the focus.
>
> I would recommend you try SetFocus on your static control to see if that
> helps but, honestly, I really can't imagine what it is that you are trying
> to accomplish.
>
> --
> Jonathan Wood
> SoftCircuits Programminghttp://www.softcircuits.com
>
> "Meal" <meed...@gmail.com> wrote in message
>
> news:4033eb4f-52ae-4b84-b983-22c8624bb75e@s19g2000prg.googlegroups.com...
>
> > Since the CStatic control fully covers my main window, it's the only
> > one which can get focus.
> > While I need to handle WM_CHAR in its parent/main window, I just found
> > that the static cannot get the WM_CHAR message.
> > Is there a way to do what I want?
> > Thanks guys.

0
jwood (1292)
2/13/2008 9:43:00 PM
"Meal" <meedeex@gmail.com> wrote in message 
news:4033eb4f-52ae-4b84-b983-22c8624bb75e@s19g2000prg.googlegroups.com...
> Since the CStatic control fully covers my main window, it's the only
> one which can get focus.
> While I need to handle WM_CHAR in its parent/main window, I just found
> that the static cannot get the WM_CHAR message.
> Is there a way to do what I want?
> Thanks guys.

According to the documentation, static controls can't be selected and can't 
receive keyboard focus, although it might be possible for them to receive 
mouse input:

"...   Although static controls are child windows, they cannot be selected. 
Therefore, they cannot receive the keyboard focus and cannot have a keyboard 
interface. A static control that has the SS_NOTIFY style receives mouse 
input, notifying the parent window when the user clicks or double clicks the 
control. ..."

http://msdn2.microsoft.com/en-us/library/bb760767(VS.85).aspx

So it might not be possible for a static to get WM_CHAR 


0
2/13/2008 10:02:54 PM
Well, no idea what happened.
Let me repeat my post.

I cannot show you the source codes since it's quite large and it's for
commercial purpose.
Somebody designed a GUI, on which a large static control covers almost
all other controls.
Thus the user can only click on the static to activate this
application.
We need to handle user input from keyboard in this application.
But as you can see, all the keyboard messages are blocked by the
static control.
I know that the main window can capture these msgs, but I cannot
handle them there, because a modal dialog can be prompted for other
keyboard input.

On Feb 13, 4:43=A0pm, "Jonathan Wood" <jw...@softcircuits.com> wrote:
> I don't see your email.
>
> --
> Jonathan Wood
> SoftCircuits Programminghttp://www.softcircuits.com
>
> "Meal" <meed...@gmail.com> wrote in message
>
> news:12ab97ea-0b21-4826-b7f2-851f4dcb0d9d@s13g2000prd.googlegroups.com...
> Sorry, I posted my answer to your email address.
> Could you please post it here and give me a further answer?
> Thanks.
>
> On Feb 13, 3:54 pm, "Jonathan Wood" <jw...@softcircuits.com> wrote:
>
> > This is a little confusing. Normally, static controls cannot get the foc=
us
> > and I suspect this is what you are seeing. Static controls get WM_CHAR
> > just
> > fine once they have the focus.
>
> > I would recommend you try SetFocus on your static control to see if that=

> > helps but, honestly, I really can't imagine what it is that you are tryi=
ng
> > to accomplish.
>
> > --
> > Jonathan Wood
> > SoftCircuits Programminghttp://www.softcircuits.com
>
> > "Meal" <meed...@gmail.com> wrote in message
>
> >news:4033eb4f-52ae-4b84-b983-22c8624bb75e@s19g2000prg.googlegroups.com...=

>
> > > Since the CStatic control fully covers my main window, it's the only
> > > one which can get focus.
> > > While I need to handle WM_CHAR in its parent/main window, I just found=

> > > that the static cannot get the WM_CHAR message.
> > > Is there a way to do what I want?
> > > Thanks guys.

0
meedeex (7)
2/13/2008 10:03:05 PM
Let me describe the framework of this application.
We have CView, and declared a CStatic as its member.
When CView created, create the CStatic as its child.
User would only press the CStatic to focus on this application.
After the focus, user would press keyboard for input.
The CView should capture the keyboard input.
How to deal with this?

On Feb 13, 5:03=A0pm, Meal <meed...@gmail.com> wrote:
> Well, no idea what happened.
> Let me repeat my post.
>
> I cannot show you the source codes since it's quite large and it's for
> commercial purpose.
> Somebody designed a GUI, on which a large static control covers almost
> all other controls.
> Thus the user can only click on the static to activate this
> application.
> We need to handle user input from keyboard in this application.
> But as you can see, all the keyboard messages are blocked by the
> static control.
> I know that the main window can capture these msgs, but I cannot
> handle them there, because a modal dialog can be prompted for other
> keyboard input.
>
> On Feb 13, 4:43=A0pm, "Jonathan Wood" <jw...@softcircuits.com> wrote:
>
> > I don't see your email.
>
> > --
> > Jonathan Wood
> > SoftCircuits Programminghttp://www.softcircuits.com
>
> > "Meal" <meed...@gmail.com> wrote in message
>
> >news:12ab97ea-0b21-4826-b7f2-851f4dcb0d9d@s13g2000prd.googlegroups.com...=

> > Sorry, I posted my answer to your email address.
> > Could you please post it here and give me a further answer?
> > Thanks.
>
> > On Feb 13, 3:54 pm, "Jonathan Wood" <jw...@softcircuits.com> wrote:
>
> > > This is a little confusing. Normally, static controls cannot get the f=
ocus
> > > and I suspect this is what you are seeing. Static controls get WM_CHAR=

> > > just
> > > fine once they have the focus.
>
> > > I would recommend you try SetFocus on your static control to see if th=
at
> > > helps but, honestly, I really can't imagine what it is that you are tr=
ying
> > > to accomplish.
>
> > > --
> > > Jonathan Wood
> > > SoftCircuits Programminghttp://www.softcircuits.com
>
> > > "Meal" <meed...@gmail.com> wrote in message
>
> > >news:4033eb4f-52ae-4b84-b983-22c8624bb75e@s19g2000prg.googlegroups.com.=
...
>
> > > > Since the CStatic control fully covers my main window, it's the only=

> > > > one which can get focus.
> > > > While I need to handle WM_CHAR in its parent/main window, I just fou=
nd
> > > > that the static cannot get the WM_CHAR message.
> > > > Is there a way to do what I want?
> > > > Thanks guys.

0
meedeex (7)
2/13/2008 10:21:58 PM
"Meal" <meedeex@gmail.com> wrote in message 
news:28e82598-bbbf-4dab-8dd8-a1a7bc4e472e@d21g2000prf.googlegroups.com...
> Let me describe the framework of this application.
> We have CView, and declared a CStatic as its member.
> When CView created, create the CStatic as its child.
> User would only press the CStatic to focus on this application.
> After the focus, user would press keyboard for input.
> The CView should capture the keyboard input.
> How to deal with this?

Create CMyStatic derived from CStatic, and assign that to that DDX for the 
static control.  Handle WM_SETFOCUS, and call SetFocus() to set the focus 
back to the parent CView.

But I don't think in CMyStatic::OnSetFocus() you can call SetFocus().  You 
have to wait until your focus message is entirely processed.  So in 
CMyStatic::OnSetFocus(), post yourself a private message, and when that 
message is received, call SetFocus() to set the focus to the CView.

-- David




0
dc2983 (3206)
2/13/2008 10:56:44 PM
"Michael K. O'Neill" <mikeathon2000@nospam.hotmail.com> wrote in message 
news:%232IuwwobIHA.536@TK2MSFTNGP06.phx.gbl...
> "Meal" <meedeex@gmail.com> wrote in message 
> news:4033eb4f-52ae-4b84-b983-22c8624bb75e@s19g2000prg.googlegroups.com...
>> Since the CStatic control fully covers my main window, it's the only
>> one which can get focus.
>> While I need to handle WM_CHAR in its parent/main window, I just found
>> that the static cannot get the WM_CHAR message.
>> Is there a way to do what I want?
>> Thanks guys.
>
> According to the documentation, static controls can't be selected and 
> can't receive keyboard focus, although it might be possible for them to 
> receive mouse input:
>
> "...   Although static controls are child windows, they cannot be 
> selected. Therefore, they cannot receive the keyboard focus and cannot 
> have a keyboard interface. A static control that has the SS_NOTIFY style 
> receives mouse input, notifying the parent window when the user clicks or 
> double clicks the control. ..."
>
> http://msdn2.microsoft.com/en-us/library/bb760767(VS.85).aspx
>
> So it might not be possible for a static to get WM_CHAR
>

Hmm, then what window has the focus after a static control is clicked?

-- David 


0
dc2983 (3206)
2/13/2008 10:57:19 PM
Have you considered switching it to a CFormView?   That way you wouldn't 
have to use a CStatic for the background at all.  Either that or perhaps you 
could use some other kind of control for your background?

Tom

"Meal" <meedeex@gmail.com> wrote in message 
news:28e82598-bbbf-4dab-8dd8-a1a7bc4e472e@d21g2000prf.googlegroups.com...
Let me describe the framework of this application.
We have CView, and declared a CStatic as its member.
When CView created, create the CStatic as its child.
User would only press the CStatic to focus on this application.
After the focus, user would press keyboard for input.
The CView should capture the keyboard input.
How to deal with this?

On Feb 13, 5:03 pm, Meal <meed...@gmail.com> wrote:
> Well, no idea what happened.
> Let me repeat my post.
>
> I cannot show you the source codes since it's quite large and it's for
> commercial purpose.
> Somebody designed a GUI, on which a large static control covers almost
> all other controls.
> Thus the user can only click on the static to activate this
> application.
> We need to handle user input from keyboard in this application.
> But as you can see, all the keyboard messages are blocked by the
> static control.
> I know that the main window can capture these msgs, but I cannot
> handle them there, because a modal dialog can be prompted for other
> keyboard input.
>
> On Feb 13, 4:43 pm, "Jonathan Wood" <jw...@softcircuits.com> wrote:
>
> > I don't see your email.
>
> > --
> > Jonathan Wood
> > SoftCircuits Programminghttp://www.softcircuits.com
>
> > "Meal" <meed...@gmail.com> wrote in message
>
> >news:12ab97ea-0b21-4826-b7f2-851f4dcb0d9d@s13g2000prd.googlegroups.com...
> > Sorry, I posted my answer to your email address.
> > Could you please post it here and give me a further answer?
> > Thanks.
>
> > On Feb 13, 3:54 pm, "Jonathan Wood" <jw...@softcircuits.com> wrote:
>
> > > This is a little confusing. Normally, static controls cannot get the 
> > > focus
> > > and I suspect this is what you are seeing. Static controls get WM_CHAR
> > > just
> > > fine once they have the focus.
>
> > > I would recommend you try SetFocus on your static control to see if 
> > > that
> > > helps but, honestly, I really can't imagine what it is that you are 
> > > trying
> > > to accomplish.
>
> > > --
> > > Jonathan Wood
> > > SoftCircuits Programminghttp://www.softcircuits.com
>
> > > "Meal" <meed...@gmail.com> wrote in message
>
> > >news:4033eb4f-52ae-4b84-b983-22c8624bb75e@s19g2000prg.googlegroups.com...
>
> > > > Since the CStatic control fully covers my main window, it's the only
> > > > one which can get focus.
> > > > While I need to handle WM_CHAR in its parent/main window, I just 
> > > > found
> > > > that the static cannot get the WM_CHAR message.
> > > > Is there a way to do what I want?
> > > > Thanks guys.

0
tom.nospam (3240)
2/13/2008 11:05:56 PM
"David Ching" <dc@remove-this.dcsoft.com> wrote in message 
news:jBKsj.7093$5K1.2334@newssvr12.news.prodigy.net...
>
> "Michael K. O'Neill" <mikeathon2000@nospam.hotmail.com> wrote in message 
> news:%232IuwwobIHA.536@TK2MSFTNGP06.phx.gbl...
>> "Meal" <meedeex@gmail.com> wrote in message 
>> news:4033eb4f-52ae-4b84-b983-22c8624bb75e@s19g2000prg.googlegroups.com...
>>> Since the CStatic control fully covers my main window, it's the only
>>> one which can get focus.
>>> While I need to handle WM_CHAR in its parent/main window, I just found
>>> that the static cannot get the WM_CHAR message.
>>> Is there a way to do what I want?
>>> Thanks guys.
>>
>> According to the documentation, static controls can't be selected and 
>> can't receive keyboard focus, although it might be possible for them to 
>> receive mouse input:
>>
>> "...   Although static controls are child windows, they cannot be 
>> selected. Therefore, they cannot receive the keyboard focus and cannot 
>> have a keyboard interface. A static control that has the SS_NOTIFY style 
>> receives mouse input, notifying the parent window when the user clicks or 
>> double clicks the control. ..."
>>
>> http://msdn2.microsoft.com/en-us/library/bb760767(VS.85).aspx
>>
>> So it might not be possible for a static to get WM_CHAR
>>
>
> Hmm, then what window has the focus after a static control is clicked?


Whatever window had the focus - the focus doesn't change (I just tried it on 
Vista)

Mark

-- 
Mark Salsbery
Microsoft MVP - Visual C++

>
> -- David
> 
0
Mark
2/13/2008 11:45:21 PM
"Mark Salsbery [MVP]" <MarkSalsbery[MVP]@newsgroup.nospam> wrote in message 
news:040BA94B-8E19-4343-BA8D-02CA0CD1DDA0@microsoft.com...
>> Hmm, then what window has the focus after a static control is clicked?
>
>
> Whatever window had the focus - the focus doesn't change (I just tried it 
> on Vista)
>

With another app having the focus, I clicked on a static control in a modal 
dialog of another app; the result was identical to clicking on the title bar 
of the dialog; i.e. the first control in the Z-order (other than the static 
control) got the focus.

If this is the behavior, I think perhaps in the OP's case, the CMainFrame is 
getting the focus when the static control is clicked on.  I typically handle 
this something like:

CMainFrame::OnSetFocus(...)
{
    // Give the view first crack at keyboard messages
    GetActiveView()->SetFocus();
}


Maybe this is what is needed.

-- David 


0
dc2983 (3206)
2/14/2008 12:08:38 AM
"David Ching" <dc@remove-this.dcsoft.com> wrote in message 
news:aELsj.6003$xq2.5979@newssvr21.news.prodigy.net...
> "Mark Salsbery [MVP]" <MarkSalsbery[MVP]@newsgroup.nospam> wrote in 
> message news:040BA94B-8E19-4343-BA8D-02CA0CD1DDA0@microsoft.com...
>>> Hmm, then what window has the focus after a static control is clicked?
>>
>>
>> Whatever window had the focus - the focus doesn't change (I just tried it 
>> on Vista)
>>
>
> With another app having the focus, I clicked on a static control in a 
> modal dialog of another app; the result was identical to clicking on the 
> title bar of the dialog; i.e. the first control in the Z-order (other than 
> the static control) got the focus.
>
> If this is the behavior, I think perhaps in the OP's case, the CMainFrame 
> is getting the focus when the static control is clicked on.  I typically 
> handle this something like:
>
> CMainFrame::OnSetFocus(...)
> {
>    // Give the view first crack at keyboard messages
>    GetActiveView()->SetFocus();
> }
>
>
> Maybe this is what is needed.


Could be.  That's what CFrameWnd::OnSetFocus() does...

void CFrameWnd::OnSetFocus(CWnd* pOldWnd)
{
	if (m_pViewActive != NULL)
		m_pViewActive->SetFocus();
	else
		CWnd::OnSetFocus(pOldWnd);
}


Mark

-- 
Mark Salsbery
Microsoft MVP - Visual C++
>
> -- David
> 
0
Mark
2/14/2008 12:50:00 AM
"Mark Salsbery [MVP]" <MarkSalsbery[MVP]@newsgroup.nospam> wrote in message 
news:A81C59BB-8A46-46C3-89C7-E8418F16E1E7@microsoft.com...
> Could be.  That's what CFrameWnd::OnSetFocus() does...
>
> void CFrameWnd::OnSetFocus(CWnd* pOldWnd)
> {
> if (m_pViewActive != NULL)
> m_pViewActive->SetFocus();
> else
> CWnd::OnSetFocus(pOldWnd);
> }

Oh, I didn't know that.  Been generating unneeded code all this time... ;)

In that case, I'm at a loss to explain OP's problem.  The view should be 
getting the focus and the keystrokes, no question.

-- David


0
dc2983 (3206)
2/14/2008 1:06:59 AM
Sounds like a fundamentally flawed design.  A static control cannot get focus (this is not
a concept it supports), and consequently there is no way to send it keyboard data.

Why is a CStatic being used?  What is its purpose?  One way to deal with this issue is
simply to derive from CWnd instead of CStatic, so it is the nature of what the CStatic is
doing that is going to tell what has to be done.
					joe

On Wed, 13 Feb 2008 14:21:58 -0800 (PST), Meal <meedeex@gmail.com> wrote:

>Let me describe the framework of this application.
>We have CView, and declared a CStatic as its member.
>When CView created, create the CStatic as its child.
>User would only press the CStatic to focus on this application.
>After the focus, user would press keyboard for input.
>The CView should capture the keyboard input.
>How to deal with this?
>
>On Feb 13, 5:03�pm, Meal <meed...@gmail.com> wrote:
>> Well, no idea what happened.
>> Let me repeat my post.
>>
>> I cannot show you the source codes since it's quite large and it's for
>> commercial purpose.
>> Somebody designed a GUI, on which a large static control covers almost
>> all other controls.
>> Thus the user can only click on the static to activate this
>> application.
>> We need to handle user input from keyboard in this application.
>> But as you can see, all the keyboard messages are blocked by the
>> static control.
>> I know that the main window can capture these msgs, but I cannot
>> handle them there, because a modal dialog can be prompted for other
>> keyboard input.
>>
>> On Feb 13, 4:43�pm, "Jonathan Wood" <jw...@softcircuits.com> wrote:
>>
>> > I don't see your email.
>>
>> > --
>> > Jonathan Wood
>> > SoftCircuits Programminghttp://www.softcircuits.com
>>
>> > "Meal" <meed...@gmail.com> wrote in message
>>
>> >news:12ab97ea-0b21-4826-b7f2-851f4dcb0d9d@s13g2000prd.googlegroups.com...
>> > Sorry, I posted my answer to your email address.
>> > Could you please post it here and give me a further answer?
>> > Thanks.
>>
>> > On Feb 13, 3:54 pm, "Jonathan Wood" <jw...@softcircuits.com> wrote:
>>
>> > > This is a little confusing. Normally, static controls cannot get the focus
>> > > and I suspect this is what you are seeing. Static controls get WM_CHAR
>> > > just
>> > > fine once they have the focus.
>>
>> > > I would recommend you try SetFocus on your static control to see if that
>> > > helps but, honestly, I really can't imagine what it is that you are trying
>> > > to accomplish.
>>
>> > > --
>> > > Jonathan Wood
>> > > SoftCircuits Programminghttp://www.softcircuits.com
>>
>> > > "Meal" <meed...@gmail.com> wrote in message
>>
>> > >news:4033eb4f-52ae-4b84-b983-22c8624bb75e@s19g2000prg.googlegroups.com...
>>
>> > > > Since the CStatic control fully covers my main window, it's the only
>> > > > one which can get focus.
>> > > > While I need to handle WM_CHAR in its parent/main window, I just found
>> > > > that the static cannot get the WM_CHAR message.
>> > > > Is there a way to do what I want?
>> > > > Thanks guys.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
2/14/2008 5:11:19 PM
Hi, thanks all your guys. I solved this with some of your hints.
A static control normally takes no input and provides no output;
however, it can notify its parent of mouse clicks if it's created with
SS_NOTIFY style.
So, I handled the notify in the CView and set focus back to the
CStatic (or CView).
It's true that CStatic cannot accept focus from user input, but we can
do this with codes.
With the focus, CStatic can accept keyboard msgs like WM_CHAR.
I've proved this from Spy++.

On Feb 14, 12:11=A0pm, Joseph M. Newcomer <newco...@flounder.com> wrote:
> Sounds like a fundamentally flawed design. =A0A static control cannot get =
focus (this is not
> a concept it supports), and consequently there is no way to send it keyboa=
rd data.
>
> Why is a CStatic being used? =A0What is its purpose? =A0One way to deal wi=
th this issue is
> simply to derive from CWnd instead of CStatic, so it is the nature of what=
 the CStatic is
> doing that is going to tell what has to be done.
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 joe
>
>
>
> On Wed, 13 Feb 2008 14:21:58 -0800 (PST), Meal <meed...@gmail.com> wrote:
> >Let me describe the framework of this application.
> >We have CView, and declared a CStatic as its member.
> >When CView created, create the CStatic as its child.
> >User would only press the CStatic to focus on this application.
> >After the focus, user would press keyboard for input.
> >The CView should capture the keyboard input.
> >How to deal with this?
>
> >On Feb 13, 5:03=A0pm, Meal <meed...@gmail.com> wrote:
> >> Well, no idea what happened.
> >> Let me repeat my post.
>
> >> I cannot show you the source codes since it's quite large and it's for
> >> commercial purpose.
> >> Somebody designed a GUI, on which a large static control covers almost
> >> all other controls.
> >> Thus the user can only click on the static to activate this
> >> application.
> >> We need to handle user input from keyboard in this application.
> >> But as you can see, all the keyboard messages are blocked by the
> >> static control.
> >> I know that the main window can capture these msgs, but I cannot
> >> handle them there, because a modal dialog can be prompted for other
> >> keyboard input.
>
> >> On Feb 13, 4:43=A0pm, "Jonathan Wood" <jw...@softcircuits.com> wrote:
>
> >> > I don't see your email.
>
> >> > --
> >> > Jonathan Wood
> >> > SoftCircuits Programminghttp://www.softcircuits.com
>
> >> > "Meal" <meed...@gmail.com> wrote in message
>
> >> >news:12ab97ea-0b21-4826-b7f2-851f4dcb0d9d@s13g2000prd.googlegroups.com=
....
> >> > Sorry, I posted my answer to your email address.
> >> > Could you please post it here and give me a further answer?
> >> > Thanks.
>
> >> > On Feb 13, 3:54 pm, "Jonathan Wood" <jw...@softcircuits.com> wrote:
>
> >> > > This is a little confusing. Normally, static controls cannot get th=
e focus
> >> > > and I suspect this is what you are seeing. Static controls get WM_C=
HAR
> >> > > just
> >> > > fine once they have the focus.
>
> >> > > I would recommend you try SetFocus on your static control to see if=
 that
> >> > > helps but, honestly, I really can't imagine what it is that you are=
 trying
> >> > > to accomplish.
>
> >> > > --
> >> > > Jonathan Wood
> >> > > SoftCircuits Programminghttp://www.softcircuits.com
>
> >> > > "Meal" <meed...@gmail.com> wrote in message
>
> >> > >news:4033eb4f-52ae-4b84-b983-22c8624bb75e@s19g2000prg.googlegroups.c=
om...
>
> >> > > > Since the CStatic control fully covers my main window, it's the o=
nly
> >> > > > one which can get focus.
> >> > > > While I need to handle WM_CHAR in its parent/main window, I just =
found
> >> > > > that the static cannot get the WM_CHAR message.
> >> > > > Is there a way to do what I want?
> >> > > > Thanks guys.
>
> Joseph M. Newcomer [MVP]
> email: newco...@flounder.com
> Web:http://www.flounder.com
> MVP Tips:http://www.flounder.com/mvp_tips.htm

0
meedeex (7)
2/14/2008 8:23:29 PM
Reply:

Similar Artilces:

MemDC & Scroll Control with Mouse Wheel
Ever since I changed to use MemDC, using the mouse wheel made my CSrollView a complete mess. The wheel mouse control was working fine with my flickering version. Then I used MemDC to get rid of flickering issue, now I am having this scrolling issue for using the middle wheel mouse button. What could be wrong? Thanks. On 12 Aug 2005 06:53:36 -0700, guxu@hotmail.com wrote: >Ever since I changed to use MemDC, using the mouse wheel made my >CSrollView a complete mess. The wheel mouse control was working fine >with my flickering version. Then I used MemDC to get rid of flickering &g...

Printing problem
This may also relate to scrolling. An Edit control under Win9x/Me can only hold 65535 characters of text, whereas one under W2K/XP can hold over 2 billion. That has caused me a problem. I've had users to try to drop more text into my Edit control (in an EditView) than will fit in it. I worked around that by checking the length of the incoming text against the buffer, removing lines at the top of the buffer if needed to provide space, then putting the incoming text into the control at the bottom. That worked, but I lose the text that is taken out of the buffer. The problem I have is that ...

form control
Hi, does anyone know how to get the text that appears on a form control check box? I can do it by using ActiveX control check box, but is there any way to do it if I use the form control check box? Thanks for your help not quite sure what you mean. Do you just want to change the text from 'check box 1' to something else?, if so just right ckick on the text and select edit -- John MOS Master Instructor Please reply & rate any replies you get Ice Hockey rules (especially the Wightlink Raiders) "irene c" wrote: > Hi, does anyone know how to get the text that ...

Auto Accept Agent\Script
We have a mixed Exch deployment (5.5 & 2k3) We have deployed the auto accept agent (new one) on facility mailboxes that we have moved to the new Ex2k3 server. It works fine for mailboxes that are located on the Ex2k3 server but not for mailboxes located on Ex5.5 that are inviting the resource mailboxes located on Ex2k3. I think this is because the new Ex2k3 script doesn't work for X400 type msgs. My question is how to get them to work. Or how do I or even can I apply the old auto accept script (Ex5.5) on the resource mailboxes located on the Ex2k3 srvs. I cannot at present eve...

A Way for saving control with all of it's components and properties to a file or stream.
Hello. Is there any way to save a control + all of it's components to a file (or give it some representation as a long string). Thanks :) Mr. X. wrote: > Hello. > Is there any way to save a control + all of it's components to a file > (or give it some representation as a long string). > > Thanks :) A control is an object with properties. You save the properties of the object to a XML file manually. You instantiate the control/object (new), and you populate the control/object from the XML file that represents the controls properties. XML is stri...

Exch2003
Hi! When I installed our OWA frontend server, a temporary server was acting as global catalog server etc (because our primary server had be be migrated from win2000 to win2003). The OWA frontend was moved to the DMZ before the new server was up and running. But bow I want to take down the temporary server - and when I look at the "Directory Access" tab of the properties on the OWA frontend in the Exch System Manager, the "Configuration Domain Controller" and "Global Catalog" server is set to the temporary server. I know how to change the "Global Catalog&qu...

How can I control the positioning of the Comments field?
I have a worksheet that contains lengthy comments that are used to describe column headers. However when the comments fields display, they are often off the page, or broken by the freeze window line. Is there a way to anchor the comments field for each column so that it displays consistently each time? Or is there a better way to do this? I don't think you can really control them. But Debra Dalgleish has a way to reposition them when they move where you don't want them: http://contextures.com/xlcomments03.html#Reset GregRTI wrote: > > I have a worksheet that contains ...

Solver for Inventory Control
Hi! I've a problem, I have read few tutorials online for Excel Solver, but I still don't know which columns to put in the solver. This is my first time I'm using Solver. I've two products ProductA and ProductB, and then I've columns for both the products: Inventory in store Demand Inventory outgoing cost if product to order how much to order Now, I want to know if I've to order a product which , in Inventory is Store , is less than 6. But I can only order a product either 0, 10 or 20 How can I do that.. I'm really confused how to use it....

rebar control and cursor
I use a rebar control to show toolbar on CDialog. It works fine, however, I notice that when a cursor move to the bottom on the toolbar, and the cursor change to IDC_SIZENS style. I have no idea why, it is not like users can resize the bar. I have no idea how does that happen. Is there a way to not let the cursor change? Thanks. ...

Accepted meeting create an unread note
In Outlook 2007 when I accept a meeting notice, the original note goes to my deleted folder as read but an additional note for the same meeting shows as unread As an additional ?, when I mark items as read or move them from my inbox they dont reflect the change many times until a click on another folder and come back, it looks like they did not occur, any reason that is happening When folders don't update it usually indicates a problem with NAT routers. What type of email account do you use? -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ O...

Excel should let me create an automated list of the name box
When the name box is used to link cells from other worksheets, or to link matrices to a single name, for lots of data, one can get lost as to what name links to what cell/group of cells, especially if it is a "hand-me-down" spreadsheet. Is there a way to make an automated list that shows you the name and what cell(s) it links to instead of going through "Insert>Name>Define" and copy the name, paste in Word, then go back and copy the "Refers to" field and re-paste in Word, n-times? ---------------- This post is a suggestion for Microsoft, and Microsof...

Why does Custom Format not control Cell Display?
XL 2003 Have a cell which shows in the formula bar: 06/10/2005 10:10:32 AM In the worksheet (same cell but unselected) the display is: 38513.4239814815 No matter what I do with cell formating i.e. general to text to custom (BTW which is mm/dd/yyyy h:mm) the cell displays 38513.4239814815 UNLESS I select the cell - then it displays 06/10/2005 10:10:32 AM? When I de-select the cell it reverts back to 38513.4239814815 I thought that I knew better! What is the very obvious thing that I am missing? Dennis Maybe you're looking at formulas... Tools|options|view tab Uncheck Form...

Using ActiveX control
I want to program a ActiveX control. It reads data from file, and show it. (a kind of viewer) Q1. When i use this control in some html page, i can use <OBJECT> or <EMBED> tag. But i don't know the difference between two tags. (For exam, in <OBJECT> tag, codebase parameter decribes the link of install package, but what's the pluginpage paramter in <EMBED> tag?) And in the flash object insertion example, <EMBED> tag is in the <OBJECT> tag, why? When I tested html that have only <EMBED> tag without <OBJECT> tag, it works well. Q2. Whe...

Pass name of control to a form
How do I pass the name of a control on Form_A to Form_B? For example: I have a hidden control in Form_A named ControlA1_ID, I want to pass the name of that control to Form_B. Then when Form_B closes, I want to place a value, say from Form_B.ControlB_ID, into Form_A.ControlA1_ID. How do I reference the control name? Forms!Form_A.ControlA1_ID.Name? So that I can assign it to a variable for use with OpenArgs. -- www.bardpv.com Tempe, Arizona Emma You may not need to "pass" anything. Take a look at Access HELP for "expressions". You can refer to a control on a f...

Update Static Text Control Using Post Message
Please help me out I am running two threads. 1. The UI thread 2. The thread which does the calcualtion and gives results - DriverProgram() In the driver program I have access to the static text variables of the dialog box (UI). So i update them while running the driver program. The problem now is, how do I post a message to the UI Thread to make it aware of the change in text. I am aware of the function postmessage, but what should i exactly pass as arguments... BOOL PostMessage( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam ); hWnd is the windows handler --- AfxGetMainWnd()->m...

Reference controls on a dialogue form as the parameters
I am trying to create a dialogue form which asks for start date and end date and includes a button to run a report. My goal is to enter the dates only once to run the report. Currently I have the date parameters set in the two queries and have to enter the date range twice when running the report. I tried following several answers to similar questions but now when opening the form and entering the dates I am prompted to re-enter the dates 3 times! The report I am ultimately trying to run consists of a main report, rptCallVolume, and a subreport, rptContractsAndHours. Each of th...

annoying problem with creating controls at runtime
Hi, I do have a little trouble with creating a form with buttons at runtime. Environment: Access 2002, Visual Basic Editor If I run the Sub TestOpenOrCreateForm in F8 mode or if I set Breakpoints in front of AddOrChangeButton then it works fine. However the sub fails when I run it with F5. If I run it with F5 then only the first button is created. Any ideas? Option Compare Database Option Explicit rem this either opens a given form or creates a new one with the name saveas Function OpenOrCreateForm(SaveAs, Caption As String) As Form Dim frm As Form Dim doc As Document Dim db As Database...

Excel in a browser control
Hi all, I want to be able to use excel for editing spreadsheets in my application made with c++ 6.0. The only catch is that the xls-file is stored in a database, so first the file is saved to the temp folder, and after that the user can start editing the excel sheet. After editing the file some values has to be collected from certain cells and the xls file has to be saved in the database again. I have tried to do this some different ways, but havent managed to make it work as it should. 1. Start excel with the spreadsheet as a parameter. In this case I could use a fomula one component to re...

why CStatic.m_hWnd not valid after use realtime thread?
Hi All I build an MFC app, and loadlibrary a dll which use high priority (realtime level ) threads for serial communication but after freelibrary the dll, some CStatic and CEdit objects not valid, their m_hWnd becomes to NULL How can I restore these CWnd objects? Is OS release them thanks, waiting onlin ...

Bottom tool bar that lets you toggle from page to page is gone..
I am missing the bottom page number tool bar that lets you toggle from page to page on the publication quickly. Any suggestions on how to get it back? View | Status Bar ? "mort" <mort@discussions.microsoft.com> wrote in message = news:AE65B3F4-3B74-47B3-B775-D6B06C541802@microsoft.com... | I am missing the bottom page number tool bar that lets you toggle from = page=20 | to page on the publication quickly. Any suggestions on how to get it = back? View | Toolbars | Status Bar "mort" <mort@discussions.microsoft.com> wrote in message = news:AE65B3F4-3B74-47B...

Can my manager get meeting notices that I accept?
I accept meeting notices for my manager, however she is not getting the notices when I do this. Is there a way in Outlook for her to get notifications in her Inbox when I accept meetings on her behalf. I've done this in the past for others, but was never informed or aware that they did not receive notification. I always thought they did. HELP. It's set on the Delegates tab in the manager's outlook. -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com/ Outlook Tips by ...

Control Overlapping...
Hello, I am developing a propertysheet with some propertypages on it. In one page I have a Static text control which covers the whole portion of the Page. Also I want to put Two combo Boxes on that page. when I put the combo box and run my application, I could not see the combo box. How do I bring the combo box up (similar to Bring to front/Send to Back command in VB 6.0 !) Thanks in Advance!! Please send me the solution quickly. Thanks, Bhushan If you're using the resource editor you can use the Layout menu. I think the specific command is the same as in the VB editor. Othe...

Auto Accept Agent
I'm trying to Unregister a non-existing mailbox from the AutoAcceptAgent Event. The mailbox was removed from the system, but still shows up in the list of registered mailboxes. Any ideas where this information is stored? The Unregistration procedure queries AD for the primary email address to find the matching object (through the mail attribute) but can't find it :) ...

Tree control
I need a tree control for my application and have read some sample code, and all the sample code choose CTreeView as base class. My trouble is after I created a tree control Resource in Dialog and when I tried to create a class for the control, CTreeView is not among the base class list. If I chose CFormView instead and added the OnInitialUpdate and OnUpdate from sample code, my code passed the compling, but always stoped for Assert error when I run it. Appreciate for any suggestion. Rich Scott, thanks a lot for your response. I did as you said and got into another problem: I have to ...

Locked controls in a form
I have a datasheet form, that is on a tabcontrol, that has 3 controls ActionDate (Default value is Date())and ActionTime Default value is Time()) and Action Log (which is a text box). All the controls have their their locked property set to Yes. I also have this code in the OnCurrent Event of the form: Private Sub Form_Current() If Me.NewRecord Then Me.Action_Date.Locked = False Else Me.Action_Date.Locked = True End If If Me.NewRecord Then Me.Action_Time = False Else Me.Action_Time.Locked = True End If If Me.NewRecord Then Me....