Hi,
I created a new resouce ("app.resx") in my project and added an icon to
this resource with name "IL_ICON". I would like to use this resource
in some unmanaged code, in particular, with the api function
SHNotificationA dd. How can i do this?
i have tried using ResourceManager to get that icon, but i am getting
back NULL. Even if i did get back an icon, how can i use this to with
the hIcon parameter of SHNotificationA dd?
thank you much 6 7880
solve this by placing the resource in a dll and exporting a function in
that dll that returns the handle of the icon...
Hi this is a way of getting an Icon from an embedded resource, but don't
forget to set the ico's build action to embedded resource.
Dim p As System.Reflecti on.Assembly
p = System.Reflecti on.Assembly.Get ExecutingAssemb ly()
Dim ic As Icon
ic = New System.Drawing. Icon(p.GetManif estResourceStre am(Me.GetType() ,
"141_7.ico" ))
hth
Greetz Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.
<fa*****@optonl ine.net> schreef in bericht
news:11******** **************@ g43g2000cwa.goo glegroups.com.. . solve this by placing the resource in a dll and exporting a function in that dll that returns the handle of the icon...
<fa*****@optonl ine.net> schrieb: I created a new resouce ("app.resx") in my project and added an icon to this resource with name "IL_ICON". I would like to use this resource in some unmanaged code, in particular, with the api function SHNotificationA dd. How can i do this? i have tried using ResourceManager to get that icon, but i am getting back NULL. Even if i did get back an icon, how can i use this to with the hIcon parameter of SHNotificationA dd?
Add the icon file to your project and set its 'Build Action' property to
'Embedded Resource'. You can use the code below to load the icon at
runtime:
\\\
foo.Icon = _
New Icon( _
[Assembly].GetExecutingAs sembly().GetMan ifestResourceSt ream( _
"WindowsApplica tion1.Ball.ico" _
) _
)
///
'WindowsApplica tion1' is the root namespace of the application, "Ball.ico"
is the icon's filename. You can determine the icon's handle using its
'Handle' property.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
thank you for the response. i will try this. however, my issue is
getting a pointer to the icon in C# that can be used with
SHNotificationA dd. i have been able to get around this by including
the icon as a resource in a dll, and then exporting a function that
returns that icon pointer from that dll.
See my reply to your identical question in the C# group.
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
<fa*****@optonl ine.net> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. . thank you for the response. i will try this. however, my issue is getting a pointer to the icon in C# that can be used with SHNotificationA dd. i have been able to get around this by including the icon as a resource in a dll, and then exporting a function that returns that icon pointer from that dll.
<fa*****@optonl ine.net> schrieb: however, my issue is getting a pointer to the icon in C# that can be used with SHNotificationA dd.
As said previously, using the icon object's 'Handle' property should work.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ed Sutton |
last post by:
What's the trick to loading an icon from the embedded resources?
Here are the steps I have taken:
-------------------------
1 - I added a file named "FOLDER01.ICO" to my solution project
2 - I changed "Build Action" for the file to "Embedded Resource"
3 - At the end of my constructor, I try to load an icon and it throws the
following exception:
Exception:
|
by: Jack |
last post by:
I was learning Windows programming in C# using Charles Petzold book,
but this book was written for the older version of .NET. The example
of using icon from embedded resource fails to work when executed step
by step following the book directions and I can't find what is wrong.
The executable throws an exception claiming that the resource cannot
be found.
The steps I'm taking are:
1) I created simple icon 32 x 32 16 colors file, named:...
|
by: Wayne |
last post by:
I currently have an app whose Icon I am setting. I want to set the icons in
my forms at run time to that of the application icon. How do I retrieve the
application Icon so that I can use it for my forms? once retrieved can I
just set the form Icon? or do I need to do something special?
Thanks
Wayne
|
by: Adrian |
last post by:
How do I put an icon on a form using code?
Thank you.
|
by: carl.manaster |
last post by:
Hi,
In
<http://groups-beta.google.com/group/microsoft.public.dotnet.languages.csharp/msg/05abaf8460c61859>,
back in 2003, "SleazySt" wrote that
> Unfortunately, C# projects can't have resource scripts.
> Resources added to .NET applications by adding them to
> the project and designating them an "Embedded Resource"
> are included in a new .NET-specific format that's not
| |
by: farseer |
last post by:
Hi,
I created a new resouce ("app.resx") in my project and added an icon to
this resource with name "IL_ICON". I would like to use this resource
in some unmanaged code, in particular, with the api function
SHNotificationAdd. How can i do this?
i have tried using ResourceManager to get that icon, but i am getting
back NULL. Even if i did get back an icon, how can i use this to with
the hIcon parameter of SHNotificationAdd?
thank you...
|
by: Amjad |
last post by:
Hi,
I'm using the NotifyIcon to process some text files in the background
periodically. I want to display one icon in the task bar when the program is
in stand by mode, and I want to display another icon when it is in processing
mode. How can I do that? I have some pseudo code below:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
Try
If processing Then
|
by: Lou |
last post by:
if I add a new item (Solution Items) to my project and its an icon(.ico),
how can I reference that file when I am coding, Do I have to also add it to
an image control, I don't want the file to be part of the .resx file.
Its like VB6 when I could use load all my images from a resource file.
Lou
|
by: randy1200 |
last post by:
I have a Windows application that previously had the company logo
"MyCompany.ico" added to the upper left-most corner. The company has since
issued a new version of "MyCompany.ico" that looks completely different.
I overwrote the old ico file with the new ico file and re-ran the program. I
still see the old logo at run-time.
I right-clicked the project-> Add Existing Item-> added the new ico file. I
set the build action to Embedded...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |