home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / iconbrow / iconbrow.bas next >
BASIC Source File  |  1992-04-11  |  1KB  |  38 lines

  1. DefInt A-Z
  2. Const GWW_HINSTANCE = (-6)
  3. Declare Function GetWindowWord Lib "User" (ByVal hWnd As Integer, ByVal nIndex As Integer) As Integer
  4. Declare Function ExtractIcon Lib "shell" (ByVal lpHandle As Integer, ByVal lpExe As String, ByVal lpiconindex As Integer) As Integer
  5. Declare Function DrawIcon Lib "USER" (ByVal lpHandle As Integer, ByVal xcoord As Integer, ByVal ycoord As Integer, ByVal Hicon As Integer) As Integer
  6.  
  7. Sub Extractor (ExeFile$)
  8. Handle = Form1.hWnd
  9. z = SCREEN.HEIGHT
  10.     Select Case z
  11.         Case 7000
  12.             X = 2: Y = 1
  13.         Case 7200
  14.             X = 3: Y = 0
  15.         Case 9000
  16.             X = 3: Y = 0
  17.         Case Is > 9000
  18.             X = 8: Y = 4
  19.     End Select
  20.                 
  21.     Static Looper
  22.     Looper = Looper + 1
  23.     Inst = GetWindowWord(Handle, GWW_HINSTANCE)
  24.     Hicon = ExtractIcon(Inst, ExeFile$, Looper - 1)
  25.     If Hicon = 0 Then
  26.         If Looper > 0 Then
  27.             Hicon = ExtractIcon(Inst, ExeFile$, 0)
  28.             Looper = 1
  29.         Else Beep: Exit Sub
  30.         End If
  31.     End If
  32.     Form1.Label2.Caption = "Icon: " + Str$(Looper)
  33.     Form1.Label2.Refresh
  34.     Form1.Picture2.Cls
  35.     Draw = DrawIcon(Form1.Picture2.hDC, X, Y, Hicon)
  36. End Sub
  37.  
  38.