最新活动:电脑PC端+手机端+微网站+自适应网页多模板选择-建站388元起价!!!
当前位置:主页 > 网站建设 > Access设置数字/大写指示灯的API函数建站知识

Access设置数字/大写指示灯的API函数建站知识

时间:2023-05-22 21:05:22 阅读: 文章分类: 网站建设 作者: 建站小能手

导读:1建站知识在access中使用sendkeys有时会导致数字或大写指示灯无故熄灭,故安全的办法还是使用API函数。 但最好尽量少用sendkeys,因为有时因为键误操作导网站优化seo培训个业网站建设公司。

网站优化seo培训个业网站建设公司在access中使用sendkeys有时会导致数字或大写指示灯无故熄灭,故安全的办法还是使用API函数。 但最好尽量少用sendkeys,因为有时因为键误操作导致错误。 作者:Dev Ashish '******** Code Start ***********       ' Declare Type for API call:       Private Type OSVERSIONINFO         dwOSVersionInfoSize As Long &n高端网站建设bsp;       dwMajorVersion As Long         dwMinorVersion As Long         dwBuildNumber As Long         dwPlatformId As Long         szCSDVersion As String * 128   '  Maintenance string for PSS usage       End Type       ' API declarations:       Private Declare Function GetVersionEx Lib "Kernel32" _          Alias "GetVersionExA" _          (lpVersionInformation As OSVERSIONINFO) As Long       Private Declare Sub keybd_event Lib "user32" _          (ByVal bVk As Byte, _           ByVal bScan As Byte, _           ByVal dwflags As Long, ByVal dwExtraInfo As Long)       Private Declare Function GetKeyboardState Lib "user32" _          (pbKeyState As Byte) As Long       Private Declare Function SetKeyboardState Lib "user32" _          (lppbKeyState As Byte) As Long       ' Constant declarations:       Const VK_NUMLOCK = &H90       Const VK_SCROLL = &H91       Const VK_CAPITAL = &H14       Const KEYEVENTF_EXTENDEDKEY = &H1       Const KEYEVENTF_KEYUP = &H2       Const VER_PLATFORM_WIN32_NT = 2       Const VER_PLATFORM_WIN32_WINDOWS = 1 Function IsCapsLockOn() As Boolean         Dim o As OSVERSIONINFO         o.dwOSVersionInfoSize = Len(o)         GetVersionEx o         Dim keys(0 To 255) As Byte         GetKeyboardState keys(0)         IsCapsLockOn = keys(VK_CAPITAL) End Function Sub ToggleCapsLock()         Dim o As OSVERSIONINFO         o.dwOSVersionInfoSize = Len(o)         GetVersionEx o         Dim keys(0 To 255) As Byte         GetKeyboardState keys(0)         If o.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS Then  '=====Win95         'Toggle capslock             keys(VK_CAPITAL) = Abs(Not keys(VK_CAPITAL))             SetKeyboardState keys(0)         ElseIf o.dwPlatformId = VER_PLATFORM_WIN32_NT Then   '=====WinNT           'Simulate Key Press>             keybd_event VK_CAPITAL, &H45, KEYEVENTF_EXTENDEDKEY Or 0, 0           'Simulate Key Release             keybd_event VK_CAPITAL, &H45, KEYEVENTF_EXTENDEDKEY _                Or KEYEVENTF_KEYUP, 0         End If End Sub Function IsNumLockOn() As Boolean         Dim o As OSVERSIONINFO                 o.dwOSVersionInfoSize = Len(o)   &网站建设教程nbsp;     GetVersionEx o         Dim keys(0 To 255) As Byte         GetKeyboardState keys(0)         IsNumLockOn = keys(VK_NUMLOCK) End Function Sub ToggleNumLock()         Dim o As OSVERSIONINFO                         o.dwOSVersionInfoSize = Len(o)         GetVersionEx o         Dim keys(0 To 255) As Byte         GetKeyboardState keys(0)           If o.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS Then  '=====Win95                 keys(VK_NUMLOCK) = Abs(Not keys(VK_NUMLOCK))                 SetKeyboardState keys(0)           ElseIf o.dwPlatformId = VER_PLATFORM_WIN32_NT Then   '=====WinNT           'Simulate Key Press             keybd_event VK_NUMLOCK, &H45, KEYEVENTF_EXTENDEDKEY Or 0, 0           'Simulate Key Release             keybd_event VK_NUMLOCK, &H45, KEYEVENTF_EXTENDEDKEY _                Or KEYEVENTF_KEYUP, 0           End If         End Sub Function IsScrollLockOn()         Dim o As OSVERSIONINFO                 o.dwOSVersionInfoSize = Len(o)         GetVersionEx o         Dim keys(0 To 255) As Byte         GetKeyboardState keys(0)         IsScrollLockOn = keys(VK_SCROLL) End Function Sub ToggleScrollLock()         Dim o As OSVERSIONINFO                 o.dwOSVersionInfoSize = Len(o)         GetVersionEx o         Dim keys(0 To 255) As Byte         GetKeyboardState keys(0)         If o.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS Then  '=====Win95             keys(VK_SCROLL) = Abs(Not keys(VK_SCROLL))             SetKeyboardState keys(0)         ElseIf o.dwPlatformId = VER_PLATFORM_WIN32_NT Then   '=====WinNT             'Simulate Key Press             keybd_event VK_SCROLL, &H45, KEYEVENTF_EXTENDEDKEY Or 0, 0             'Simulate Key Release             keybd_event VK_SCROLL, &H45, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0         End If End Sub Sub mySendKeys(sKeys As String, Optional bWait As Boolean = False) Dim bNumLockState As Boolean Dim bCapsLockState As Boolean Dim bScrollLockState As Boolean     bNumLockState = IsNumLockOn()   &n网站推广优化seobsp; bCapsLockState = IsCapsLockOn()     bScrollLockState = IsScrollLockOn()     SendKeys sKeys, bWait     If IsNumLockOn() <> bNumLockState Then         ToggleNumLock     End If     If IsCapsLockOn() <> bCapsLockState Then         ToggleCapsLock     End If     If IsScrollLockOn() <> bScrollLockState Then         ToggleScrollLock     End If End Sub Function fSendKeys(sKeys As String, Optional bWait As Boolean = False) ' Function to make it callable from macros     mySendKeys sKeys, bWait End Function '******** Code End ***********相关网站优化seo培训个业网站建设公司。

关键词标签: 函数 指示灯

声明: 本文由我的SEOUC技术文章主页发布于:2023-05-22 ,文章Access设置数字/大写指示灯的API函数建站知识主要讲述指示灯,函数,Access设置数字/大写指示灯的API函数网站建设源码以及服务器配置搭建相关技术文章。转载请保留链接: https://www.seouc.com/article/web_5246.html

我的IDC 网站建设技术SEOUC.COM
专注网站建设,SEO优化,小程序设计制作搭建开发定制网站等,数千家网站定制开发案例,网站推广技术服务。
  • 5000+合作客服
  • 8年从业经验
  • 150+覆盖行业
  • 最新热门源码技术文章