Home » Java » vba to java convet code

vba to java convet code

Posted by: admin October 24, 2018 Leave a comment


I have a vba code with one that uses a DLL to encrypt

Public Declare PtrSafe Sub Encrypt Lib "aapSupport.dll" (ByVal As String, ByVal senhacript As String, ByRef TamSenhaCript As Integer)

  Dim passcript As String
  Dim buf_senha As String * 100
  Dim as_password As Integer

  Call Encrypt (login_password, buf_password, tam_password)
  passcript = Left (buf_password, tam_password)

I made a code in java.

public class Main {
public interface aapSupport extends Library {
aapSupport INSTANCE = (aapSupport) Native.loadLibrary (
            (Platform.isWindows ()? "AapSupport": "simpleDLLLinuxPort"), aapSupport.class);

        static char [] Encrypt (String password, char [] buf_password, int tamSenhaCrip) {
return buf_password;

public static void main (String [] args) {
// TODO Auto-generated method stub
System.out.println ("Loading Instance DLL");
aapSupport dsa = aapSupport.INSTANCE;
System.out.println ("Encrypting");

char [] chars = new char [100];
// String buf_senha = new String (chars);

char [] passwordEncrip = aapSupport.Encrypt ("Wng1607", chars, 0);

System.out.println ("Password:");
System.out.println (passwordEncrip);



but the result:

enter image description here