Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / September 2003

Tip: Looking for answers? Try searching our database.

Loading Icon Resource from Win32 DLL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tyler - 27 Sep 2003 16:23 GMT
Is there a nice way in the .NET framework to load an icon resource that is
embedded within a Win32 DLL?  I noticed that the SystemIcons class comes
close (it is probably invoking the same Win32 call I need to invoke), but
doesn't allow me to specify an icon name.

I have also looked at the Icon class, but it doesn't seem to have anything
to do what I want either.  I would like to avoid having to use interop to
get the HICON and the create an Icon class.

Thanks, Tyler
Herfried K. Wagner [MVP] - 27 Sep 2003 21:29 GMT
"Tyler" <Tyler@work.com> schrieb:
> Is there a nice way in the .NET framework to load an
> icon resource that is embedded within a Win32 DLL?  I
> noticed that the SystemIcons class comes close (it is
> probably invoking the same Win32 call I need to invoke), but
> doesn't allow me to specify an icon name.

There is nothing in the framework, but you will find a nice sample there:

<http://vbaccelerator.com/article.asp?id=4567>

Signature

Herfried K. Wagner
MVP ? VB Classic, VB.NET
<http://www.mvps.org/dotnet

Mattias Sj?gren - 27 Sep 2003 21:59 GMT
Tyler,

>Is there a nice way in the .NET framework to load an icon resource that is
>embedded within a Win32 DLL?

Not really, I think you have to call the ExtractIconEx Win32 API.

Mattias

Signature

Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.

Tyler - 29 Sep 2003 13:32 GMT
Thank-you very much for the assistance Herfried and Mattias.

Tyler

> Tyler,
>
[quoted text clipped - 4 lines]
>
> Mattias
Tyler - 30 Sep 2003 04:13 GMT
Do you know whether ownership of the HICON is taken over by the Bitmap class
when I do a Bitmap.FromHIcon or must I call DestroyIcon after creating a
bitmap from the Icon?  Is there anyway to tell that from the .NET
documentation?

Thanks again for your assistance, Tyler

> Tyler,
>
[quoted text clipped - 4 lines]
>
> Mattias
Ying-Shen Yu[MSFT] - 30 Sep 2003 07:47 GMT
HiTtyler,
    Thanks for using MSDN Newsgroup!
    Bitmap class just uses the Icon handle, it will not take the ownership
of that handle, so you need
destroy it by yourself.
If you have any further questions on this issue, pleaset le me know.
Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending, Thanks!

--------------------
| From: "Tyler" <Tyler@work.com>
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| References: <0Yhdb.148119$DZ.93851@news04.bloor.is.net.cable.rogers.com>
<Ou0$8oThDHA.1272@TK2MSFTNGP09.phx.gbl>
| Subject: Re: Loading Icon Resource from Win32 DLL
| Lines: 28
[quoted text clipped - 7 lines]
| X-Complaints-To: abuse@rogers.com
| X-Trace: news04.bloor.is.net.cable.rogers.com 1064891615 24.192.11.167
(Mon, 29 Sep 2003 23:13:35 EDT)
| NNTP-Posting-Date: Mon, 29 Sep 2003 23:13:35 EDT
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!news-out.cwix.com!newsfeed.cwix.co
m!cyclone01.bloor.is.net.cable.rogers.com!news04.bloor.is.net.cable.rogers.c
om.POSTED!not-for-mail
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:53426
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
[quoted text clipped - 14 lines]
| >
| > Mattias
Tyler - 30 Sep 2003 13:34 GMT
Thank-you very much for your assistance.

Tyler

> HiTtyler,
>      Thanks for using MSDN Newsgroup!
[quoted text clipped - 33 lines]
> | NNTP-Posting-Date: Mon, 29 Sep 2003 23:13:35 EDT
> | Path:

cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!news-out.cwix.com!newsfeed.cwix.co

m!cyclone01.bloor.is.net.cable.rogers.com!news04.bloor.is.net.cable.rogers.c
> om.POSTED!not-for-mail
> | Xref: cpmsftngxa06.phx.gbl
[quoted text clipped - 18 lines]
> | >
> | > Mattias

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.