2011-11-22 80 views
0

我試圖計算密碼有效期,而且大部分的示例代碼是C#在VB.net中將ActiveDs.LargeInteger轉換爲Long?

一個樣品有:

IADsLargeInteger largeInt; 
largeInt = (IADsLargeInteger) largeIntVal; 
myLong = (long)largeInt.HighPart << 32 | (uint)largeInt.LowPart; 

如果我嘗試類似的東西在VB.net:

dim myLong as Long 
myLong = largeInt.HighPart << 32 Or largeInt.LowPart 

然後我似乎得到一個無效的值。我怎樣才能在VB中獲得類似的結果?

回答

0

根據this問題是因爲VB.Net沒有無符號整數類。

的解決方案是:

props = resultDE.Properties("pwdLastSet") 
Dim prop As ActiveDs.LargeInteger 
prop = props(0) 

Dim int64Value As Long 
Dim strTemp As String 
strTemp = "&H" + CStr(Hex(prop.HighPart)) + CStr(Hex(prop.LowPart)) 
int64Value = Val(strTemp)