COM is, uh, outside my area of expertise (come to think of it, so far
everything in VB is), and I dunno if it's close to what you need, but
here's how I bundled an icon into an executable and accessed it:
----------
1. Added the icon file to the solution.
2. Highlighted the icon in the Solution Explorer, and changed the Build
Action property to "Embedded Resource".
3. In a module, inserted a function to retrieve the icon:
Imports System.Reflecti on.Assembly
Public Function EmbeddedIcon(By Val Name as String) as Icon
Return New
Icon(GetExecuti ngAssembly.GetM anifestResource Stream(Name))
End Function
4. Elsewhere in the program, accessed the icon like so:
TrayIcon.Icon = EmbeddedIcon("< namespace>.<ico n-name>.ico")
----------
Obviously, or maybe not, <namespace> stands for the namespace, and
"<icon-name>.ico" stands for the file name of the icon I added in step
1. Apparently it's all case-sensitive, so be careful with that.
The procedure worked like a charm for me, but I'm a little
uncomfortable with it, because I got lucky in specifying the
namespace -- I just used the project name, and it was fine. I'm not
certain yet how multiple namespaces might be created and used in a
project.
Plenty to learn, plenty to learn...
Stephen Turner wrote in message...
I have implemented a COM object in .NET, and I simply
want to load an icon resource and pass back an
IPictureDisp to clients. What is the esiest way to do
this? I had used LoadResPicture in VB, but I havent been
able to create/load an icon resource in VB .NET. I'm
sure that this should be simple....by so far I am failing
miserably!
Any suggestions? The documentation babbles on and on
about .resx, .resource and silly little conversion
programs but doesn't really give any clear examples...