Results 1 to 3 of 3

Thread: using VB's icons?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091
    Hi,

    I would like to use some Icons that are native to VB, such as the msgbox icons.. How would I use the msgbox icons seperate from the msgbox? For example, I'm creating my own msgbox with a form and need to use the msgbox icons..

    I'm not even sure which extension they use.. I did a search for *.ico but did not see any msgbox icons in the result set.

    any help would be appreciated..

    Dan

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    You can use the LoadIcon() API to access the default Windows Messagebox Icons, i.e.
    Code:
    Option Explicit
    
    Private Declare Function LoadIcon Lib "user32" Alias "LoadIconA" (ByVal hInstance As Long, lpIconName As Any) As Long
    Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
    
    Private Const IDI_APPLICATION = 32512&
    Private Const IDI_ASTERISK = 32516&
    Private Const IDI_EXCLAMATION = 32515&
    Private Const IDI_HAND = 32513&
    Private Const IDI_QUESTION = 32514&
    
    Private Sub Command1_Click()
        Static lIconID As Long
        Dim lIcon As Long
        
        Picture1.Cls
        lIcon = LoadIcon(0&, ByVal (lIconID + IDI_APPLICATION))
        Call DrawIcon(Picture1.hdc, 0, 0, lIcon)
        lIconID = (lIconID + 1) Mod 5
    End Sub

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091
    Thanks for the help but it doesn't do anything.. The picturebox is just blank..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width