VB6.0记录

隐藏SSTAB的某个页面

方法很简单,使用TabVisiable,如下图
在这里插入图片描述

win10中打开VB6工程,提示MSCOMCTL.OCX无法加载

从网上下载了相应的ocx文件,放在系统盘的system32文件夹下,VB6工程还是无法加载;又发现,sysWOW64文件夹下,我之前已经安装了这个ocx,那么就不是缺少ocx文件的事情了。
最后,在网上找到一个方法,实测有用,贴在下面,
在这里插入图片描述

自动寻找可用串口并打开

在这里插入图片描述

改变控件的事件类型

可以在IDE的右上角改变控件事件的类型
在这里插入图片描述

将脚本嵌入到工程中并运行

添加脚本文件到RES文件中,
在这里插入图片描述

Option Explicit

Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Const PROCESS_QUERY_INFORMATION = &H400
Const STILL_ALIVE = &H103

Private Sub Command1_Click()

    ''生成脚本文件
    Dim resData() As Byte
    Dim resDataStr As String
    Dim filePath As String
    Dim fid As Integer
    
    resData = LoadResData(101, "CUSTOM")
    resDataStr = StrConv(resData, vbUnicode)
    
    filePath = App.Path & "\int_Xilinx_ISE_Check.pl"
    fid = FreeFile
    Open filePath For Output As #fid
    Print #fid, resDataStr
    Close #fid
    
    ''从界面中获取参数
    Dim myVar_1 As Long
    Dim myVar_2 As Long
    If (Check1.Value = Checked) Then
        myVar_1 = 1
    Else
        myVar_1 = 0
    End If
    
    If (Check2.Value = Checked) Then
        myVar_2 = 1
    Else
        myVar_2 = 0
    End If
    
    ''在Shell中运行命令
    Dim cmd_line As String
    Dim shellResult As Long
    Dim ExitCode As Long
    Dim hProcess As Long
    cmd_line = "perl int_Xilinx_ISE_Check.pl " & " " & myVar_1 & " " & myVar_2
    shellResult = Shell("cmd /c " & cmd_line, vbNormalFocus)
    hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, 0, shellResult)
    Do
        Call GetExitCodeProcess(hProcess, ExitCode)
    Loop While ExitCode = STILL_ALIVE
    Call CloseHandle(hProcess)
    ''Shell运行完成后删除文件
    Kill filePath
    
End Sub

对象库未注册问题

在这里插入图片描述

位运算

以下代码见 https://blog.csdn.net/lyserver/article/details/5985681

'位左移
Public Function SHL(nSource As Long, n As Byte) As Long
    SHL = nSource * 2 ^ n
End Function

'位右移
Public Function SHR(nSource As Long, n As Byte) As Long
    SHR = nSource / 2 ^ n
End Function

'获得指定的位
Public Function GetBits(nSource As Long, n As Byte) As Boolean
    GetBits = nSource And 2 ^ n
End Function

'设置指定的位
Public Function SetBits(nSource As Long, n As Byte) As Long
    SetBits = nSource Or 2 ^ n
End Function

'清除指定的位
Public Function ResetBits(nSource As Long, n As Byte) As Long
    ResetBits = nSource And Not 2 ^ n
End Function
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值