转换成JavaScript [英] convert into JavaScript

查看:104
本文介绍了转换成JavaScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

任何人都可以将以下代码行转换为Javascript.

Dear All,

Can anyone convert the following lines of code into Javascript.

Public Function GetLastSystemShutdown() As DateTime
        Dim sKey As String = "System\CurrentControlSet\Control\Windows"
        Dim key As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(sKey)
        Dim sValueName As String = "ShutdownTime"
        Dim val As Byte() = key.GetValue(sValueName)
        Dim valueAsLong As Long = BitConverter.ToInt64(val, 0)
        Return DateTime.FromFileTime(valueAsLong)
End Function



上面的代码是为了获取用户系统的最后关闭日期时间....
上面的代码有效,但仅返回服务器上次关闭的日期时间.

有什么建议............

在此先感谢...........



Above code is to get Users System Last Shutdown DateTime.......
Above code is working but returning only Server last shutdown datetime.

Any Suggestions............

Thanks in advance...........

推荐答案

为什么要将这段代码转换为JavaScript?

我猜你在做Asp.Net开发.如果我的假设是正确的,请使用" Ajax ".使用此功能,您可以从JavaScript执行服务器端代码(VB/C#).

请看下面有关" Asp.Net Ajax "的提示/技巧文章.在本文中,我使用了C#,但我认为理解" Ajax "的概念不应成为障碍.
简化Asp.Net Core Ajax

希望对您有所帮助.
Why you want to convert this code to JavaScript?

I guess you are doing Asp.Net development. If my assumption is correct then use "Ajax". Using this you can execute your Server side code(VB/C#) from JavaScript.

Have a look at my below Tips/Tricks Article on "Asp.Net Ajax". In this article, I have used C# but I think it should not be hurdle to understand concept of "Ajax".
Simplifying Asp.Net Core Ajax

Hope this is helpful.


在Firefox浏览器上有一个解决方案:

https://developer.mozilla.org/en/Accessing_the_Windows_Registry_Using_XPCOM [
There is a solution on Firefox browsers :

https://developer.mozilla.org/en/Accessing_the_Windows_Registry_Using_XPCOM[^]


这篇关于转换成JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆