Not sure if this is a sock problem or a windows problem. Have two programs. 1 server and 1 client. Run both. Client
connects to server fine. Client has edit box. Text is placed in edit box and hit send button. Here is problem. Only 4
characters are transmitted or written to the server message box.
Code:
case CLIENT_BUTTON_SEND:
{
GetWindowText(Client_Edit_Message, Buffer, sizeof(Buffer));
SendtoServer(Buffer);
break;
}
char Buffer[50];
Here is server listen
Code:
void ReceivefromClient()
{
char ReceiveBuffer[50];
while (bRunning)
{
if (!bClient)
continue;
if (recv(Client, ReceiveBuffer, sizeof(ReceiveBuffer), 0) == SOCKET_ERROR)
continue;
MessageBox(NULL, ReceiveBuffer, "Message", MB_OK); //Message Received
}
}
Here is second question kind of related. When I use MDI child edit window in function what is the best way to set it
up? First problem is when I make funcion I have to pass HWND hwnd and everything to funcion because it goes out of
scope. Second consern is do I pass the drawtext() or settext() to the MDIchild edit control or directly to MDI child
window?
Code:
int testfunction(HWND hwnd) What else should be passed here? hMDIclient? hEdit? (plus pointer to message)
{
char childedittext[222];
char joinedtext[222];
childedittext = getwindowtext(...hchildedit , text , sizeof(text) ...
// do something with text...
// this example add passed message to mdichildedit text
joinedtext = strcat( childedittext , message );
// will do other things with function like add more text to child window
drawtext(hMDIclient, &joinedtext , sizeof(joinedtext)... ); // or use hEdit to send text to edit control?
updatewindow()
}
...
LRESULT CALLBACK MDIChildWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
...
}
break;
case WM_COMMAND:
switch(LOWORD(wParam))
{
...
case ID_MENUITEM1:
testfunction("pass this text to addon to edit child window existing text");
}
break;
...
The above code may not be correct or functional it is just to give you idea of what I am trying to do. I did look for
other related threads to no avail. Sadly the two above examples client and server are from ms library.
kat