Someone on the Internet today asked this, just explained it, please see:
Http://community.9cbs.net/expert/topic/3417/3417578.xml?temp=.30534 I have outdated a new project, plus two label: Label1 and Label2 on the form; The VScroll1 and Picture1 sample source code is as follows:
Option expedition
Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As LongPrivate Declare Function ExtractIcon Lib "shell32" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName AS String, Byval Niconindex As Long AS Longprivate Declare Function Destroyicon LIB "User32" (Byval Hicon As Long) As Long
'This path changes Private const SiConfile as string = "c: /winnt/system32/User32.dll" according to your system
Private Sub Form_Load () Dim hIcon As Long Dim nIconCount As Long nIconCount = ExtractIcon (0 &, sIconFile, -1) If nIconCount> 0 Then VScroll1.Min = 0 VScroll1.Max = nIconCount - 1 VScroll1.Value = 0 Label1.Caption = NiconCount & "An Icon" Call vscroll1_change end ifend sub
Private Sub VScroll1_Change () Dim index As Long Dim hIcon As Long index = VScroll1.Value If index <= VScroll1.Max Then Picture1.Cls hIcon = ExtractIcon (0 &, sIconFile, index) Call DrawIcon (Picture1.hdc, 0, 0, HiCon) Call Destroyicon (HICON) Label2.caption = "Sequence Number" & index End IFEND SUB
Private Sub VScroll1_Scroll () Dim index As Long Dim hIcon As Long index = VScroll1.Value If index <= VScroll1.Max Then Picture1.Cls hIcon = ExtractIcon (0 &, sIconFile, index) Call DrawIcon (Picture1.hdc, 0, 0, HiC Destroyicon (HICON) Label2.caption = "Serial:" & Index end iFend Sub "----------------------------- -------------- 'please indicate the source' author: Don just fine 'E-mail: tanaya@163.com' ----------------- ----------------------------