Creating Screen Saver in C# [modified]
-
I am developing a screen saver in C#. However, I am stuck at one point. How can I embed resources in the src that will be build ? and any information how the standard screen savers store the resources ? Thanks. Please note images are to loaded at run-time which I want to embed in the src file, that the application will create. -- modified at 7:57 Sunday 22nd July, 2007
"C makes it easy to shoot yourself in the foot. C++ makes it harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
-
I am developing a screen saver in C#. However, I am stuck at one point. How can I embed resources in the src that will be build ? and any information how the standard screen savers store the resources ? Thanks. Please note images are to loaded at run-time which I want to embed in the src file, that the application will create. -- modified at 7:57 Sunday 22nd July, 2007
"C makes it easy to shoot yourself in the foot. C++ makes it harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
Hi, there are several good articles on screensavers available on CodeProject. you can include resources (images, icons, ...) in your exe by: - adding their file to your project (I typically add a "resources" folder in the Solution Explorer pane) - setting its "Build Action" to "Embedded Resource" - adding some code to access the resource; I cant remember what exactly, so I let Visual Designer use my resource (e.g. as an image for a picturebox, an icon for the main form), then look at the code it generated, and copy/paste/modify that I see no reason why screensavers would handle resources any different than other apps do. :)
Luc Pattyn
try { [Search CP Articles] [Search CP Forums] [Forum Guidelines] [My Articles] } catch { [Google] }
-
Hi, there are several good articles on screensavers available on CodeProject. you can include resources (images, icons, ...) in your exe by: - adding their file to your project (I typically add a "resources" folder in the Solution Explorer pane) - setting its "Build Action" to "Embedded Resource" - adding some code to access the resource; I cant remember what exactly, so I let Visual Designer use my resource (e.g. as an image for a picturebox, an icon for the main form), then look at the code it generated, and copy/paste/modify that I see no reason why screensavers would handle resources any different than other apps do. :)
Luc Pattyn
try { [Search CP Articles] [Search CP Forums] [Forum Guidelines] [My Articles] } catch { [Google] }
Thanks for your response. I am adding the images at run-time.Any help on this. I have got to know about ResourceWriter which creates a satellite dll. What I need is a single scr file, which has the resources embedded. So any help on making the resource embedded in an exe at run-time ? Do I need to compile another exe(scr) at run-time and embed those images in the new exe(scr)?
"C makes it easy to shoot yourself in the foot. C++ makes it harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
-
Thanks for your response. I am adding the images at run-time.Any help on this. I have got to know about ResourceWriter which creates a satellite dll. What I need is a single scr file, which has the resources embedded. So any help on making the resource embedded in an exe at run-time ? Do I need to compile another exe(scr) at run-time and embed those images in the new exe(scr)?
"C makes it easy to shoot yourself in the foot. C++ makes it harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
Hi, I explained on how to embed images and the like into the exe at build-time; that would result in a single file. You did not ask about run-time images at first; if the images are only available at run-time, why would you want to turn them into a dll, rather than just use them from where they are ? I have no experience with ResourceWriter; I think it helps creating a resource dll while said dll file is NOT in use. I expect, once a resource (or other) dll is in use, you cant modify it.
Luc Pattyn
try { [Search CP Articles] [Search CP Forums] [Forum Guidelines] [My Articles] } catch { [Google] }
-
Hi, I explained on how to embed images and the like into the exe at build-time; that would result in a single file. You did not ask about run-time images at first; if the images are only available at run-time, why would you want to turn them into a dll, rather than just use them from where they are ? I have no experience with ResourceWriter; I think it helps creating a resource dll while said dll file is NOT in use. I expect, once a resource (or other) dll is in use, you cant modify it.
Luc Pattyn
try { [Search CP Articles] [Search CP Forums] [Forum Guidelines] [My Articles] } catch { [Google] }
Hello, Thanks for the response. Yes I know you were talking about embedding resources at build-time. That is why I asked for run-time. The reason for this, if the user removes the images at the path or user wants to redistribute the screen saver. Then user would need to relocate the images as well. So in short I want everything in a single exe(scr) file. Yes, resourcewriter creates a satellite dll. This has better results as compared to loading images at run-time.That is, the actions of user deleting the images does not affect the screen saver. However, relocating the screen saver on another machine would still require to move this dll as well. Thanks.
"C makes it easy to shoot yourself in the foot. C++ makes it harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
-
Hello, Thanks for the response. Yes I know you were talking about embedding resources at build-time. That is why I asked for run-time. The reason for this, if the user removes the images at the path or user wants to redistribute the screen saver. Then user would need to relocate the images as well. So in short I want everything in a single exe(scr) file. Yes, resourcewriter creates a satellite dll. This has better results as compared to loading images at run-time.That is, the actions of user deleting the images does not affect the screen saver. However, relocating the screen saver on another machine would still require to move this dll as well. Thanks.
"C makes it easy to shoot yourself in the foot. C++ makes it harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
Identity Undisclosed wrote:
Yes I know you were talking about embedding resources at build-time. That is why I asked for run-time. The reason for this, if the user removes the images at the path or user wants to redistribute the screen saver. Then user would need to relocate the images as well. So in short I want everything in a single exe(scr) file.
:confused::confused::confused::confused::confused::confused::confused::confused: With embedded images, everything, I repeat everything, is in the single EXE file, so you cant delete images, and you can copy the EXE anywhere you like, it will still show the same set of images. That is the meaning of embedded resources.
Luc Pattyn
try { [Search CP Articles] [Search CP Forums] [Forum Guidelines] [My Articles] } catch { [Google] }