Private Declare Function systemparametersinfo Lib "user32" Alias _
"systemparametersinfoa" (ByVal uaction As Long, ByVal uparam As Long, _
ByVal lpvparam As Any, ByVal fuwinini As Long) As Long
'退出windows所需的常量
Const ewx_logoff = 0
Const ewx_shutdown = 1
Const ewx_reboot = 2
Const ewx_force = 4
Private Declare Function exitwindowsex Lib "use32" (ByVal uflags As Long, _
ByVal dwreserved As Long) As Long
'alwaysontop 函数中使用到的方法
Const flags = 3
Const hwnd_topmost = -1
Const hwnd_notopmost = -2
Public settop As Boolean
Private Declare Function setwindowspos Lib "user32" (ByVal h%, ByVal hb%, ByVal x%, _
ByVal y%, ByVal cx%, ByVal f%) As Integer
'退出windows的函数方法
Sub exitwindows(exitmode As String)
'几种选项
Select Case exitmode
Case Is = "shutdown"
t& = exitwindowsex(ewx_shutdown, 0)
Case Is = "reboot"
t& = exitwindowsex(ewx_reboot Or exw_force, 0)
Case Else
MsgBox ("错误")
End Select
End Sub
'将窗体直于顶层
Sub alwaysontop(formname As Form, bontop As Boolean)
Dim success As Integer
If bontop = False Then
success% = setwindowspos(formname.hWnd, hwnd_topmost, 0, 0, 0, 0, flags)
Else
success% = setwindowspos(formname.hWnd, hwnd_notopmost, 0, 0, 0, 0, flags)
End If
End Sub
Sub disablectrlaltdelete(bdisabled As Boolean)
'让windows的热键失效
Dim x As Long
x = systemparametersinfo(97, bdisabled, CStr(1), 0)End Sub
Sub openapp(file As String)
x = Shell(file)
End Sub
Private Sub Form_Click()
ter = False
disablectrldelete (False)
Load frmLogin
frmLogin.Show
End SubPrivate Sub Form_GotFocus()
frmLogin.SetFocus
End SubPrivate Sub Form_Load()
disablectrlaltdelete (True)
ter = TrueEnd Sub

解决方案 »

  1.   

    错误提示是“实时错误453”找不到dll入口点systemparametersinfoa in user32
      

  2.   

    Private Declare Function systemparametersinfo Lib "user32" Alias _
    "systemparametersinfoa" (ByVal uaction As Long, ByVal uparam As Long, _
    ByVal lpvparam As Any, ByVal fuwinini As Long) As Long
    "systemparametersinfoa"这个最后的a去掉吧,好像是unicode和什么的区别