Undeclared Functions in Dev-C++

How come this code returns errors in "case WM_CREATE" as seen below, and how would I fix those errors?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#define ID_BUTTON 1

/*  This function is called by the Windows function DispatchMessage()  */

LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)                  /* handle the messages */
    {
        case WM_CREATE:(
             CreateWindow(TEXT("Button"), Text("button"),
             WS_Child | WS_Visible,
             10,10,80,20,
             hwnd, (HMENU) ID_BUTTON, NULL, NULL
             );
             
             break;
             
             }
    
        case WM_DESTROY:
            PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
            break;
        default:                      /* for messages that we don't deal with */
            return DefWindowProc (hwnd, message, wParam, lParam);
    }


I am new to C++ and have some experience with HTML, Java, PHP, and Ruby. My terminology may be of so forgive me if you could. I am watching this tutorial video on creating buttons in a window using C++. I follow all the same steps as the video shows up to 4:47 (Video here: http://youtu.be/lDu-l4aU2Qw?t=4m47s). After he defines ID_Button 1 he compiles and runs the program, but I get these errors.

In function `LRESULT WindowProcedure(HWND__*, UINT, WPARAM, LPARAM)':
`Text' undeclared (first use this function)
`WS_Child' undeclared (first use this function)
`WS_Visible' undeclared (first use this function)
Last edited on
I did not watch the video, but no, none of that is standard C++. It's some Microsoft or Windows library code/variation thereof. If you're just learning C++, I do not suggest doing any operating system-dependent code, stick with standard stuff (it's probably easier to understand, too).

Edit: But if you still want to learn it this way and get help with the Windows stuff, I would suggest searching in the Windows Programming part of the forum. Searching the error messages on google usually gives good results, too.

(edit 2, I'm going to assume someone moved this thread to this section or I'm feeling quite dumb ;p)
Ah okay, good luck haha.
Last edited on
Thank you Ganado I will keep that in mind, thanks for the help.

Edit: No I did, I am in the middle of researching this issue and I thought moving the question here may produce results Ganado
Last edited on
Topic archived. No new replies allowed.