Results 1 to 4 of 4

Thread: Msgbox Icons

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2009
    Posts
    62

    Msgbox Icons

    I've finally had a spare day to write my own VB6 MsgBox function but now I need the standard icons

    vbExclamation, vbQuestion, vbCritical and so on

    Anyone got them or a link to them

    thanks

  2. #2
    Fanatic Member
    Join Date
    Mar 2009
    Posts
    804

    Re: Msgbox Icons

    Try this code:
    Code:
    Option Explicit
    Private Enum MsgBoxIcons
     mbiCritical = 32513&
     mbiQuestion = 32514&
     mbiExclamation = 32515&
     mbiInformation = 32516&
     mbiWinLogo = 32517&
    End Enum
    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 Declare Function LoadIcon Lib "user32.dll" Alias "LoadIconA" (ByVal hInstance As Long, ByVal lpIconName As Long) As Long
    Private Sub DrawMsgBoxIcon(ByVal hDC As Long, x As Long, y As Long, ByVal mbi As MsgBoxIcons)
     Dim hIcon As Long
     hIcon = LoadIcon(ByVal 0, mbi)
     DrawIcon hDC, x, y, hIcon
    End Sub
    
    Private Sub Form_Load()
     Dim i As Long
     Dim x As Long
     AutoRedraw = True
     For i = mbiCritical To mbiWinLogo
      DrawMsgBoxIcon hDC, x, 0, i
      x = x + 32
     Next
    End Sub

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 2009
    Posts
    62

    Re: Msgbox Icons

    Thanks, can I ask, are these icons part to of some component or sub system and this code is extracting it

    If so, can I assume it will be installed on all machines XP -> 8

    Cheers

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Msgbox Icons

    User32.dll? Oh yeah, you can assume it's there. W/o it, nearly everything in Windows would stop working.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Tags for this Thread

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