i suppose you can postmessage a WM_CLOSE to it. You can use Spy++ to find out what classname notepad uses.