Hi All,
I have some code that has been working very well at our work place. The problem is some of the PC's have been upgraded to 64bit and on these PC's the code gets the following Complie error message
"The code in this project must be updated for use on 64-bit systems. Please review and update Declare statements and then mark them with the PtrSafe attribute."
The code is below and I need it to be able to work on both 32bit and 64bit machine's is this possiable?
Private Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(0 To 7) As Byte
End Type
Private Declare Function CoCreateGuid _
Lib "OLE32.dll" (ByRef pGuid As GUID) As Long
Public Function GetGUID() As String
Dim I As Integer
Dim myGUID As GUID
Dim S As String
If (CoCreateGuid(myGUID) = 0) Then
S = _
String(8 - Len(Hex$(myGUID.Data1)), "0") & Hex$(myGUID.Data1) & "-" & _
String(4 - Len(Hex$(myGUID.Data2)), "0") & Hex$(myGUID.Data2) & "-" & _
String(4 - Len(Hex$(myGUID.Data3)), "0") & Hex$(myGUID.Data3) & "-"
For I = 0 To 7
S = S & IIf(myGUID.Data4(I) < &H10, "0", "") & Hex(myGUID.Data4(I))
If I = 1 Then S = S & "-"
Next I
GetGUID = S
End If
End Function
Thanks in advance.BJ
Bookmarks