|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Is it possible to compile an image file into a DLL or EXE file?I have a DLL that I created that contains a reference to an image file on my
hard drive and when I go to use that DLL in another program it complains that it can't find it. (I'm using a relative path in the DLL). I understand why it's happening, but instead of referencing a global path or moving the file to the programs directory where I'm using the DLL, I was wondering if it's possible to compile the image right into the DLL (or EXE for that matter)? Is that even possible, or do you always have to reference media files and such by pointing to them in some local directory that you package up with the program? Mark IN your DLL project right click the Project in the Solution Explorer, select
Add, and then select Add Existing Item to browse to your image file. In Solution Explorer, select the image file you just added, and then press F4 to display its Properties. Set the Build Action property to Embedded Resource. Dim rm AsNew ResourceManager("EsriSamples.PanTool", Me.GetType().Assembly) m_bitmap = CType(rm.GetObject("Pan_Bmp"), System.Drawing.Bitmap) -- Show quoteHide quoteGet a powerful web, database, application, and email hosting with KJM Solutions http://www.kjmsolutions.com "Mark Denardo" <markdena***@runbox.com> wrote in message news:8sydnV5mYecSztjZnZ2dnUVZ_uidnZ2d@starstream.net... >I have a DLL that I created that contains a reference to an image file on >my hard drive and when I go to use that DLL in another program it complains >that it can't find it. (I'm using a relative path in the DLL). I >understand why it's happening, but instead of referencing a global path or >moving the file to the programs directory where I'm using the DLL, I was >wondering if it's possible to compile the image right into the DLL (or EXE >for that matter)? Is that even possible, or do you always have to >reference media files and such by pointing to them in some local directory >that you package up with the program? > > Mark >
Show quote
Hide quote
"vbnetdev" <vbnetdev@community.nospam> wrote in message Keep in mind, while compiling the resource into the dll is useful, it can news:uDCT85yYGHA.4652@TK2MSFTNGP04.phx.gbl... > IN your DLL project right click the Project in the Solution Explorer, > select Add, and then select Add Existing Item to browse to your image > file. > In Solution Explorer, select the image file you just added, and then press > F4 to display its Properties. > Set the Build Action property to Embedded Resource. > > Dim rm AsNew ResourceManager("EsriSamples.PanTool", Me.GetType().Assembly) > m_bitmap = CType(rm.GetObject("Pan_Bmp"), System.Drawing.Bitmap) > > > > -- > Get a powerful web, database, application, and email hosting with KJM > Solutions > http://www.kjmsolutions.com > > > > "Mark Denardo" <markdena***@runbox.com> wrote in message > news:8sydnV5mYecSztjZnZ2dnUVZ_uidnZ2d@starstream.net... >>I have a DLL that I created that contains a reference to an image file on >>my hard drive and when I go to use that DLL in another program it >>complains that it can't find it. (I'm using a relative path in the DLL). >>I understand why it's happening, but instead of referencing a global path >>or moving the file to the programs directory where I'm using the DLL, I >>was wondering if it's possible to compile the image right into the DLL (or >>EXE for that matter)? Is that even possible, or do you always have to >>reference media files and such by pointing to them in some local directory >>that you package up with the program? >> >> Mark >> > > become troublesome when you get a large amount of files and want to access each one. Also, keep in mind, doing it this way increases the assembly for each resource you include....it would take longer startup times, and a larger memory footprint (please, someone correct me if I'm wrong here). HTH, Mythran You are not wrong. He asked how to do it. Not that it would necessarily be
wise. But it may be necessary for him in his situation. -- Show quoteHide quoteGet a powerful web, database, application, and email hosting with KJM Solutions http://www.kjmsolutions.com "Mythran" <kip_potter@hotmail.comREMOVETRAIL> wrote in message news:%23oxknazYGHA.3400@TK2MSFTNGP02.phx.gbl... > > "vbnetdev" <vbnetdev@community.nospam> wrote in message > news:uDCT85yYGHA.4652@TK2MSFTNGP04.phx.gbl... >> IN your DLL project right click the Project in the Solution Explorer, >> select Add, and then select Add Existing Item to browse to your image >> file. >> In Solution Explorer, select the image file you just added, and then >> press F4 to display its Properties. >> Set the Build Action property to Embedded Resource. >> >> Dim rm AsNew ResourceManager("EsriSamples.PanTool", >> Me.GetType().Assembly) >> m_bitmap = CType(rm.GetObject("Pan_Bmp"), System.Drawing.Bitmap) >> >> >> >> -- >> Get a powerful web, database, application, and email hosting with KJM >> Solutions >> http://www.kjmsolutions.com >> >> >> >> "Mark Denardo" <markdena***@runbox.com> wrote in message >> news:8sydnV5mYecSztjZnZ2dnUVZ_uidnZ2d@starstream.net... >>>I have a DLL that I created that contains a reference to an image file on >>>my hard drive and when I go to use that DLL in another program it >>>complains that it can't find it. (I'm using a relative path in the DLL). >>>I understand why it's happening, but instead of referencing a global path >>>or moving the file to the programs directory where I'm using the DLL, I >>>was wondering if it's possible to compile the image right into the DLL >>>(or EXE for that matter)? Is that even possible, or do you always have >>>to reference media files and such by pointing to them in some local >>>directory that you package up with the program? >>> >>> Mark >>> >> >> > > Keep in mind, while compiling the resource into the dll is useful, it can > become troublesome when you get a large amount of files and want to access > each one. Also, keep in mind, doing it this way increases the assembly > for each resource you include....it would take longer startup times, and a > larger memory footprint (please, someone correct me if I'm wrong here). > > HTH, > Mythran > "vbnetdev" <vbnetdev@community.nospam> wrote in message Yeah, which is why I posted under your post instead of replying directly news:ex3HbczYGHA.3684@TK2MSFTNGP05.phx.gbl... > You are not wrong. He asked how to do it. Not that it would necessarily be > wise. But it may be necessary for him in his situation. > > > -- > Get a powerful web, database, application, and email hosting with KJM > Solutions > http://www.kjmsolutions.com under the op's post. This way, he may follow your example, but "keeping in mind" my post so he doesn't drown himself before he realizes it :) Mythran Ok I have the image loaded into the project ("sunset.ico"), and under it's
build properties I have it set to Embedded Resource, but I'm a little confused as to how I load an embedded file into one of my objects (your code didn't help me much). Here's the line of code I'm having trouble with: Me.Icon = New System.Drawing.Icon(CurDir() + "\..\Images\sunset.ico") btw, this is an EXE I'm building just to save me a step in testing. And I'm using VS 2005. Mark Show quoteHide quote "vbnetdev" <vbnetdev@community.nospam> wrote in message news:uDCT85yYGHA.4652@TK2MSFTNGP04.phx.gbl... > IN your DLL project right click the Project in the Solution Explorer, > select Add, and then select Add Existing Item to browse to your image > file. > In Solution Explorer, select the image file you just added, and then press > F4 to display its Properties. > Set the Build Action property to Embedded Resource. > > Dim rm AsNew ResourceManager("EsriSamples.PanTool", Me.GetType().Assembly) > m_bitmap = CType(rm.GetObject("Pan_Bmp"), System.Drawing.Bitmap) > > > > -- > Get a powerful web, database, application, and email hosting with KJM > Solutions > http://www.kjmsolutions.com > > > > "Mark Denardo" <markdena***@runbox.com> wrote in message > news:8sydnV5mYecSztjZnZ2dnUVZ_uidnZ2d@starstream.net... >>I have a DLL that I created that contains a reference to an image file on >>my hard drive and when I go to use that DLL in another program it >>complains that it can't find it. (I'm using a relative path in the DLL). >>I understand why it's happening, but instead of referencing a global path >>or moving the file to the programs directory where I'm using the DLL, I >>was wondering if it's possible to compile the image right into the DLL (or >>EXE for that matter)? Is that even possible, or do you always have to >>reference media files and such by pointing to them in some local directory >>that you package up with the program? >> >> Mark >> > >
Regular Expression Help...Line Break
CreateObject internet access Reference different versions of an ActiveX-dll checking for element in xml document Dynamically reading structure fields Two way collection Desktop integrated file browser Free unzip plug-in for VB.NET? Byte to int Conversion ..?? Limits of the datagrid |
|||||||||||||||||||||||