WinRT Replacement of System.Environment.TickCount

戏子无情 提交于 2019-12-10 02:09:49

问题


What is the WinRT replacement for System.Environment.TickCount?


回答1:


It should be available, because it isn't a problem. But it is not, a [TypeForwardedTo] hangup I guess because GetTickCount() isn't on the white list and .NET never adopted GetTickCount64. The standard fallback works fine, you can use pinvoke the call the native Windows function. I verified that a program that uses it passes the Windows App Certification Kit test.

    [System.Runtime.InteropServices.DllImport("kernel32.dll")]
    private static extern long GetTickCount64();

Note that it returns a long, not an int. You can simply cast to int to truncate if that's important in C# (but not vb.net, just lie about the return type)




回答2:


It appears System.Environment.TickCount is supported in Windows 8 Windows store apps now.



来源:https://stackoverflow.com/questions/10369346/winrt-replacement-of-system-environment-tickcount

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!