VB6.0读取INI参数,解决了中文后面的多出空格的问题,测试OK
Option Explicit
' API函数声明,用于读取INI文件
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private Sub Form_Load()
Me.Hide
Dim iniFilePath As String
Dim 文本 As String
Dim 坐标X As String
Dim 坐标Y As String
Dim 字体 As String
Dim 颜色 As String
Dim 字号 As String
Dim 透明 As String
Dim 时间 As String
' 指定INI文件路径
iniFilePath = App.Path & "\logo.ini"
' 读取INI文件中的参数
文本 = ReadIniValue("logo", "文本", iniFilePath)
坐标X = ReadIniValue("logo", "坐标X", iniFilePath)
坐标Y = ReadIniValue("logo", "坐标Y", iniFilePath)
字体 = ReadIniValue("logo", "字体", iniFilePath)
颜色 = ReadIniValue("logo", "颜色", iniFilePath)
字号 = ReadIniValue("logo", "字号", iniFilePath)
透明 = ReadIniValue("logo", "透明", iniFilePath)
时间 = ReadIniValue("logo", "时间", iniFilePath)
' 生成完整的命令行
Dim command As String
command = "start text.dll" & _
" /m:" & 文本 & _
" /x:" & 坐标X & _
" /y:" & 坐标Y & _
" /f:" & 字体 & _
" /fh:" & 字号 & _
" /ftc:""" & 颜色 & """" & _
" /o:" & 透明 & _
" /t:" & 时间 & _
" /fi:0 /fbc:""255 255 255"" /bc:""0 0 0"""
'在窗口上显示生成的命令
'Me.Caption = "生成命令行"
'Me.AutoRedraw = True
'Me.Print "生成的命令:"
'Me.Print command
' 将生成的命令保存到1.bat文件中
Dim FilePath As String
FilePath = App.Path & "\1.bat"
Open FilePath For Output As #1
Print #1, command
Close #1
'MsgBox "命令已保存到 " & FilePath, vbInformation, "保存成功"
Shell FilePath, vbHide '执行命令并显示命令行窗口
End
End Sub
' 读取INI文件中的指定键值
Private Function ReadIniValue(ByVal Section As String, ByVal Key As String, ByVal FilePath As String) As String
Dim Buffer As String
Dim BufferSize As Long
Dim RetVal As Long
Buffer = String$(255, 0) ' 初始化缓冲区
BufferSize = Len(Buffer)
'调用API函数读取INI文件中的值
RetVal = GetPrivateProfileString(Section, Key, "", Buffer, BufferSize, FilePath)
'根据chr(0)的位置来截取字符串
ReadIniValue = Left$(Buffer, InStr(Buffer, Chr(0)) - 1)
End Function
Virtual-Key Codes
https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes密码验证完美版V1.2
置顶窗口测试OK
' 在模块中声明 API 函数和常量
Option Explicit
Private Declare Function SetWindowPos Lib "user32" ( _
ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, _
ByVal cx As Long, ByVal cy As Long, ByVal uFlags As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" ( _
ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" ( _
ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const GWL_EXSTYLE As Long = -20
Private Const WS_EX_TOPMOST As Long = &H8
Private Const SWP_NOMOVE As Long = &H2
Private Const SWP_NOSIZE As Long = &H1
Private Const SWP_SHOWWINDOW As Long = &H40
Private Const HWND_TOPMOST As Long = -1
Private Const HWND_NOTOPMOST As Long = -2
Private Sub Form_Load()
' 调用函数设置窗体置顶
SetFormTopMost Me.hwnd, True
End Sub
' 声明一个公共子程序来设置窗体的置顶状态
Public Sub SetFormTopMost(ByVal hwnd As Long, ByVal TopMost As Boolean)
Dim lStyle As Long
' 获取当前窗口扩展样式
lStyle = GetWindowLong(hwnd, GWL_EXSTYLE)
' 根据 TopMost 参数设置或清除 WS_EX_TOPMOST 标志
If TopMost Then
lStyle = lStyle Or WS_EX_TOPMOST
Else
lStyle = lStyle And Not WS_EX_TOPMOST
End If
' 设置新的窗口扩展样式
SetWindowLong hwnd, GWL_EXSTYLE, lStyle
' 通过 SetWindowPos 刷新窗口的 Z 顺序,确保置顶状态生效
' 注意:这里我们不改变窗口的位置和大小,只刷新 Z 顺序
SetWindowPos hwnd, IIf(TopMost, HWND_TOPMOST, HWND_NOTOPMOST), 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or SWP_SHOWWINDOW
End Sub
仅在本地显示器显示的,不能被截屏的窗口
VirtualCamera最新版安装包下载
2025-2-13 乱云飞 评论(0) 浏览(118) 标签: 虚拟监控 电脑录屏 VirtualCamera
http://80c.cc/onvif_20251005c.exeEXE窗口添加LOGO资源
CONTROL "LOGO", 0, STATIC, SS_BITMAP | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 60, 186, 27隐藏任务栏,显示任务栏,测试OK
2025-1-4 乱云飞 评论(0) 浏览(113) 标签: 显示任务栏 隐藏任务栏
nircmd win togglehide class Shell_TrayWnd //切换 nircmd win hide class Shell_TrayWnd //隐藏 nircmd win show class Shell_TrayWnd //显示 nircmd win trans class Shell_TrayWnd 128 //透明
批处理添加程序允许通过防火墙
netsh advfirewall firewall add rule name="ezsoft" dir=in action=allow program="C:\test.exe" enable=yes批处理检测系统是否安装了PowerShell
@echo off
setlocal
:: 尝试运行powershell -command "exit" 并捕获退出代码
powershell -command "exit" >nul 2>&1
set "PSExitCode=%errorlevel%"
:: 检查退出代码
if %PSExitCode% equ 0 (
echo PowerShell 已安装。
) else (
echo PowerShell 未安装。
)
endlocal
pause