dll resource file

Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
12 posts Page 1 of 2
Contributors
User avatar
AleRi8
Top Poster
Top Poster
Posts: 153
Joined: Sun Sep 20, 2009 2:30 pm

dll resource file
AleRi8
Hi, how do i create a dll to which it holds all the program images so my main program will load the images from a dll to the main application


thanks
You do not have the required permissions to view the files attached to this post.
Last edited by AleRi8 on Sat Jun 05, 2010 2:57 pm, edited 1 time in total.
check out my software
win7 itweaker basic £4.50
viewtopic.php?f=70&t=793
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: dll resource file
mandai
You can put the images in as embedded resources for the dll project, then have some code in in your application like this:
Code: Select all
        Dim dll As Assembly = Assembly.GetAssembly(GetType(ClassLibrary1.Class1))
        Dim myResources As String() = dll.GetManifestResourceNames()

        msgbox(myResources(0))
        Dim resStream As Stream = dll.GetManifestResourceStream(myResources(0))
        Dim image1 As Image = Image.FromStream(resStream)
        resStream.Close()

        PictureBox1.Image = image1
User avatar
AleRi8
Top Poster
Top Poster
Posts: 153
Joined: Sun Sep 20, 2009 2:30 pm

Re: dll resource file
AleRi8
ok thx i'll give it ago
check out my software
win7 itweaker basic £4.50
viewtopic.php?f=70&t=793
User avatar
AleRi8
Top Poster
Top Poster
Posts: 153
Joined: Sun Sep 20, 2009 2:30 pm

Re: dll resource file
AleRi8
i tryed that but it comes up 2 errors with message box with reference.reference + object to refence to object is null
check out my software
win7 itweaker basic £4.50
viewtopic.php?f=70&t=793
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: dll resource file
mandai
You have to have at least 1 image file as an embedded resource in your project for it to work.
User avatar
AleRi8
Top Poster
Top Poster
Posts: 153
Joined: Sun Sep 20, 2009 2:30 pm

Re: dll resource file
AleRi8
lol i did add a image file i have uploaded the main app and dll source files in first post
check out my software
win7 itweaker basic £4.50
viewtopic.php?f=70&t=793
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: dll resource file
mandai
Looks like you forgot to set the build action to embedded resource for your Image1.bmp/xddd.png files in the dll project.
User avatar
AleRi8
Top Poster
Top Poster
Posts: 153
Joined: Sun Sep 20, 2009 2:30 pm

Re: dll resource file
AleRi8
lol ok thanks for your time i dont know much about dlls :)
check out my software
win7 itweaker basic £4.50
viewtopic.php?f=70&t=793
User avatar
AleRi8
Top Poster
Top Poster
Posts: 153
Joined: Sun Sep 20, 2009 2:30 pm

Re: dll resource file
AleRi8
i tryed it again last night and recompiled to what you z and i had added a referance to the file but now the name classlibary1.clase highlights blue but when i recompile it as a compiler then the blue line disapears
check out my software
win7 itweaker basic £4.50
viewtopic.php?f=70&t=793
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: dll resource file
mandai
Maybe you called the class library something different?
12 posts Page 1 of 2
Return to “Tutorial Requests”