First, forget all you've learned about windows (the kind you see on your screen) from Windows (the operating system by MS).
The buttons on the window are not created by your program, they are created by a separate program called the "window manager", which puts its own window between the root window and top-level windows, and draws whatever it wants there (many Linux window managers don't have the Windows-style min/max/close buttons, at least by default).
Also, every GUI control is actually a child window of your top-level window.
The window manager doesn't mess with your top-level window's child windows.
Wikipedia's article on Xlib has a good example to get you started.
Here are some good resources, too:
Xlib reference: http://tronche.com/gui/x/xlib/
The Xlib Programming Manual: http://www.sbin.org/doc/Xlib/