易截截图软件、单文件、免安装、纯绿色、仅160KB

VB获取执行程序图标

一个CommonDialog,一个CommandButton,一个PictureBOX
Option Explicit
Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
Private Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long
Private Sub Command1_Click()
Dim total As Long
Dim p(50) As Long
Dim i As Integer
Me.Picture1.Cls
Me.CommonDialog1.Filter = "图标|*.Exe;*.Ico;*.Dll"
Me.CommonDialog1.ShowOpen
If Dir(Me.CommonDialog1.FileName) <> "" Then
If ExtractIcon(App.hInstance, Me.CommonDialog1.FileName, -1) = 0 Then '如果没有图标
MsgBox "No Icon!"
Else
total = ExtractIcon(App.hInstance, Me.CommonDialog1.FileName, -1)
'取得总图标数
For i = 0 To total - 1
p(i) = ExtractIcon(App.hInstance, Me.CommonDialog1.FileName, i) '读取每个图标
Next i
For i = 0 To total - 1 '依次显示每个图标
DrawIcon Picture1.hdc, 34 * i, 0, p(i)
Next i
End If
End If
End Sub


相关文档:

VB六个数取最大值和平均数的平方

VERSION 5.00
Begin VB.Form Form2
   AutoRedraw      =   -1  'True
   Caption         =   "计算界面"
   ClientHeight    =   4905
   ClientLe ......

VB 单实例运行

VB6
在程序运行时用如下语句:
if   app.PrevInstance=true   then  
            end    
end   if
VB 2005:
1. 在VB2005中,打开"属性"页,启用"应用程序“框架, 选中"
单实例应用程序"前面复选框,就行了。
......

VB 简单计算器

Option Explicit
Dim potflag As Integer      '标识是否用小数点
Dim numcol As Integer       ' 点击运算符的个数
Dim LastInput               ' 指示上一次操作的内容
Dim colflag ......

vb用api调用对话框

建一个模块
Public Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
Public Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilt ......

VB怎样判断、防止程序重复执行

Private Sub Form_load()
    '判断程序是否已经运行
    If App.PrevInstance
Then
     MsgBox "本程序已经运行!", vbInformation Or vbOKOnly, "提示信息"
     Unload
Me
     Exit Sub
&n ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号