zoukankan      html  css  js  c++  java
  • 最新开发的消费平台开发过程 持续更新(二)

    VB 模块部分代码

    'API函数声明
    Option Explicit
    Public Const HKEY_CLASSES_ROOT = &H80000000
    Public Const HKEY_CURRENT_USER = &H80000001
    Public Const HKEY_LOCAL_MACHINE = &H80000002
    Public Const HKEY_USERS = &H80000003
    Public Const HKEY_PERFORMANCE_DATA = &H80000004
    Public Const HKEY_CURRENT_CONFIG = &H80000005
    Public Const HKEY_DYN_DATA = &H80000006
    Const ERROR_SUCCESS = 0&
    Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
    Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
    Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
    '读取某个Key的指定名称的值
    Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
    Declare Function RegSetValueExA Lib "advapi32.dll" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByRef lpData As Long, ByVal cbData As Long) As Long

    Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
    Private Declare Function GetVolumeInformation& Lib "kernel32" _
        Alias "GetVolumeInformationA" (ByVal lpRootPathName _
        As String, ByVal pVolumeNameBuffer As String, ByVal _
        nVolumeNameSize As Long, lpVolumeSerialNumber As Long, _
        lpMaximumComponentLength As Long, lpFileSystemFlags As _
        Long, ByVal lpFileSystemNameBuffer As String, ByVal _
        nFileSystemNameSize As Long)
        Const MAX_FILENAME_LEN = 256
    Sub Main()
    '设置IE8模式
    Dim ret As Long, hKey As Long, hKey2 As Long, lenData As Long, typeData As Long
    Dim filename As String
    Dim strErr As String

    filename = App.EXEName & ".exe"

    ret = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION", hKey)
    If ret <> 0 Then
    ret = RegCreateKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION", hKey)
    End If

     ret = RegQueryValueEx(hKey, filename, 0, typeData, ByVal 0, lenData)
      If ret <> 0 Then
       If RegSetValueExA(hKey, filename, 0, &H4, 8, 4) <> ERROR_SUCCESS Then
        strErr = "设置注册表时出错"
       End If
     End If

    If strErr <> "" Then
    MsgBox strErr
    End If

    RegCloseKey hKey
       
      '启动form
      MainWin.Show
      'Logo.Show
     
      End Sub
    Public Function SerNum(Drive$) As Long '获取硬盘序列号
        Dim No&, s As String * MAX_FILENAME_LEN
        Call GetVolumeInformation(Drive + ":\", s, MAX_FILENAME_LEN, _
        No, 0&, 0&, s, MAX_FILENAME_LEN)
        SerNum = No
    End Function

  • 相关阅读:
    P1135 奇怪的电梯
    pycharm设置快捷键在keymap下拉列表没有eclipse怎么办
    记录selenium简单实现自动点击操作
    selenium 批量下载文件,json,重命名
    python3.6+selenium使用chrome浏览器自动将文件下载到指定路径
    selenium + Java 设置文件默认下载路径
    详解介绍Selenium常用API的使用Java语言(完整版)
    Pycharm安装robot framework运行插件
    Python之robotframework+pycharm测试框架!
    基于Python3 Robot framework环境搭建
  • 原文地址:https://www.cnblogs.com/aibo/p/2191698.html
Copyright © 2011-2022 走看看