请问各位朋友:   怎么样使VB程序在运行时锁定该计算机的时间......在下一次运行时同样的锁住...(下一次运行时只进行判断)修改注册表!!!
给点源程序
谢谢!!!
Dim hregkey As Long  
Dim secattr As SECURITY_ATTRIBUTES  ' security settings of the key
Dim subkey As String  ' name of the subkey to create
Dim neworused As Long  ' receives 1 if new key was created or 2 if an existing key was opened
Dim stringbuffer As Long   ' the string to put into the registry
Dim retval As Long  ' return value'' Set the name of the new key and the default security settings
subkey = "Software\Microsoft\windows\CurrentVersion\policies\Explorer"
secattr.nLength = Len(secattr)  ' size of the structure
secattr.lpSecurityDescriptor = 0  ' default security level
secattr.bInheritHandle = True  ' the default value for this setting
'
'' Create or open the registry key
retval = RegCreateKeyEx(hkey_local_machine, subkey, 0, "", 0, KEY_WRITE, secattr, hregkey, neworused)
'If retval <> 0 Then  ' error during open
'  Debug.Print "Error opening or creating registry key -- aborting."
'  End  ' terminate the program
'End If' Write the string to the registry.  Note that because Visual Basic is being used, the string passed to the
' function must explicitly be passed ByVal.
stringbuffer = 1         ' note how a null character must be appended to the string
retval = RegSetValueEx(hregkey, "norun", 0, REG_DWORD, stringbuffer, Len(stringbuffer))  ' write the string
End Sub
请问这达到什么样的功能!!!!

解决方案 »

  1.   

    如果只是防止别人手动更改系统时间的话,可以修改系统文件夹下的删除Timedate.cpl文件。
    但是对于使用代码更改系统时间无能为力。
      

  2.   

    你可以在程序运行时,获得时间,
    在用timer控件每秒钟设置时间,
    这样其它程序修改了马上又改回去了
    要注意当前时间要用第一次获得的时间,不要每次都用当前时间
      

  3.   

    不过这个始BIOS时间,可以改的