I know this subject has been discussed many times, but I cannot find an answer that I've been able to implement successfully.
I'm upgrading a VB6 project to VB.NET. The VB6 project used a third-party dll to create software registration keys that can be decrypted by a second dll on the client machine to test for valid software usage (e.g. if I give you my software, it will have my name on it), and licensing expiration date. The second dll is in hundreds of customer locations, and changing to a different licensing scheme would be difficult at best. So I'm faced with the need to utilize the first dll in my VB.NET project to generate keys that can be correctly interpreted.
The developer of the dll tells me that it outputs ANSI strings, but as I understand it, in VB.NET strings are Unicode. So I need to convert the string output of the following call to Unicode:
' generate the serial number
If GenRegCode(msRegisteredName & msStationNumber, _
miRegOptions, _
0, _
1, _
liDay, _
liMonth, _
liYear, _
msSerialNumber) Then
' successful, convert ANSI msSerialNumber to Unicode, clean up, and set good return
msSerialNumber = Left(pfANSIToUnicode(msSerialNumber), 24)
' etc.
The last parameter, msSerialNumber, is passed ByRef.
I'm also guessing that I'll have to convert the first parameter being passed from Unicode to ANSI, so I figure I'll need two functions -- UnicodeToANSI, and ANSIToUnicode. I've been Googling this for the past day, but if I've seen the answer, it's not sinking in. Can anyone point me in the direction of a solution?
Thanks in advance!