The benefit of both of these functions is that they'll always return the correct icons regardless of the current version of Windows. NET Framework in the identically-named MessageBox class. As before, this has already been wrapped for you by the. Tell Windows the MB_ICON value that you want, and you're off. NET wrapper that saves you from having to P/Invoke the LoadIcon function from the Windows API yourself.īetter yet, if you just want to display a message box containing one of the icons, all you have to do is call the MessageBox API function. Since you mention that you're using VB.NET, you can also use the SystemIcons class, which has static properties to return any of the common icons. Windows will return an HICON value, or a handle to an icon resource. The nice way of asking is to use the LoadIcon function, and specify the IDI identifier of the icon you want. Windows will already retrieve them for you, if you ask nicely. There's absolutely no reason to go through the effort trying to extract them, either. As I mentioned in a comment to another answer, the ID numbers are undocumented for a reason: namely because it's possible for them to change in future versions of Windows or even in future Windows updates. They're included with a couple of the system DLL files, but you shouldn't try and extract them dynamically yourself. The standard Windows message box icons have changed many times across the various versions of Windows.
0 Comments
Leave a Reply. |