Quick VB 2008 question: get rid of message box

I’m kind of embarrassed to admit I don’t know how to do this, but…

I’m writing a little commandline app in VB Express 2008 to reconnect my machine to various network drives using net use. It works fine, but I want the program to execute seamlessly, which means getting rid of the message boxes saying “13176”, “8364” and the like that pop up when net use completes an action. How do I programatically close these out once they appear? Basically, I’m looking for the VB equivalent of manually pressing “OK”.

If my track record in asking programming questions is any indication, I will now remember the answer in the next five minutes, :smack: myself, and return to say “never mind”. In the meantime, though, your help is appreciated!

I may be missing something, as I’ve largely worked on ASP.Net and not much Windows programming since .Net arrived, but I’m pretty sure there’s nothing in the .Net framework for this. You’re still going to be stuck going to the Windows API, enumerating windows to find the window handle of the dialog box you want to close, and using a SendMessage to put a mouse click into that window’s message queue. Google searches on “vb.net sendmessage”, “vb.net enumwindows”, and “vb.net findwindow” seem to turn up relevant results.