1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| #include "stdafx.h"
#include "dynamicServer.h"
extern SOCKET sock;
extern HWND hEdit1, hEdit2;
extern HWND hEditOut;
extern HINSTANCE hInst;
extern char sending[];
extern HWND hwnd1, hwnd2;
extern char buffer[5];
extern char message[255];
extern int i;
LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_CREATE:
{
hEdit1 = CreateWindow("edit", "Tappez votre message ici, puis faites Fichier/Envoyer.", WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL, 0, 0, 0, 0, hwnd, NULL, hInst, NULL);
hEdit2 = CreateWindow("edit", "", WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL, 0, 0, 0, 0, hwnd, NULL, hInst, NULL);
return 0;
}
case WM_SIZE:
{
MoveWindow(hEdit1, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
MoveWindow(hEdit2, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
return 0;
}
case WM_DESTROY:
{
PostQuitMessage(0);
return 0;
}
case WM_COMMAND:
{
if((LOWORD(wParam)) == IDM_SEND){
int lengh = GetWindowText(hEdit1, sending, (MSGMAXSIZE-2));
sending[lengh]='\n';
lengh++;
sending[lengh]='\0';
send(csock, sending, lengh, 0);
}
}
default:
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
} |
Partager