Edit Nope, realised I misread that, your use of Nmsgs looks right and as per the example for imap_check and imap_fetch_overview... I'll ponder it some more.
To clarify, the examples and related docs:
So you're trying to reference(->) a valid object variable(Nmsgs) in the 1 to number of messages
portion of the string you're building and passing to imap_fetch_overview().
The "File does not exist: C:/xampp/htdocs/announce" error seems unrelated.