When I use theSendMessage function with HWND_BROADCAST, the application hangs up. There is no response from the application for long time.
There is at least one process out there that has a message pump but isn't pumping messages. SendMessage doesn't return until all receivers have processed the message... so it doesn't return. You can try using SendMessageTimeout instead to get around this.
Incidentally, this is why launching a process and waiting on its process handle can be fraught with problems. I describe this on my website here.