Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleMake a DLL that contains icons or other pictures
KeywordsDLL, icon, picture
CategoriesSoftware Engineering
 
Make a DLL project and add a form to it. Place the icons or other pictures in PictureBoxes on this form.

Create a public class and give it a GetIcon method that returns one of the PictureBox's Picture properties.

 
Public Function GetIcon(ByVal Index As Integer) As _
    StdPicture
    Set GetIcon = frmIcons.picIcon(Index).Picture
End Function
 
The main program needs a reference to the DLL. If you build the main program in the same project group as the DLL project, open the Project menu, select References, and check the DLL project's entry.

If the main program is in its own project, load the DLL project, open the File menu, and select the Make Xxx.dll command to build the DLL. Then load the main project, open the Project menu, select References, and check the DLL's entry. If you cannot find the DLL, click the Browse button to select it.

After you have created the reference to the DLL, you can create an instance of the class and use it's public GetIcon method to retrieve the pictures stored in the DLL.

 
Private Sub optIcon_Click(Index As Integer)
Dim icon_holder As StorageIconHolder

    Set icon_holder = New StorageIconHolder
    Me.MouseIcon = icon_holder.GetIcon(Index)
    Me.MousePointer = vbCustom
    Picture1.Picture = icon_holder.GetIcon(Index)
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated