943,578 Members | Top Members by Rank

Ad:
Nov 13th, 2008
0

Other Language DLL

Expand Post »
Hello Friends,

i m using the function to built DLL in delphi but when call it in vb 6.0 application i m not able to use this dll as reference.

Please help me. Following code which i have used to built delphi DLL.
------------------------------------------------------------------------------
visualbasic Syntax (Toggle Plain Text)
  1. library Project2;
  2.  
  3.  
  4. uses
  5. SysUtils,
  6. Classes,
  7. Dialogs;
  8.  
  9. {$R *.res}
  10.  
  11. const
  12. C1 = 43941;
  13. C2 = 16302;
  14.  
  15. var
  16. Result : string;
  17.  
  18. function BorlandEncrypt(const S: String; Key: Word): String;
  19. var
  20. I: byte;
  21. begin
  22. SetLength(Result,Length(S));
  23. for I := 1 to Length(S) do begin
  24. Result[i] := char(byte(S[i]) xor (Key shr 8));
  25. Key := (byte(Result[i]) + Key) * C1 + C2;
  26. end;
  27. end;
  28.  
  29. const
  30. Alphabet : string[64] = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  31.  
  32. function Encode64(st : string) : string;
  33.  
  34. var
  35. i,idx : integer;
  36. begin
  37. Result := '';
  38. i := 1;
  39. while i <= length(st) do
  40. begin
  41. // 1st char
  42. idx := ord(st[i]) and $FC shr 2;
  43. Result := Result + Alphabet[idx+1];
  44. // 2nd char
  45. idx := (ord(st[i]) and $3 shl 4);
  46. if i+1 <= length(st) then idx := idx + (ord(st[i+1]) and $F0 shr 4);
  47. Result := Result + Alphabet[idx+1];
  48. // 3rd char
  49. if i+1 <= length(st) then
  50. begin
  51. idx := (ord(st[i+1]) and $F shl 2);
  52. if i+2 <= length(st) then idx := idx + (ord(st[i+2]) and $C0 shr 6);
  53. Result := Result + Alphabet[idx+1];
  54. end
  55. else
  56. Result := Result + '=';
  57. // 4th char
  58. if i+2 <= length(st) then
  59. begin
  60. idx := (ord(st[i+2]) and $3F);
  61. Result := Result + Alphabet[idx+1];
  62. end
  63. else
  64. Result := Result + '=';
  65. // next source char
  66. Inc(i,3);
  67. end;
  68. end;
  69.  
  70. function Encrypt(password : string) : string; StdCall;
  71.  
  72. begin
  73. { ----old encrypt ----
  74. result := '';
  75. for i := 1 to length(password) do
  76. result := result + char( (ord(password[i]) xor 43) + 11 ); }
  77.  
  78. // new encrypt
  79. password := BorlandEncrypt(password,17732);
  80. Result := '<' + Encode64(password) + '>';
  81. //Result := '<' + Encode64(password) + '>';
  82. end;
  83.  
  84. Exports
  85. Encrypt;
  86.  
  87. Begin
  88. end.
Last edited by cscgal; Nov 13th, 2008 at 4:28 pm. Reason: Added code tags
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
poilkjmnb is offline Offline
18 posts
since Nov 2008
Nov 13th, 2008
0

Re: Other Language DLL

1.compile the dll.
2.copy the dll to system32 folder
3.register the component with windows using REGSVER32.
4.Then call the dll from vb from Project--references menu.
Featured Poster
Reputation Points: 665
Solved Threads: 427
Posting Genius
debasisdas is offline Offline
6,406 posts
since Feb 2007
Nov 14th, 2008
0

Re: Other Language DLL

Click to Expand / Collapse  Quote originally posted by debasisdas ...
1.compile the dll.
2.copy the dll to system32 folder
3.register the component with windows using REGSVER32.
4.Then call the dll from vb from Project--references menu.
but when register the DLL it show the message entry point not found.
what can i do for this?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
poilkjmnb is offline Offline
18 posts
since Nov 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: CreateDirectory
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: communication protocol for Endress-Hauser recorders





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC