473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Win32 Exception

Hi,
I am getting an exception when I read in bunch of resources with the
following code:

string fullName = name + ".ico";
Stream stream = assembly.GetManifestResourceStream(fullName);
return new Icon(stream);

The stack trace is as follows:

Unhandled Exception: System.ComponentModel.Win32Exception: Element not
found
at System.Drawing.Icon.Initialize(Int32 width, Int32 height)
at System.Drawing.Icon..ctor(Stream stream)

It seems to only happen when I read the same resource again and again.
I was able to fix the error by caching the resource, but I was still
curious why it happens. Any ideas?

thanks,
Jake Pearson
Nov 16 '05 #1
2 2954
Jake-

Try adding the name of the default namespace to the beginning of the string:

string fullName = "NameSpace." + name + ".ico";

Robert

"Jake Pearson" <jp******@maad.com> wrote in message
news:52**************************@posting.google.c om...
Hi,
I am getting an exception when I read in bunch of resources with the
following code:

string fullName = name + ".ico";
Stream stream = assembly.GetManifestResourceStream(fullName);
return new Icon(stream);

The stack trace is as follows:

Unhandled Exception: System.ComponentModel.Win32Exception: Element not
found
at System.Drawing.Icon.Initialize(Int32 width, Int32 height)
at System.Drawing.Icon..ctor(Stream stream)

It seems to only happen when I read the same resource again and again.
I was able to fix the error by caching the resource, but I was still
curious why it happens. Any ideas?

thanks,
Jake Pearson

Nov 16 '05 #2
Jake-

Try adding the name of the default namespace to the beginning of the string:

string fullName = "NameSpace." + name + ".ico";

Robert

"Jake Pearson" <jp******@maad.com> wrote in message
news:52**************************@posting.google.c om...
Hi,
I am getting an exception when I read in bunch of resources with the
following code:

string fullName = name + ".ico";
Stream stream = assembly.GetManifestResourceStream(fullName);
return new Icon(stream);

The stack trace is as follows:

Unhandled Exception: System.ComponentModel.Win32Exception: Element not
found
at System.Drawing.Icon.Initialize(Int32 width, Int32 height)
at System.Drawing.Icon..ctor(Stream stream)

It seems to only happen when I read the same resource again and again.
I was able to fix the error by caching the resource, but I was still
curious why it happens. Any ideas?

thanks,
Jake Pearson

Nov 16 '05 #3

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

Similar topics

1
by: Noah | last post by:
Hi, How do I shutdown a win32 COM server? I am scripting Adobe Illustrator through its COM interface. The problem is that Illustrator has memory leaks. And after a few hours of running,...
28
by: Grant Edwards | last post by:
I finally figured out why one of my apps sometimes fails under Win32 when it always works fine under Linux: Under Win32, the pickle module only works with a subset of floating point values. In...
0
by: kk | last post by:
hello all, I want to call an exe(IISWeb.vbs) to create a site in Sharepoint.While calling that exe through Process.Start() it throws the following exception. 1.while calling through...
14
by: vittorio | last post by:
While I can compile the program below under freebsd via a simple: gcc prog1.c -o prog1 and it runs smoothly, I'm experiencing annoying problems with lcc-win32 under windows xp pro. In fact, under...
4
by: chandu | last post by:
hello, i want to use win32 dll in my c# application.i copied that dll in my bin/debug folder and then i used one of its function like this...... public static extern void...
0
by: =?Utf-8?B?Q29saXZpZXI=?= | last post by:
If anyone can help me with this I would really appreciate it: I have an assembly into which I have linked a manifest file as a Win32 resource. This is necessary since I want to use a class in this...
1
by: Richard Gordon | last post by:
I've got a fatal bug using Parente's pyTTS with Python 2.3 on Windoze 32 using MS SAPI 5.1 and Hammond's win32 module. The test program is import pyTTS tts = pyTTS.Create() tts.Speak('Hello...
2
by: Richard Gordon | last post by:
Sorry if this is sent twice, but I didn't see it get posted the first time. I've got a fatal bug using Parente's pyTTS with Python 2.3 on Windoze 32 using MS SAPI 5.1 and Hammond's win32 module....
7
by: Boris | last post by:
I have a mixed DLL (a managed DLL in C++ calling functions in other unmanaged DLLs) which I can build successfully in Visual Studio 2005 but can't reference as I get then immediately the error: ...
1
by: dh | last post by:
AppA is a console application (in C#), which uses DLLs in a unmanaged code (C++, no source available for them). AppB is a service (in C#), which starts AppA when needed. When an exception of...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...

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.