home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / codeli_1 / setup.exe / _SETUP.1 / frmExtractIcon.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-08-14  |  6.2 KB  |  188 lines

  1. VERSION 5.00
  2. Begin VB.Form frmExtractIcon 
  3.    Caption         =   "Extracting a File's Associated Icons"
  4.    ClientHeight    =   2550
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   4785
  8.    Icon            =   "frmExtractIcon.frx":0000
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   2550
  11.    ScaleWidth      =   4785
  12.    StartUpPosition =   3  'Windows Default
  13.    Begin VB.PictureBox picSmall 
  14.       Appearance      =   0  'Flat
  15.       AutoRedraw      =   -1  'True
  16.       BorderStyle     =   0  'None
  17.       ForeColor       =   &H80000008&
  18.       Height          =   240
  19.       Left            =   4200
  20.       ScaleHeight     =   240
  21.       ScaleWidth      =   240
  22.       TabIndex        =   8
  23.       Top             =   120
  24.       Width           =   240
  25.    End
  26.    Begin VB.CommandButton cmdLoad 
  27.       Caption         =   "&Load Icons"
  28.       Default         =   -1  'True
  29.       Height          =   375
  30.       Left            =   3480
  31.       TabIndex        =   1
  32.       Top             =   1440
  33.       Width           =   1215
  34.    End
  35.    Begin VB.TextBox txtFileName 
  36.       Height          =   285
  37.       Left            =   480
  38.       TabIndex        =   0
  39.       Text            =   "C:\Autoexec.bat"
  40.       Top             =   1080
  41.       Width           =   4215
  42.    End
  43.    Begin VB.PictureBox picLarge 
  44.       Appearance      =   0  'Flat
  45.       AutoRedraw      =   -1  'True
  46.       BorderStyle     =   0  'None
  47.       ForeColor       =   &H80000008&
  48.       Height          =   480
  49.       Left            =   4200
  50.       ScaleHeight     =   480
  51.       ScaleWidth      =   480
  52.       TabIndex        =   6
  53.       Top             =   480
  54.       Width           =   480
  55.    End
  56.    Begin VB.Label Label5 
  57.       AutoSize        =   -1  'True
  58.       Caption         =   "File:"
  59.       Height          =   195
  60.       Left            =   120
  61.       TabIndex        =   12
  62.       Top             =   1110
  63.       Width           =   285
  64.    End
  65.    Begin VB.Label Label6 
  66.       Alignment       =   1  'Right Justify
  67.       AutoSize        =   -1  'True
  68.       Caption         =   "Written for the VB Center Code Library"
  69.       BeginProperty Font 
  70.          Name            =   "Small Fonts"
  71.          Size            =   6.75
  72.          Charset         =   0
  73.          Weight          =   400
  74.          Underline       =   0   'False
  75.          Italic          =   0   'False
  76.          Strikethrough   =   0   'False
  77.       EndProperty
  78.       Height          =   165
  79.       Left            =   2340
  80.       TabIndex        =   11
  81.       Top             =   2040
  82.       Width           =   2355
  83.    End
  84.    Begin VB.Label Label7 
  85.       Alignment       =   1  'Right Justify
  86.       AutoSize        =   -1  'True
  87.       Caption         =   "http://www.geocities.com/SiliconValley/Way/6445"
  88.       BeginProperty Font 
  89.          Name            =   "MS Sans Serif"
  90.          Size            =   8.25
  91.          Charset         =   0
  92.          Weight          =   700
  93.          Underline       =   0   'False
  94.          Italic          =   0   'False
  95.          Strikethrough   =   0   'False
  96.       EndProperty
  97.       ForeColor       =   &H00800000&
  98.       Height          =   195
  99.       Left            =   360
  100.       TabIndex        =   10
  101.       Top             =   2280
  102.       Width           =   4365
  103.    End
  104.    Begin VB.Label Label4 
  105.       AutoSize        =   -1  'True
  106.       Caption         =   "32x32:"
  107.       Height          =   195
  108.       Left            =   3600
  109.       TabIndex        =   9
  110.       Top             =   480
  111.       Width           =   480
  112.    End
  113.    Begin VB.Label Label3 
  114.       AutoSize        =   -1  'True
  115.       Caption         =   "16x16:"
  116.       Height          =   195
  117.       Left            =   3600
  118.       TabIndex        =   7
  119.       Top             =   120
  120.       Width           =   480
  121.    End
  122.    Begin VB.Label Label2 
  123.       AutoSize        =   -1  'True
  124.       Caption         =   "Type:"
  125.       Height          =   195
  126.       Left            =   120
  127.       TabIndex        =   5
  128.       Top             =   480
  129.       Width           =   405
  130.    End
  131.    Begin VB.Label Label1 
  132.       AutoSize        =   -1  'True
  133.       Caption         =   "Name:"
  134.       Height          =   195
  135.       Left            =   120
  136.       TabIndex        =   4
  137.       Top             =   120
  138.       Width           =   465
  139.    End
  140.    Begin VB.Label lblFileType 
  141.       AutoSize        =   -1  'True
  142.       Caption         =   "MS-DOS Batch File"
  143.       Height          =   195
  144.       Left            =   720
  145.       TabIndex        =   3
  146.       Top             =   480
  147.       Width           =   1380
  148.    End
  149.    Begin VB.Label lblFileName 
  150.       AutoSize        =   -1  'True
  151.       Caption         =   "Autoexec"
  152.       Height          =   195
  153.       Left            =   720
  154.       TabIndex        =   2
  155.       Top             =   120
  156.       Width           =   675
  157.    End
  158. Attribute VB_Name = "frmExtractIcon"
  159. Attribute VB_GlobalNameSpace = False
  160. Attribute VB_Creatable = False
  161. Attribute VB_PredeclaredId = True
  162. Attribute VB_Exposed = False
  163. Private Sub cmdLoad_Click()
  164.     Dim hImgSmall As Long     ' The handle to the system image list
  165.     Dim FileName As String    ' The file name to get icon from
  166.     Dim r As Long
  167.     FileName$ = txtFileName.Text
  168.     ' Get the system icons associated with the file
  169.     hImgSmall& = SHGetFileInfo(FileName$, 0&, shinfo, Len(shinfo), _
  170.                  BASIC_SHGFI_FLAGS Or SHGFI_SMALLICON)
  171.     hImgLarge& = SHGetFileInfo(FileName$, 0&, shinfo, Len(shinfo), _
  172.                  BASIC_SHGFI_FLAGS Or SHGFI_LARGEICON)
  173.     ' Fill in the labels with the image's file data
  174.     lblFileName.Caption = Left$(shinfo.szDisplayName, _
  175.                InStr(shinfo.szDisplayName, Chr$(0)) - 1)
  176.     lblFileType.Caption = Left$(shinfo.szTypeName, _
  177.                InStr(shinfo.szTypeName, Chr$(0)) - 1)
  178.     ' Set the pictureboxes to receive the icons.
  179.     picSmall.Picture = LoadPicture()
  180.     picLarge.Picture = LoadPicture()
  181.     ' Draw the associated icons into the picture boxes
  182.     r& = ImageList_Draw(hImgSmall&, shinfo.iIcon, picSmall.hDC, 0, 0, ILD_TRANSPARENT)
  183.     r& = ImageList_Draw(hImgLarge&, shinfo.iIcon, picLarge.hDC, 0, 0, ILD_TRANSPARENT)
  184. End Sub
  185. Private Sub Form_Load()
  186. cmdLoad_Click
  187. End Sub
  188.