tags:

views:

300

answers:

1

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 :)

+2  A: 

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 ...

luca
And by that creating the second button inside the first button. And also hWnd is probalby your handle for the main window. So you loose that handle and doing other things wrong too.
jpyllman
Thanks it does help :)
nXqd