⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 本文件包含200个visual baisc实例
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1 
   Caption         =   "提取并保存EXE文件的图标"
   ClientHeight    =   2145
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3540
   LinkTopic       =   "Form1"
   ScaleHeight     =   143
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   236
   StartUpPosition =   1  '所有者中心
   Begin VB.PictureBox Picture1 
      AutoRedraw      =   -1  'True
      AutoSize        =   -1  'True
      BackColor       =   &H00FFFFFF&
      Height          =   690
      Left            =   600
      ScaleHeight     =   630
      ScaleWidth      =   675
      TabIndex        =   4
      Top             =   735
      Width           =   735
   End
   Begin VB.CommandButton Command2 
      Caption         =   "图标另存为"
      Height          =   375
      Left            =   1740
      TabIndex        =   3
      Top             =   1095
      Width           =   1440
   End
   Begin VB.CommandButton Command3 
      Caption         =   "退出"
      Height          =   375
      Left            =   1740
      TabIndex        =   1
      Top             =   1635
      Width           =   1440
   End
   Begin VB.CommandButton command1 
      Caption         =   "打开文件"
      Height          =   375
      Left            =   1755
      TabIndex        =   0
      Top             =   600
      Width           =   1440
   End
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   285
      Top             =   1635
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "提取的EXE文件图标为:"
      Height          =   255
      Left            =   240
      TabIndex        =   2
      Top             =   105
      Width           =   2220
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function ExtractIcon& Lib "shell32.dll" Alias "ExtractIconA" _
(ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long)
Private Declare Function DrawIcon& Lib "user32" (ByVal hDC As Long, ByVal X As Long, _
ByVal Y As Long, ByVal hIcon As Long)
Private Sub Command1_Click()
  Dim X As Integer
  Dim myval As Integer
  CommonDialog1.Filter = "EXE文件|*.EXE"    '打开文件对话框
  CommonDialog1.ShowOpen
  myval = ExtractIcon(hInst, CommonDialog1.FileName, -1)
  Picture1.Cls
  hIcon = ExtractIcon(0, CommonDialog1.FileName, 0)   '提取图标
  X = DrawIcon(Picture1.hDC, 5, 5, hIcon)    '在图片控件中显示图标
End Sub
Private Sub Command2_Click()
  Dim FileName As String
  On Error Resume Next
  Picture1.Picture = Picture1.Image
  CommonDialog1.DialogTitle = "保存"
  CommonDialog1.Flags = cdlOFNHideReadOnly Or cdlOFNOverwritePrompt
  CommonDialog1.Filter = "位图文件(*.ico)|*.ico"
  CommonDialog1.ShowSave
  If Err = 32755 Then Exit Sub
  FileName = CommonDialog1.FileName
  If FileName <> "" Then
     SavePicture Picture1.Picture, FileName '保存图标
  End If
End Sub
Private Sub Command3_Click()
  End
End Sub


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -