How to show in pop up box message in D7
There are several modules that you may be able to use or deconstruct to help with your custom module.  


Popup (D7)
Lightbox2 (D6, D7)
Shadowbox (D5, D6, D7)
Popups (AJAX) (D6)