Results 1 to 7 of 7

Thread: Using Delphi dlls in VB6

  1. #1
    Join Date
    Sep 2004
    Posts
    281
    Rep Power
    0

    Default Using Delphi dlls in VB6

    HI all , i have a dll that i would like to use in vb6. the problem i am having is that delphi cant see the values passed to it from vb6 ....however vb6 can get what ever i pass to it from Delphi


    library db_conn;

    uses
    fastsharemem,
    SysUtils,
    dialogs,
    Classes;

    {$R *.res}

    function SayHI(str char):string; stdcall;
    begin
    ShowMessage(str); {shows blank indicating it gets nothing from VB6}
    Result:='ameman';
    end;


    exports
    SayHI;
    begin
    end.
    Anything or Anyone that fails to grow will eventually die. {AI}
    -------------------------------------------------
    Tomorrow is the future!
    Today Is the Tomorrow you made Yesterday!{AI}

  2. #2
    Join Date
    Mar 2003
    Posts
    492
    Rep Power
    0

    Default

    Could you post the Str[0] value? Also did you allocate memory for the pchar parameter? Remember PChar is just a pointer, not an actual container.
    Last edited by Blunty Killer; Oct 24, 2006 at 10:27 PM.

  3. #3
    Join Date
    Sep 2004
    Posts
    281
    Rep Power
    0

    Default

    Hmmm, what is this Str[0] you speak off?
    Last edited by Artificial_Intelligence; Oct 25, 2006 at 09:25 AM.
    Anything or Anyone that fails to grow will eventually die. {AI}
    -------------------------------------------------
    Tomorrow is the future!
    Today Is the Tomorrow you made Yesterday!{AI}

  4. #4
    Join Date
    Mar 2003
    Posts
    492
    Rep Power
    0

    Default

    Here is a quick example of using Windows API style calls. That is, you send the container and the max length of the container from the caller. The DLL function the does the rest.

    DLL and VB calls using WinAPI sytle

  5. #5
    Join Date
    Sep 2004
    Posts
    281
    Rep Power
    0

    Default

    Raspect man. that last post helped.
    i now realize what are the effects of not learing a language fromt the ground up but from the top down.

    is leaves a week foundation. Especially since the os is not OO in all aspects .
    Last edited by Artificial_Intelligence; Oct 27, 2006 at 12:32 PM.
    Anything or Anyone that fails to grow will eventually die. {AI}
    -------------------------------------------------
    Tomorrow is the future!
    Today Is the Tomorrow you made Yesterday!{AI}

  6. #6
    Join Date
    Mar 2003
    Posts
    492
    Rep Power
    0

    Default

    Quote Originally Posted by Artificial_Intelligence View Post
    Hmmm, what is this Str[0] you speak off?
    If anything came across you should be able to pick it up. PChars unlike normal strings dont have a length, the first character is actually a part of the string. The string ends when a null character returns (#0). So if you sent 'Hello World', PChar[0] should by 'H.' It's just a simple test.

  7. #7
    Join Date
    Sep 2004
    Posts
    281
    Rep Power
    0

    Default

    Ho.......lol thought you where referring to something other than what you mentioned.
    yah i know how pchars work (c/c++) ,just that I have been using widestring so long working with pchars feels weird. Plus I never did learnt Pascal I started with Delphi from the OOP stand point.

    Thanks for the heads up though
    Anything or Anyone that fails to grow will eventually die. {AI}
    -------------------------------------------------
    Tomorrow is the future!
    Today Is the Tomorrow you made Yesterday!{AI}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •