Program not closing

This is a discussion on Program not closing within the C++ Programming forums, part of the General Programming Boards category; I've got this tiny little program that's intended to do nothing but power off my monitor.
Code:
#include <Windows.h>
int ...

It works, as in it compiles and when I double-click on the exe file, my monitor turns off but the computer stays on. The problem is, when I move my mouse or press a button to turn the monitor back on, there's a black console window in the middle of the screen that I have to manually close. What I would expect to happen is that the program runs, shutting off the monitor, and then exits. That doesn't seem to be happening.

Sends the specified message to a window or windows. The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message.

To send a message and return immediately, use the SendMessageCallback or SendNotifyMessage function. To post a message to a thread's message queue and return immediately, use the PostMessage or PostThreadMessage function.

It could be that you don't have control back yet in your program for it to exit. Here is the MSDN link.

I suppose it could also be visual studio's implicit inclusion of it's system("pause") like code. Is the console window blank or does it say something like "Press any key to continue"?
You could also try adding some text output after the SendMessage call to see if your programs gets that far.
And if you dont want the console window at all you can change your project type from console application to win32 application.
All this assuming you are using visual studio..