How to open a task manager in a windows application

Just do ctrl-shift-esc. This should open the task manager regardless of which application is running.

Or if you meant within a program you've written, you need to start taskmgr.exe. How this is done depends on the language you are using.