Click here to Skip to main content
15,903,540 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how can i get the ip of my system Pin
ThatsAlok16-Dec-05 21:52
ThatsAlok16-Dec-05 21:52 
Questiondirectshow sdk Pin
dolph_loe16-Dec-05 20:56
dolph_loe16-Dec-05 20:56 
AnswerRe: directshow sdk Pin
Farhat Aisha18-Dec-05 3:18
Farhat Aisha18-Dec-05 3:18 
QuestionListCtrl / gridcontrol containing tree control in VC++ Pin
doubts.vc16-Dec-05 20:16
doubts.vc16-Dec-05 20:16 
AnswerRe: ListCtrl / gridcontrol containing tree control in VC++ Pin
Ravi Bhavnani17-Dec-05 3:24
professionalRavi Bhavnani17-Dec-05 3:24 
GeneralRe: ListCtrl / gridcontrol containing tree control in VC++ Pin
doubts.vc20-Dec-05 16:43
doubts.vc20-Dec-05 16:43 
QuestionSome problem facing when using Direct show for streaming media Pin
StarMeteor16-Dec-05 19:17
StarMeteor16-Dec-05 19:17 
QuestionSending text to chat via Edit Pin
tansey416-Dec-05 17:53
tansey416-Dec-05 17:53 
I have a 3rd party program which contains a chat area. I am trying to create a function which sends a message to that chat. I have the handle to the parent window and the handle to the Edit window where you type. I am not having any trouble setting the text in the Edit window, my issue is sending the text. All I want to do is be able to send the box a simulated Return key press, but I'm having a lot of issues with it and can't seem to get it to work.

I spied the window and when a real Return is pressed, it generates two messages:

P WM_KEYDOWN nVirtKey:VK_RETURN cRepeat:1 ScanCode:1C fExtended: 0 fAltDown: 0 fRepeat: 0 fUp: 0<br />
<br />
P WM_KEYUP nVirtKey:VK_RETURN cRepeat:1 ScanCode:1C fExtended: 0 fAltDown: 0 fRepeat:1 fUp:1<br />

For KEYDOWN, the parameters are:
wParam: 0000000D
lParam: 001C0001

For KEYUP, the parameters are:
wParam: 0000000D
lParam: C01C0001

Given all this information, my current function looks like:
<br />
void say( const char* toSay )<br />
{<br />
    HWND tempa = SetActiveWindow( hwnd );<br />
	HWND tempw = SetFocus( chatBox );<br />
	Sleep(500);<br />
	SendMessage( chatBox, WM_SETTEXT, (WPARAM)0, (LPARAM)toSay );<br />
	Sleep(1000);<br />
	PostMessage( chatBox, WM_KEYDOWN, VK_RETURN, 0x001C0001 );<br />
	Sleep(2000);<br />
	PostMessage( chatBox, WM_KEYUP, VK_RETURN, 0xC01C0001 );<br />
	Sleep(2000);<br />
	SetFocus( tempw );<br />
	SetActiveWindow( tempa );<br />
}


I have had very little success with this method. It will sometimes send the first message it gets but then will no longer send anything. It seems like this should be much simpler, as I'm sure it's a common need. Any help is greatly appreciated.
AnswerRe: Sending text to chat via Edit Pin
VikramDelhi16-Dec-05 20:29
VikramDelhi16-Dec-05 20:29 
GeneralRe: Sending text to chat via Edit Pin
tansey416-Dec-05 21:43
tansey416-Dec-05 21:43 
QuestionDestroying the window Pin
chethu66516-Dec-05 17:06
chethu66516-Dec-05 17:06 
Questiondrawing HICON Pin
T1TAN16-Dec-05 15:29
T1TAN16-Dec-05 15:29 
AnswerRe: drawing HICON Pin
PJ Arends16-Dec-05 17:15
professionalPJ Arends16-Dec-05 17:15 
GeneralRe: drawing HICON Pin
T1TAN17-Dec-05 13:11
T1TAN17-Dec-05 13:11 
QuestionSetting hi and low-order words Pin
Alex Orovetskiy16-Dec-05 11:23
Alex Orovetskiy16-Dec-05 11:23 
AnswerRe: Setting hi and low-order words Pin
Nish Nishant16-Dec-05 11:27
sitebuilderNish Nishant16-Dec-05 11:27 
GeneralRe: Setting hi and low-order words Pin
Alex Orovetskiy16-Dec-05 11:40
Alex Orovetskiy16-Dec-05 11:40 
AnswerRe: Setting hi and low-order words Pin
Jörgen Sigvardsson16-Dec-05 12:23
Jörgen Sigvardsson16-Dec-05 12:23 
GeneralRe: Setting hi and low-order words Pin
Alex Orovetskiy16-Dec-05 21:46
Alex Orovetskiy16-Dec-05 21:46 
AnswerRe: Setting hi and low-order words Pin
ThatsAlok16-Dec-05 21:54
ThatsAlok16-Dec-05 21:54 
QuestionWriteFile hangs Pin
dave siegfried16-Dec-05 10:12
dave siegfried16-Dec-05 10:12 
QuestionRe: WriteFile hangs Pin
David Crow16-Dec-05 14:55
David Crow16-Dec-05 14:55 
Question#pragma once, #ifndef problem Pin
werfel16-Dec-05 10:06
werfel16-Dec-05 10:06 
AnswerRe: #pragma once, #ifndef problem Pin
Maximilien16-Dec-05 10:12
Maximilien16-Dec-05 10:12 
GeneralRe: #pragma once, #ifndef problem Pin
werfel16-Dec-05 10:17
werfel16-Dec-05 10:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.