隐藏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