这是程序自动创建的原创文学。

vb6读写系统临时目录 temp

[不指定 2021/11/29 00:10 | by admin ]
窗口一个按钮,一个文本,简洁代码短少,无需API长篇大论。。

vb6快速读取txt

[ 2021/11/12 12:36 | by admin ]
一、建立模版

Function GetFile(FileName As String) As String
Dim i As Integer, s As String, BB() As Byte
If Dir(FileName) = "" Then Exit Function
i = FreeFile
ReDim BB(FileLen(FileName) - 1)
Open FileName For Binary As #i
Get #i, , BB
Close #i
s = StrConv(BB, vbUnicode)
GetFile = s
End Function

vb6打开默认浏览器网站

[ 2021/11/10 18:17 | by admin ]
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long,
ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory
As String, ByVal nShowCmd As Long) As Long



Private Sub web_Click() '这里是按钮名称web
  ShellExecute 0, "open", "http://www.hkfx.net", 0, 0, 1
End Sub


vb6 List列表增加一行数据

[ 2021/11/10 17:47 | by admin ]
前言:之前我说过,因为学习资料严重缺少,古老语言慢慢被丢失,所以先发一些简单代码。

Private Sub Command1_Click()  '这是按钮1名称
    add_item = InputBox("在此处输入一个英文软件包名", "增加软件")
    If add_item <> "" Then
    List1.AddItem add_item
    End If
End Sub


vb6 右键弹出菜单

[不指定 2021/11/10 17:37 | by admin ]
前言:因为古老语言,网上越来越小相关资料,中文搜索相关内容越来越少,故止新开一版块,专为编程而生。
Private Sub list1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 'List1为组件名称
If Button And vbRightButton Then   '弹菜单,判断名称
    PopupMenu list '弹出(添加)菜单栏的名称,必须有子菜单才能正确使用
    End If
End Sub


版块建立时间:2021/11/10

VB6不会残留图标托盘

[ 2019/12/27 00:33 | by admin ]
建立托盘命名为Popup,再建立Picture1命名为Pic


Private Type NOTIFYICONDATA
    cbSize As Long
    hWnd As Long
    uId As Long
    uFlags As Long
    ucallbackMessage As Long
    hIcon As Long
    szTip As String * 64
End Type

Private Const NIM_ADD = &H0
Private Const NIM_MODIFY = &H1
Private Const NIM_DELETE = &H2
Private Const WM_MOUSEMOVE = &H200
Private Const NIF_MESSAGE = &H1
Private Const NIF_ICON = &H2
Private Const NIF_TIP = &H4

Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA"
(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
Dim t As NOTIFYICONDATA


Private Sub Form_Load()
    t.cbSize = Len(t)
    t.hWnd = Pic.hWnd
    t.uId = 1&
    t.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
    t.ucallbackMessage = WM_MOUSEMOVE
    t.hIcon = Pic.Picture
    t.szTip = "红防安全吧" & Chr$(0)
    Shell_NotifyIcon NIM_ADD, t
End Sub


 '清理图标
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    t.cbSize = Len(t)
    t.hWnd = Pic.hWnd
    t.uId = 1&
    Shell_NotifyIcon NIM_DELETE, t
End Sub


'弹出菜单
Private Sub pic_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    If Hex(x) = "1E3C" Then
        Me.PopupMenu Popup
    End If
End Sub
分页: 1/1 第一页 1 最后页 [ 显示模式: 摘要 | 列表 ]