Your code snippet:
HWND hwndbutton[2];
switch (message) /* handle the messages */
{
case WM_CREATE:
hwndbutton[0] = CreateWindow(TEXT("edit"),TEXT(""), WS_VISIBLE | WS_CHILD |
WS_BORDER,10,10,50,30, hwnd, (HMENU)11,0,0);
looks like it is inside a window procedure - first problem is that the value in hwndbutton[0] will be lost (it's on the stack) when the procedure is called again. You could, for example, make it static:
static HWND hwndbutton[2];
Tracing through your debugger should show you this.