-
October 21st, 2008, 07:32 AM
#1
Caret & WM_CHAR
1-> i am trying to add a caret on child window(not on typical class)
but cann't create the reason is i cant get focus on child window even if i create without having focus it doesnt show up.
2-> i added a WM_CHAR message in child windows message handler function. the problem is when i press first character it change the mouse cursor with hourglass. if i move the mouse mouse cursor came back to normal. but message does not processed. in this situation if i press 'Alt' window message is processed.
[block]
LPRESULT __stdcall ChildWndProc(HWND,UINT msg,WPARAM,LPARAM)
{
switch(msg)
{
case WM_CHAR:
MessageBox(NULL,TEXT("Message"),TEXT("Caption"),MB_OK);
return 0;
}
return 0;
}
[/block]
can any one tell me what is wrong with the program
-
October 22nd, 2008, 11:13 AM
#2
Re: Caret & WM_CHAR
i cant get focus on child window
Are you using SetFocus() with a correct handle?
if i create without having focus it doesnt show up.
What is "it"?
Your piece of code looks all right to me. The problem should reside elsewhere.
For your other questions, it is difficult to give an answer without seeing your source code.
N.B. Use [code] and [/code] instead of [block] and [/block]. Write a capital letter at the start of your sentences. Write "I" instead of "i". Write "can't" or "cannot" instead of "cann't".
-
October 23rd, 2008, 12:49 AM
#3
Re: Caret & WM_CHAR
Originally Posted by olivthill
Are you using SetFocus() with a correct handle?
What is "it"?
Your piece of code looks all right to me. The problem should reside elsewhere.
For your other questions, it is difficult to give an answer without seeing your source code.
N.B. Use [code] and [/code] instead of [block] and [/block]. Write a capital letter at the start of your sentences. Write "I" instead of "i". Write "can't" or "cannot" instead of "cann't".
the problem is not with setfocus. the problem is more disgusting but not complicated.
the problem is
I have created a window as a child then I wanted to create a caret on the child window.
The policy of creating caret is programmer will create caret when the winow will get focus. but my child window never get focus.
even if i Call SetFocus then the WM_KILLFOCUS is called and focus is lost and also the caret get destroyed
Last edited by johny_1015_1981; October 23rd, 2008 at 12:57 AM.
-
October 23rd, 2008, 04:35 AM
#4
Re: Caret & WM_CHAR
I presume you are talking about the cursor (the hourglass or the arrow) and not about the caret (a blinking bar in an edit control).
The policy of creating caret is programmer will create caret when the winow will get focus.
Are you sure? Usually, the cursor is the one that is chosen when the class of your window is registered. You can change it later with SetCursor() and ShowCursor().
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|