Alert Windows

Does anyone know if an Alert Window / Dialog, has a particular style or something that defines it as an alert. I am trying to detect and generate errors based of alerts that appear during an automated test cycle.

Thanks in advance.

P.S. I have used SPY++ and other tools but have found that not only Alerts have the DS_* styles, Also i am not scared of C++ so samples in C, C++, C# and any of the VB's out there would be welcome

The first part of the messagebox call is the hwnd parameter, but that's not important for this purpose. The second and third parts are obvious. The forth parameter sets how it will display. There are several options you can use here, and I'll give a brief list:

Choose one of the following to set the available buttons:
MB_OKCANCEL, MB_OK, MB_ABORTRETRYIGNORE, MB_RETRYCANCEL, MB_YESNO, MB_YESNOCANCEL

Choose one or none of the following to set the icon:
MB_ICONEXCLAIMATION, MB_ICONWARNING (Exclaimation point)
MB_ICONINFORMATION, MB_ICONASTERISK (i in a Bubble)
MB_ICONQUESTION (? in a bubble)
MB_ICONSTOP, MB_ICONERROR, MB_ICONHAND (white x in red circle)

Choose one or none of the following to specify default button:
MB_DEFBUTTON1, MB_DEFBUTTON2, MB_DEFBUTTON3, MB_DEFBUTTON4

Thanks

Thanks for the reply but i know that they are created using MessageBox ( ... ); I just wanted to know if there were any styles specific to the ones that windows comes up with. For example a C# Checkbox has an extended style of 0x0000000B, I would be greatful if anyone out there has any ideas

The combinations of styles I posted above is pretty much what's available. If you want to know the value of each item (ie, what value would MB_YESNO|MB_ICONASTERISK be) I suggest writing some code to assign the values to an integer and output the results, but you're really better off just using the names.

There are plenty of message box styles.
Just look in winuser.h for a list (or just ask MSVC to take you to the definition of MB_OK.)

The style I think you are talking about is MB_APPLMODAL or MB_SYSTEMMODAL which do not allow any other actions until the messgebox is dealt with.

The essence of Christianity is told us in the Garden of Eden history. The fruit that was forbidden was on the Tree of Knowledge. The subtext is, All the suffering you have is because you wanted to find out what was going on. You could be in the Garden of Eden if you had just kept your f***ing mouth shut and hadn't asked any questions.