sanders1969
Gebruiker
- Lid geworden
- 29 dec 2018
- Berichten
- 243
Ik heb een functie: MD5Hash en ik heb keurig de 64 bits onderscheden van de 32 bits echter gaat er op een 64 bits office over zn nek bij de laatste regel: rngdata2 = StrConv(rngdata, vbFromUnicode)
"StrConv" wordt niet herkent. Ziet iemand meteen wat ik kennelijk fout doe?
Ik heb dezelfde applicatie op een ander 64 bits office draaien en daar gaat het gewoon goed dus begrijp niet waarom ie over de zeik is.
"StrConv" wordt niet herkent. Ziet iemand meteen wat ik kennelijk fout doe?
Ik heb dezelfde applicatie op een ander 64 bits office draaien en daar gaat het gewoon goed dus begrijp niet waarom ie over de zeik is.
Code:
Option Compare Database
#If Win64 Then
Declare PtrSafe Function CryptAcquireContext Lib "advapi32" Alias "CryptAcquireContextA" (ByRef hProv As Long, ByVal sContainer As String, ByVal sProvider As String, ByVal lProvType As Long, ByVal lFlags As Long) As Long
Declare PtrSafe Function CryptCreateHash Lib "advapi32" (ByVal hProv As Long, ByVal lALG_ID As Long, ByVal hKey As Long, ByVal lFlags As Long, ByRef hhash As Long) As Long
Declare PtrSafe Function CryptHashData Lib "advapi32" (ByVal hhash As Long, ByVal lDataPtr As Long, ByVal lLen As Long, ByVal lFlags As Long) As Long
Declare PtrSafe Function CryptGetHashParam Lib "advapi32" (ByVal hhash As Long, ByVal lParam As Long, ByVal sBuffer As String, ByRef lLen As Long, ByVal lFlags As Long) As Long
Declare PtrSafe Function CryptDestroyHash Lib "advapi32" (ByVal hhash As Long) As Long
Declare PtrSafe Function CryptReleaseContext Lib "advapi32" (ByVal hProv As Long, ByVal lFlags As Long) As Long
#Else
Declare Function CryptAcquireContext Lib "advapi32" Alias "CryptAcquireContextA" (ByRef hProv As Long, ByVal sContainer As String, ByVal sProvider As String, ByVal lProvType As Long, ByVal lFlags As Long) As Long
Declare Function CryptCreateHash Lib "advapi32" (ByVal hProv As Long, ByVal lALG_ID As Long, ByVal hKey As Long, ByVal lFlags As Long, ByRef hhash As Long) As Long
Declare Function CryptHashData Lib "advapi32" (ByVal hhash As Long, ByVal lDataPtr As Long, ByVal lLen As Long, ByVal lFlags As Long) As Long
Declare Function CryptGetHashParam Lib "advapi32" (ByVal hhash As Long, ByVal lParam As Long, ByVal sBuffer As String, ByRef lLen As Long, ByVal lFlags As Long) As Long
Declare Function CryptDestroyHash Lib "advapi32" (ByVal hhash As Long) As Long
Declare Function CryptReleaseContext Lib "advapi32" (ByVal hProv As Long, ByVal lFlags As Long) As Long
#End If
Const MS_DEF_PROV = "Microsoft Base Cryptographic Provider v1.0"
Const PROV_RSA_FULL As Long = 1
Const CRYPT_NEWKEYSET As Long = 8
Const CALG_MD5 As Long = 32771
Const HP_HASHVAL As Long = 2
Public Function MD5Hash(rngdata) As String
Dim rngdata2 As String
Dim hProv As Long
Dim hhash As Long
Dim lLen As Long
Dim sBuffer As String
Dim sBuffer2 As String
Dim lresult As Long
Dim i As Long
CryptAcquireContext hProv, vbNullString, MS_DEF_PROV, PROV_RSA_FULL, 0
If hProv = 0 Then
CryptAcquireContext hProv, vbNullString, MS_DEF_PROV, PROV_RSA_FULL, CRYPT_NEWKEYSET
End If
If hProv <> 0 Then
CryptCreateHash hProv, CALG_MD5, 0, 0, hhash
If hhash <> 0 Then
rngdata2 = StrConv(rngdata, vbFromUnicode)