home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / extrac / extract.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  16.2 KB  |  295 lines

  1. VERSION 2.00
  2. Begin Form Extract 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "EXTRACTION D'ICONES"
  5.    ClientHeight    =   1995
  6.    ClientLeft      =   4140
  7.    ClientTop       =   3990
  8.    ClientWidth     =   4890
  9.    Height          =   2400
  10.    Icon            =   EXTRACT.FRX:0000
  11.    Left            =   4080
  12.    LinkTopic       =   "EXTRACTION D'ICONES"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   1995
  16.    ScaleWidth      =   4890
  17.    Top             =   3645
  18.    Width           =   5010
  19.    Begin FileListBox File1 
  20.       Height          =   1980
  21.       Left            =   90
  22.       TabIndex        =   10
  23.       Top             =   2340
  24.       Width           =   2055
  25.    End
  26.    Begin DirListBox Dir1 
  27.       Height          =   1605
  28.       Left            =   2280
  29.       TabIndex        =   9
  30.       Top             =   2730
  31.       Width           =   2475
  32.    End
  33.    Begin DriveListBox Drive1 
  34.       Height          =   315
  35.       Left            =   2280
  36.       TabIndex        =   8
  37.       Top             =   2340
  38.       Width           =   2475
  39.    End
  40.    Begin CommandButton Command3 
  41.       Caption         =   "&Liste Fichier"
  42.       Height          =   345
  43.       Left            =   3030
  44.       TabIndex        =   7
  45.       Top             =   870
  46.       Width           =   1695
  47.    End
  48.    Begin HScrollBar Barre 
  49.       Height          =   285
  50.       Left            =   2130
  51.       TabIndex        =   6
  52.       Top             =   1290
  53.       Visible         =   0   'False
  54.       Width           =   2655
  55.    End
  56.    Begin PictureBox Picture2 
  57.       Height          =   885
  58.       Left            =   960
  59.       ScaleHeight     =   855
  60.       ScaleWidth      =   885
  61.       TabIndex        =   4
  62.       Top             =   210
  63.       Width           =   915
  64.       Begin PictureBox Picture1 
  65.          BackColor       =   &H00FFFFFF&
  66.          BorderStyle     =   0  'None
  67.          Height          =   480
  68.          Left            =   210
  69.          ScaleHeight     =   480
  70.          ScaleWidth      =   480
  71.          TabIndex        =   5
  72.          Top             =   180
  73.          Width           =   480
  74.       End
  75.    End
  76.    Begin CommandButton Command2 
  77.       Caption         =   "&Quitter"
  78.       Height          =   345
  79.       Left            =   3060
  80.       TabIndex        =   3
  81.       Top             =   90
  82.       Width           =   1695
  83.    End
  84.    Begin CommandButton Command1 
  85.       Caption         =   "&Icone"
  86.       Height          =   345
  87.       Left            =   3060
  88.       TabIndex        =   2
  89.       Top             =   480
  90.       Width           =   1695
  91.    End
  92.    Begin TextBox Text1 
  93.       Height          =   315
  94.       Left            =   90
  95.       TabIndex        =   0
  96.       Top             =   1650
  97.       Width           =   4725
  98.    End
  99.    Begin Label Label2 
  100.       BackColor       =   &H00C0C0C0&
  101.       Height          =   225
  102.       Left            =   120
  103.       TabIndex        =   11
  104.       Top             =   2070
  105.       Width           =   4605
  106.    End
  107.    Begin Label Label1 
  108.       BackColor       =   &H00C0C0C0&
  109.       Caption         =   "Nom du fichier:"
  110.       Height          =   195
  111.       Left            =   90
  112.       TabIndex        =   1
  113.       Top             =   1440
  114.       Width           =   2445
  115.    End
  116. '                                                                                                                                                                                                                                                                           '
  117. '                                                                                                                                                                                                                                                                            '
  118. 'Permet l'extraction des Ic
  119. nes                                                                                                                                                                                                                                               '
  120. '                                                                                                                                                                                                                                                                              '
  121. '                                                                                                                                                                                                                                                                               '
  122.     Option Explicit
  123.     Dim hInst As Integer
  124.     Dim hIcon As Integer
  125. '                                                                                                                                                                                                                                                                                                                               '
  126. 'Program made by                                                                                                                                                                                                                                                                                                                                '
  127. 'Christophe Tricaud, Paris, France    N
  128. 100412,2653                                                                                                                                                                                                                                                                               '
  129. 'If you find it usefull just tell it to me                                                                                                                                                                                                                                                                                         '
  130. 'If you have good tips, just send them to me....                                                                                                                                                                                                                                                                                    '
  131. '                                                                                                                                                                                                                                                                                                                                    '
  132. '                                                                                                                                                                                                                                                                                                                                     '
  133. Sub Barre_Change ()
  134.     Dim Res As Integer
  135. '                                                                                                                                                                                                                       '
  136. '                                                                                                                                                                                                                        '
  137. 'On a fait d
  138. filer la barre                                                                                                                                                                                               '
  139. '                                                                                                                                                                                                                          '
  140. '                                                                                                                                                                                                                           '
  141.     hIcon = ExtractIcon(hInst, Text1, Barre.Value - 1)
  142.     Picture1.Picture = LoadPicture("")
  143.     Res = DrawIcon%(Picture1.hDC, 0, 0, hIcon)
  144. End Sub
  145. Sub Command1_Click ()
  146.     Dim NbIcon As Integer
  147.     Dim A As String
  148. '                                                                                                                                                                                                                                                                                                       '
  149. '                                                                                                                                                                                                                                                                                                        '
  150. 'Lorsque l'utilisateur click, on cherche l'ic
  151. ne                                                                                                                                                                                                                                                          '
  152. '                                                                                                                                                                                                                                                                                                          '
  153. '                                                                                                                                                                                                                                                                                                           '
  154.     'On contr
  155. le si le fichier existe                                                                                                                                                                                                                                       '
  156.     On Local Error Resume Next
  157.     Err = 0
  158.     A = Dir$(Text1)
  159.     If Err <> 0 Then
  160.         Beep
  161.         MsgBox "Le fichier que vous avez indiqu
  162.  est inextistant.", 64, "Erreur Saisie"
  163.         Exit Sub
  164.     End If
  165.     If Dir$(Text1) = "" Then
  166.         Beep
  167.         MsgBox "Le fichier que vous avez indiqu
  168.  est inextistant.", 64, "Erreur Saisie"
  169.         Exit Sub
  170.     End If
  171.     'On regarde le nombre d'ic
  172. nes contenues                                                                                                                                                                                                                                                                                                                    '
  173.     NbIcon = ExtractIcon(hInst, Text1, -1)
  174.     If NbIcon = 0 Then
  175.         Beep
  176.         MsgBox "Le fichier que vous avez indiqu
  177.  ne contient pas d'ic
  178. nes.", 64, "Erreur Saisie"
  179.         Exit Sub
  180.     End If
  181.     'On regarde si on met l'
  182. chelle                                                                                                                                                                                     '
  183.     If NbIcon > 1 Then
  184.         Barre.Visible = -1
  185.         Barre.Max = NbIcon
  186.         Barre.Min = 1
  187.         Barre.Value = 1
  188.     End If
  189.     'On extrait la premi
  190. re icone                                                                                                                                                                                                                                                                                   '
  191.     Barre_Change
  192. End Sub
  193. Sub Command2_Click ()
  194.     Unload Me
  195. End Sub
  196. Sub Command3_Click ()
  197. '                                                                                                                                                                                                                                                                   '
  198. '                                                                                                                                                                                                                                                                    '
  199. 'On affiche ou non les r
  200. pertoires                                                                                                                                                                                                                                    '
  201. '                                                                                                                                                                                                                                                                      '
  202. '                                                                                                                                                                                                                                                                       '
  203.     If Height = 2400 Then
  204.         Height = 4860
  205.         Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2
  206.         Dir1.Enabled = -1
  207.         Drive1.Enabled = -1
  208.         File1.Enabled = -1
  209.         File1.SetFocus
  210.     Else
  211.         Height = 2400
  212.         Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2
  213.         Dir1.Enabled = 0
  214.         Drive1.Enabled = 0
  215.         File1.Enabled = 0
  216.         Text1.SetFocus
  217.     End If
  218. End Sub
  219. Sub Dir1_Change ()
  220. '                                                                                                              '
  221. '                                                                                                               '
  222. 'On modifie le r
  223. pertoire.                                                                                      '
  224. '                                                                                                                 '
  225. '                                                                                                                  '
  226.     File1.Path = Dir1.Path
  227.     Label2.Caption = Dir1.Path
  228.     If Right$(Label2.Caption, 1) <> "\" Then Label2.Caption = Label2.Caption + "\"
  229. End Sub
  230. Sub Dir1_KeyPress (KeyAscii As Integer)
  231.     Dir1.Path = Dir1.List(Dir1.ListIndex)
  232. End Sub
  233. Sub Dir1_LostFocus ()
  234.     Dir1.Path = Dir1.List(Dir1.ListIndex)
  235. End Sub
  236. Sub Drive1_Change ()
  237.     On Local Error GoTo ErrUnite
  238.     Dir1.Path = Drive1.Drive
  239.     Exit Sub
  240. ErrUnite:
  241.     MsgBox "L'unit
  242.  n'est pas disponible", 48, "Erreur S
  243. lection Unit
  244.     Drive1.Drive = Dir1.Path
  245.     On Error GoTo 0
  246.     Exit Sub
  247.     Resume
  248. End Sub
  249. Sub File1_Click ()
  250.     If Right$(Dir1.Path, 1) = "\" Then
  251.         Label2.Caption = Dir1.Path + File1.FileName
  252.     Else
  253.         Label2.Caption = Dir1.Path + "\" + File1.FileName
  254.     End If
  255. End Sub
  256. Sub File1_DblClick ()
  257.     If Right$(Dir1.Path, 1) = "\" Then
  258.         Text1 = Dir1.Path + File1.FileName
  259.     Else
  260.         Text1 = Dir1.Path + "\" + File1.FileName
  261.     End If
  262.     Command1_Click
  263. End Sub
  264. Sub File1_GotFocus ()
  265.     If Right$(Dir1.Path, 1) = "\" Then
  266.         Label2.Caption = Dir1.Path + File1.FileName
  267.     Else
  268.         Label2.Caption = Dir1.Path + "\" + File1.FileName
  269.     End If
  270. End Sub
  271. Sub File1_PathChange ()
  272.     If Right$(Dir1.Path, 1) = "\" Then
  273.         Label2.Caption = Dir1.Path + File1.FileName
  274.     Else
  275.         Label2.Caption = Dir1.Path + "\" + File1.FileName
  276.     End If
  277. End Sub
  278. Sub Form_Load ()
  279.     'Calcul du Handle                                                                                                                                                                                                                                       '
  280.     hInst% = GetWindowWord(Me.hWnd, GWW_HINSTANCE)
  281.     Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2
  282.     Dir1.Enabled = 0
  283.     Drive1.Enabled = 0
  284.     File1.Enabled = 0
  285. End Sub
  286. Sub Text1_Change ()
  287.     Barre.Visible = 0
  288.     Barre.Max = 1
  289.     Barre.Min = 1
  290.     Picture1 = LoadPicture("")
  291. End Sub
  292. Sub Text1_KeyPress (KeyAscii As Integer)
  293.     If KeyAscii = 13 Then KeyAscii = 0: Command1_Click
  294. End Sub
  295.