CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2002
    Posts
    18

    Help me : change value parameter in DLL

    I write MFC-DLL, it have a export fuction :
    ----------
    void Test(int n)
    {
    n=100;
    }
    ----------


    I user this DLL in VB:
    ----------
    n=200
    'Call Test fuction :
    Test(n)

    MsgBox n
    'But n is not changed (n = 200)
    'Why n is not = 100?
    ----------

    I repaired fuction Test as :

    void Test(int &n)
    {
    n=100;
    }

    When call Test(n) in VB, occur an error : access memory....

    Why that?
    How can I do to changed value of n?

    Thank you!

  2. #2
    Join Date
    Jul 2002
    Posts
    2,543
    In VB function declaration add ByRef keyword to n parameter.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured