欧美特黄不卡,涩涩视频在线,成人国产精品一区二区网站,亚洲一区二区三区欧美

當前位置:雨林木風下載站 > 技術開發教程 > 詳細頁面

用Visual Basic提取圖標資源

用Visual Basic提取圖標資源

更新時間:2021-11-16 文章作者:未知 信息來源:網絡 閱讀次數:

文/云飛

  一、界面

  在窗體上放置一個對話框控件(Commondialog1),用于找到要提取圖標的程序文件;一個圖片框(Picture1),用來顯示圖標;一個水平滾動條(Hscroll1),用來逐個觀察;兩個命令按鈕,其Caption屬性分別設為“打開文件”和“退出”;四個標簽控件(Label),其Caption屬性分別設為“0”、“0”、“文件中圖標總數”和“當前圖標序號”。


  二、程序代碼

  聲明畫圖標函數DrawIcon

  聲明取得文件句柄函數GetModuleHandle

  聲明提取圖標函數ExtractIcon

  Dim icon_n As Integer

  Dim icon_filename As String

  Dim icon_num As Integer

  Dim x As Long

  Dim hmodule As Long

  Private Sub Command1_Click()

  CommonDialog1.FileName = ""

  CommonDialog1.Filter = "程序文件|*.exe"

  CommonDialog1.ShowOpen

  icon_filename = CommonDialog1.FileName

  Picture1.Cls

  hmodule = GetModuleHandle(icon_filename) '取得文件句柄

  icon_num = ExtractIcon(hmodule, icon_filename, -1) '得到文件內圖標總數

  HScroll1.Max = icon_num

  Label1.Caption = Str(icon_num)

  If icon_num - 1 > 0 Then

  HScroll1.Enabled = True

  Else

  HScroll1.Enabled = False

  End If

  icon_n = ExtractIcon(hmodule, icon_filename, 0) '提取第一個圖標

  x = DrawIcon(Picture1.hdc, 0, 0, icon_n) '畫出圖標

  If icon_num = 0 Then

  HScroll1.Value = 0

  Else

  HScroll1.Value = 1

  End If

  Label2.Caption = HScroll1.Value

  End Sub

  Private Sub Command2_Click()

  End

  End Sub

  Private Sub HScroll1_Change()

  Picture1.Cls

  icon_n = HScroll1.Value

  hmodule = GetModuleHandle(icon_filename)

  icon_n = ExtractIcon(hmodule, icon_filename, icon_n - 1)

  Label2.Caption = HScroll1.Value

  x = DrawIcon(Picture1.hdc, 0, 0, icon_n)

  End Sub 

溫馨提示:喜歡本站的話,請收藏一下本站!

本類教程下載

系統下載排行

主站蜘蛛池模板: 突泉县| 当阳市| 台湾省| 米易县| 偃师市| 酒泉市| 顺义区| 珲春市| 阜新| 龙海市| 交城县| 兴国县| 和政县| 安西县| 阳信县| 怀宁县| 安溪县| 正阳县| 蓬莱市| 保定市| 泰州市| 禄劝| 博白县| 沛县| 凌海市| 布尔津县| 板桥市| 阿巴嘎旗| 中西区| 凉城县| 余姚市| 当阳市| 米易县| 阜康市| 岗巴县| 临朐县| 株洲县| 崇阳县| 磴口县| 综艺| 潞城市|