Tzu ng
Tzu ng

Reputation: 9234

Win32 API - Create Button help

I try to create 2 buttons inside my app

case WM_CREATE:{
    hWnd =CreateWindowEx(NULL,
            L"BUTTON",
            L"Giai PTB2",
            WS_TABSTOP|WS_VISIBLE|
            WS_CHILD|BS_DEFPUSHBUTTON,
            100,
            100,
            100,
            24,
            hWnd,
            (HMENU)IDC_PTB2_BUTTON,
            hInst,
            NULL);
    HWND hWndNew =CreateWindowEx(NULL,
            L"BUTTON",
            L"Tim max",
            WS_TABSTOP|WS_VISIBLE|
            WS_CHILD|BS_DEFPUSHBUTTON,
            200,
            200,
            100,
            100,
            hWnd,
            (HMENU)IDC_PTB2_BUTTON2,
            hInst,
            NULL);
    break;
               }

The problem is , only "Giai PTB2" button shows :) Thanks first :)

Upvotes: 0

Views: 10870

Answers (1)

Luca Rocchi
Luca Rocchi

Reputation: 6464

check hWnd .. you are changing is value by the first create the side effect is that you are passing the first button as parent of the second ...

Upvotes: 3

Related Questions