Windows API: Edit Control
Nokompilējot un palaižot sekojošo kodu, es iegūstu logu ar edit logu, kurā neko nevar ierakstīt, bet var iezīmēt un izdzēst esošo tekstu ar Del un pārvietot kursoru. Copy, paste nestrādā. WTF!
#include <windows.h>
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if (message == WM_CLOSE) PostQuitMessage(0);
return DefWindowProc(hwnd, message, wParam, lParam);
}
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, char* cmdParam, int cmdShow)
{
WNDCLASS wndClass;
wndClass.style = 0;
wndClass.lpfnWndProc = WndProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0;
wndClass.hInstance = hInst;
wndClass.hIcon = 0;
wndClass.hCursor = LoadCursor(0, IDC_ARROW);
wndClass.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
wndClass.lpszMenuName = 0;
wndClass.lpszClassName = "Window";
RegisterClass(&wndClass);
HWND hwnd = CreateWindow("Window", "Window", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 100, 100, 400, 300, 0, 0, hInst, 0);
CreateWindow("EDIT", "Lorem ipsum.", WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL, 10, 10, 300, 200, hwnd, 0, hInst, 0);
MSG msg;
while (GetMessage(&msg, 0, 0, 0)) DispatchMessage(&msg);
return (int) msg.wParam;
}