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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
//I create a global object of 'c' above main
case WM_CREATE:
{
//Edit_Control_IN
hwndEditIn = CreateWindowEx( 0, L"EDIT",
NULL,
WS_CHILD | WS_VISIBLE |
ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL,
eCenterX,
ePosY,
eWidth,
eHeight,
hWnd,
(HMENU) ID_EDITBOX_IN,
(HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),
NULL);
// Add text to the window.
SendMessage(hwndEditIn, WM_SETTEXT, 0, (LPARAM) inText);
//Edit_Control_OUT
HWND hwndEditOut = CreateWindowEx( 0, L"EDIT",
NULL,
WS_CHILD | WS_VISIBLE | ES_READONLY |
ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL,
eCenterX,
ePosY + ( eHeight + 30 ),
eWidth,
eHeight,
hWnd,
(HMENU) ID_EDITBOX_OUT,
(HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),
NULL);
// Add text to the window.
SendMessage(hwndEditOut, WM_SETTEXT, 0, (LPARAM)outText );
c.setCharCount( szMessage - Edit_GetTextLength( hwndEditIn ) );
break;
}
case WM_COMMAND:
{
switch(LOWORD(wParam))
{
//buttons
case IDC_QUIT_BUTTON:
{
PostQuitMessage(0);
break;
}
//edit control
case ID_EDITBOX_IN:
{
c.setCharCount( szMessage - Edit_GetTextLength( hwndEditIn ) );
//redraw the window
InvalidateRect( hWnd, NULL, true );
break;
}
}
break;
}
| |