I am writing a screen capture application. I used the code mentioned on this link for the application.
Following is my entire code for your reference: