I want to create two textboxes on my window. I used this code
case WM_CREATE:

 hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("edit"), TEXT("sending"),
    WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER | ES_LEFT,
    15, 15, 200, 300, hwnd, NULL, NULL, NULL);

    hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("edit"), TEXT("Receiving"),
        WS_CHILD | WS_VISIBLE | WS_BORDER,
        220, 15, 100, 300, hwnd, NULL, NULL, NULL);
    break;

    It shows only one window.
    What is the problem?

What happens if you don't try to use the same pointer (i.e. don't use hwnd twice)?

Most likely because you are using the same hwnd variable for both.

I used different hwnd, but result is same.

This works for me. Notice I had to change hwnd parameter in CreateWindowEx()

HWND txtBox1 = NULL, txtBox2 = NULL;
...
...
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    int wmId, wmEvent;
    PAINTSTRUCT ps;
    HDC hdc;

    switch (message)
    {
    case WM_CREATE:
            txtBox1 = CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("edit"), TEXT("sending"),
                WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER | ES_LEFT,
                15, 15, 200, 300, hWnd, NULL, NULL, NULL);

            txtBox2  = CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("edit"), TEXT("Receiving"),
                WS_CHILD | WS_VISIBLE | WS_BORDER,
                220, 15, 100, 300, hWnd, NULL, NULL, NULL);
            break;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.