Question

I've been googling for a while and I found nothing working for me so I'm here asking you folks this question.

I've already tried with SendMessage, SetWindowText and much more.

What I am trying to do is output a text in a textbox ( TEXT("edit") ... ). The messages I have to display are: "You win", "You lose" or "Draw".

What do you suggest me to do?

(I'm using DEV C++)

Thanks everybody!

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top