sending input to window
-
I've attached to another window's input by calling AttachThreadInput(). I'm now trying to send text, as follows: int size = strlen(text); for(int i=0; i
strlen return the number of characters excluding the null character at the end. You are sending one less than the number with your
'i<size'
. Change it toi<=size
and it should work as you want. -
strlen return the number of characters excluding the null character at the end. You are sending one less than the number with your
'i<size'
. Change it toi<=size
and it should work as you want.Nope, look at the following string: "hello" strlen returns 5, which means the following characters are sent: 0 - 'h' 1 - 'e' 2 - 'l' 3 - 'l' 4 - 'o' Besides if I send 2 string in a row still only the last character of the last string is ommitted, not the last characters of both strings.
-
I've attached to another window's input by calling AttachThreadInput(). I'm now trying to send text, as follows: int size = strlen(text); for(int i=0; i
Do you have control over the code receiving the WM_CHAR message? If not then I'm not sure how you could expect the receiver to handle system messages being forced to it without knowing what message it could currently be processing or its state or anything. It seems to me posting (not sending) WM_KEYDOWN and WM_KEYUP and letting the receiver translate the WM_KEYDOWNs to WM_CHAR messages may be safer. Mark
-
I've attached to another window's input by calling AttachThreadInput(). I'm now trying to send text, as follows: int size = strlen(text); for(int i=0; i
whenwood wrote:
SendMessage(inputHwnd, WM_CHAR, text[i], 0);
better use SendInput api!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you
-
I've attached to another window's input by calling AttachThreadInput(). I'm now trying to send text, as follows: int size = strlen(text); for(int i=0; i
-
WhiteSky wrote:
See SendInput[^]
humm copying me :)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you