0

Where can I find the orginal vb6 ( or windows ) icon? (.ico files)

I need, error, warning, question, and information icons which come up on the messagebox.

Thanks a lot.

rlee923
  • 758
  • 3
  • 14
  • 28
  • 1
    What are you talking about? Do you want the default icon for a VB 6 application--the one that looks like a little form? Or are you looking for a Windows flag icon? Or are you looking for the VB 6 *code* to display a message box with the standard icons (error, warning, question, information)? – Cody Gray - on strike Jul 27 '11 at 09:08
  • I am making a custom messagebox form and vs 2008 and the client want it with old icons I have mentioned. – rlee923 Jul 28 '11 at 00:40
  • Thanks a lot for the downvote, is it wrong to ask where the icons are? – rlee923 Jul 28 '11 at 00:41
  • The tooltip on the downvote arrow says "This question does not show any research effort; it is unclear or not useful." I feel like my original comment quite clearly explained why I thought the question was unclear (and therefore not useful). My general policy is to remove such downvotes when the question is edited in response to my comments and what's being asked is clarified. This question needed a lot of help. But I don't take very kindly to whining about downvotes, and I don't think this question has actually been improved sufficiently, so I'll leave the -1 there. Thanks for playing. – Cody Gray - on strike Jul 28 '11 at 01:14
  • which part of the question is unclear? I don't understand your comment – rlee923 Jul 28 '11 at 01:18
  • your basically downvoting the question which asks for the location of .ico files wow thanks. – rlee923 Jul 28 '11 at 01:22
  • Yes, because the question doesn't make any sense. It also not a question. "I need..." is not how questions begin. Not sure why you're arguing with me about a downvote rather than figuring out how to solve the problem. I don't see anyone else jumping to answer this one either. At least one other person agreed with my initial comment that the question was unclear... – Cody Gray - on strike Jul 28 '11 at 01:24
  • The question begins with "where" not "I need ..." Also I do care just in case someone else are looking for it. Also the reason that I want to grab those is because I am using interop with vb6 and .NET so I am trying to make them uniform. You "could've" said that my question is unclear to you, instead, you just downvoted. – rlee923 Jul 28 '11 at 01:35
  • I'm trying really hard not to be offended here. I *did* say that! That's the very first comment I left on the question. And that's *precisely* what downvotes are intended to convey: that the question is either not clear or not useful. I didn't think (and still don't) that it is either clear or useful. You've been consistently more interested in whining about having received a downvote than you have been in clarifying the question. It's not until the *5th* comment that you finally get around to mentioning important details about interop with VB 6 & .NET. That should have been there all along. – Cody Gray - on strike Jul 28 '11 at 01:40
  • mentioning vb6 and .net doesn't not change what I was looking for. I don't see it why that changes the question. Feel free to downvote and keep it that way if you think it's unclear and/or not useful but it doesn't change the question. – rlee923 Jul 28 '11 at 01:59

2 Answers2

2

As the icons can differ for each OS version, you can get the icons from Windows using LoadIcon() passing one of the standard icon IDs.
See http://msdn.microsoft.com/en-us/library/ms648072.aspx for details.
If you want them as .ico files, you can extract them (on your development machine) from user32.dll using a resource editor.

(Updated with corrected info from Cody Gray)

Deanna
  • 23,876
  • 7
  • 71
  • 156
  • 1
    No, no, no, no. Don't do this. Not only is it not necessarily legal, it's extremely likely to break on future versions of Windows. There's no guarantee that the icons will always have the same resource ID even across *service packs*, much less full releases. There's an API *specifically* for this purpose. It's conveniently named the [`LoadIcon` function](http://msdn.microsoft.com/en-us/library/ms648072.aspx), and you pass in the identifier of the system icon that you want to load. All of the standard ones are available. Of course, this is even easier in VB than calling a Win32 API function. – Cody Gray - on strike Jul 27 '11 at 09:31
  • Ah yeah, I'd forgotton those. If you want to do a fuller answer, I can delete mine (or just update it). Thanks. – Deanna Jul 27 '11 at 09:49
  • I'm still waiting to hear back from the asker on what the actual question is here. Updating your answer is cool with me. – Cody Gray - on strike Jul 27 '11 at 09:51
2

The standard Windows message box icons have changed many times across the various versions of Windows. They're included with a couple of the system DLL files, but you shouldn't try and extract them dynamically yourself. 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. There's absolutely no reason to go through the effort trying to extract them, either. Windows will already retrieve them for you, if you ask nicely.

The nice way of asking is to use the LoadIcon function, and specify the IDI identifier of the icon you want. Windows will return an HICON value, or a handle to an icon resource.

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. This is a .NET wrapper that saves you from having to P/Invoke the LoadIcon function from the Windows API yourself.

Better 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. Tell Windows the MB_ICON value that you want, and you're off. As before, this has already been wrapped for you by the .NET Framework in the identically-named MessageBox class.

The benefit of both of these functions is that they'll always return the correct icons regardless of the current version of Windows. A comment made attempting to clarify the question seems to suggest that you want to use the old icons on a current version of Windows. But of course, you do not want to do this. The icons have been updated throughout the Windows shell for a good reason, and your application should take advantage of them. The new icons are more clear and fit in better with the overall system theme. Additionally, if your app still uses the old icons, it will be confusing to users and look very out of place. It's always best to follow standard platform conventions, rather than trying to do "something else", even if you think your "something else" is "better" for whatever reason than the platform default. Your users will not agree, and your application will reflect your shoddy craftsmanship.

Since people who ask this type of question inevitably disagree with me and insist that they must do it anyway, and that it is a "requirement" (whatever that means), I'll point out that the old icons are not available in the newer versions of Windows. The icons have been completely replaced throughout the system for a reason. It's also strictly forbidden by the licensing agreements to extract icons from system DLL files and redistribute them with your application. Don't do this.

Also, before deciding on which icon you should display in your message box, be sure to consult Microsoft's Windows User Experience Interaction Guidelines, which provide some very handy rules on selecting the proper icon to convey the right message and fit with the Windows tone. I provide more information on that in my answer here; very much recommended reading for any Windows application developer.

Edit: It's like pulling teeth to get any more details on this question. I'm not sure why you're so secretive about what you're trying to accomplish, but note that in the future, you'll have a lot better luck including these things in your question to start with, rather than hoping people will pull it out of you. Most people aren't nearly as persistent as I am.

Anyway, you finally mention that you're doing some type of interop between VB 6 code and .NET code. That should not be relevant in the case of the message box icons used. The VB 6 MsgBox function is 100% equivalent to the Win32 API MessageBox function and the .NET MessageBox class that I discussed earlier. All of them are going to use the current system icons, and it shouldn't require any extra work to make them look the same. Ensure that you've passed the same icon specifier to all of the functions. Here's a table for convenience:

VB 6 "MsgBox" Icon Constant | VB.NET "MessageBox" Icon Identifier
---------------------------------------------------------------------------------
vbCritical                  | MessageBoxIcon.Error                
vbQuestion                  | MessageBoxIcon.Question  (DEPRECATED -- do not use)
vbExclamation               | MessageBoxIcon.Warning
vbInformation               | MessageBoxIcon.Information

Note that the "Question" style icon has since been deprecated and you should not use this value. If you're still using it in the VB 6 code, you should change that code to use a different icon (or no icon at all). The above-linked Windows User Experience Interaction Guidelines provide more details on why this icon has been deprecated and how to choose a suitable replacement.

Community
  • 1
  • 1
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
  • i don't quite understand which bit I am being secretive. All I wanted to do is get the icons to the look the same throughout the whole application since the app starts off with vb6 and launches .net Tabs. Hopefully you understand what I was going for now. And again, still doesn't change what I initially was going for. – rlee923 Jun 14 '12 at 07:04