Click here to Skip to main content
11,922,345 members (38,080 online)
Rate this:
Please Sign up or sign in to vote.
See more: Windows Application Web
Is Anyone tell me how to read Messagebox or AlertBox content in .net
I don't want HeaderText. I need Content of AlertBox or MessageBox.

Thank you in Advance
Posted 24-May-13 1:32am
Arun Vasu1.9K
Edited 28-May-13 2:31am
Prasad Khandekar 24-May-13 6:45am
Hello Arun,

You can use Windows API for this purpose. Please see this MSDN documentation ( Also look at the ManageSpy code sample ( or have a look at this link (

Arun Vasu 24-May-13 7:11am
i refer all site which you gave me.. but sorry.. i not find any exact solution
Prasad Khandekar 24-May-13 7:32am
What you are really trying to do is called screen scraping. The sites I referred contains information on how to do this. Basically AlerBox or a MessageBox are windows and you need to retrieve the text present in one of the labels of that window. The typical steps to do this are
1. Find the matching window (by say title)
2. Get a list of child controls
3. Go through each and get the text content if supported.

This is one more link (
ryanb31 28-May-13 9:01am
Can you explain why so that we can understand how to help properly?
Arun Vasu 31-May-13 1:23am
My need is:
I have one web application. After One process a page shows one message box, it may successfully inserted, or updated or its return guid() value or if any exception in process it will show in that application. My requirement is i want to read that message box content using that i need to take some action. for this i need the solutions.

ryanb31 31-May-13 7:33am
Are you sure it is an alert() from javascript? If so, you'll have to do what Prasad suggested, use the Windows API to get a handle on that window. I doubt that will be easy. Or, could it be a div that is displayed? Either way, it sounds like a hack to get this to work. Is there no other way to do it? You can't have the person who created the website create a webservice for you?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 493
1 Dave Kreskowiak 285
2 Sergey Alexandrovich Kryukov 243
3 Richard MacCutchan 155
4 ppolymorphe 135
0 OriginalGriff 7,231
1 KrunalRohit 4,530
2 Sergey Alexandrovich Kryukov 3,356
3 George Jonsson 2,865
4 Suvendu Shekhar Giri 2,216

Advertise | Privacy | Mobile
Web03 | 2.8.151120.1 | Last Updated 28 May 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100