You will want to read up on dbus, it's the mechanism by which these messages are shown. Basically your system is (should be) running a dbus daemon, waiting to receive messages from applications, and your application should connect to this system message bus and send it a message.
And as markkuk said, different toolkits have different API's for connecting and sending messages to this system messagebus. I once wrote an application in Qt that did this, part of which I have quickly turned into a small example. Don't ask complicated questions though, it's really been to long for me to remember the details about this, but it works! Just extract, run 'make', and then run the app. (Of course, you'll need gcc-c++ and qt-devel (and possibly others) installed.)