Maybe a stupid suggestion, but why not grabbing the unread email count directly from that Visual C++ program
using POP3?
Using a script in Plus! via Messenger to get the unread email count seems a bit like taking a serious detour. Of course, I dunno what that C++ program is or does....