不是建议问题的重复,因为我知道如何调用函数,一切正常。我的问题是在VB6代码中识别/声明属性而不是试图让它工作。
我在C#中编写了一个小型库,编译用于COM可见性/使用等。一切都很好,我可以在VB6中使用它没有汗。我在VB6中再次声明了函数很好。但我在库中有一个属性,我不知道如何在VB6中声明它。
我可以使用它,但我该如何宣布呢?我甚至不知道这是否是正确的术语。
该库有3个方法和1个属性。方法是CreateHash,Encrypt,Decrypt。该酒店是Salt。
一切都在完全正常工作,我只是不知道如何证明该属性存在而且它是为了库。
一些VB6代码(减去语法高亮的注释字符):
Private Declare Function CreateHash Lib "CryptoLibrary.dll" (plainText As String) As String
Private Declare Function Encrypt Lib "CryptoLibrary.dll" (plainText As String, key As String) As String
Private Declare Function Decrypt Lib "CryptoLibrary.dll" (cipher As String, key As String) As String
//Somehow show that the Salt property exists
Private Sub Form_Load()
Dim c As New Crypto
Dim textToHash As String
Dim textToEncrypt As String
Dim encryptionKey As String
textToHash = "hash this text"
textToEncrypt = "encrypt this text"
encryptionKey = "ThisIsTheKey"
c.Salt = "SomeSalt" //works, but how do I "declare" it?
Dim hash As String
hash = c.CreateHash(textToHash)
Debug.Print "hash: " & hash
Dim cipher As String
cipher = c.Encrypt(textToEncrypt, encryptionKey)
Debug.Print "cipher: " & cipher
Dim plainText As String
plainText = c.Decrypt(cipher, encryptionKey)
Debug.Print "plainText: " & plainText
End Sub
修改: 显示调试窗口的输出,以显示它完美正常,这不是这个问题的内容。同样,该库正在使用VB6。
哈希:09umCBt / Fx7F + kaHGCsmnAtG53p4YRrSaBgtiowkW0A = 密码:gJcImw14MOvqyGK / ToHMhnzgnigzAaeVylcrldvRBdFz + Gg5VGayhsAGogrYz8RT plainText:加密此文本