473,545 Members | 2,639 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Icons in VB

Hi,

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...
Nov 20 '05 #1
2 3312
Hi Stephen,

There's a forum on VS .NET add-ins:

http://groups.yahoo.com/groups/vsnetaddin

and there has been a topic recently where a multi-purpose class doing this
..NET <-> IPictureDisp translation was discussed. You could also conduct a
search on "IPictureDi sp" in this forum - as I have also seen other postings
on the same topic.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Stephen Turner" <st*****@symyx. com> wrote in message
news:09******** *************** *****@phx.gbl.. .
Hi,

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...


Nov 20 '05 #2
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...

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2423
by: drum118 | last post by:
Has anyone experience problems with firewall blocking some icons and not others. I am using Zone alarm and have the popup set for medium and it was blocking some of the icons for some strange reason that I have not seen before. Any reason why they are been blocked as well not showing up on view source as I am at a lost?
24
3782
by: Crom | last post by:
Ok. I want to settle this once and for all. After looking at the source for various, rather sizeable (but not all were so big) web sites that use icons that show up in the addressbar beside the address itself. Just about all websites that use said icons use one of these two methods (some use both even) to make them appear (in the code of a...
3
3184
by: sto | last post by:
look at this picture http://upload.cs99.net/e.gif i use the function SHGetFileInfo to get file icons. but these icons are not very nice. there are some black things round of the icons. many applications use system icons for files. how did their programmers solve this problem in these apps?
6
2351
by: B-Dog | last post by:
Does anyone know where I can find some professional looking icons that are the standard windows collection for developers? The ones that came on the VS cd are pretty lame. Thanks
17
14661
by: Brett | last post by:
I'd like references on where to find some good (quality) icons to use for form and application icons (for the EXE). Most of the free stuff isn't that great looking and there isn't a good selection. A site offering previews of icons or purchase of a single icon would be nice. Thanks, Brett
2
3428
by: SharpCoderMP | last post by:
i'm trying to embed multiple program icons in my executable. the only way so far i managed to do that is to embed native win32 resource file with multiple icons. it works, but... when i create a native win32 resource file with the VS 2005 and put there my icons, VS always converts some of the 32bit icons into 24bit - so i loose alpha blending...
3
3942
by: Pucca | last post by:
HI, I'm using vs2005. There are very few icons I found in the folder of vs2005imagelibrary under the install folder of vs2005. Does anyone know where I can download icons that are typically used in the toolstripmenu? Icons like exit, copy, back and forward arrow..... Also, can I use all these icons in my application? -- Thanks.
1
5084
by: Jon Slaughter | last post by:
I'm trying to create a windows explorer like app and the problem I'm having is getting the proper icon for the folders and items. In windows explorer there are many different icons and most seem to be in the shell32.dll. The problem is that there also seems to be custom icons that are installed by applications. For example, "My Music" In...
6
2026
by: Ronald S. Cook | last post by:
We're creating an Outlook-style Windows app that will have icons in it. I was just wondering if there was a Microsoft product that I could use to create icons. I'm not a graphics person but I have an MSDN subscription so I can get most Microsoft software. I was going to see how far I could get. Thanks, Ron
4
2445
by: Sanoski | last post by:
This might be a dumb question. I don't know. I'm new to all this. How do you find icons for your programs? All GUI applications have cool icons that represent various things. For instance, to save is often represented as a disk, etc. You know, the small little picture references that give meaning to the phrase 'Graphical User Interface'. But...
0
7425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7682
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7780
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6009
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5351
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5069
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3479
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1911
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1037
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.