Results 1 to 5 of 5

Thread: [RESOLVED] could you say how to send string parameters to a ATL com method

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2007
    Posts
    167

    Resolved [RESOLVED] could you say how to send string parameters to a ATL com method

    Hi All,

    i want to create a ATL com Object, and add this object as a reference to my VB application.
    my ATL com should contain 3 parametes. two are input parameters of type string, and an out put parameter of type long.

    when i try to pass strings as parameters, the .lib file is being crated and i am able to add it as a reference to my VB application also. but when i try to run the VB application, an error is coming like "Memory out of space".

    i am thinking that the strings what i am passing from vb application are not compatible with the parameters in ATL Com.

    in ATL com the method is as follows.

    Code:
    STDMETHODIMP CSampleFun::Method1(char *S1, char *S2, long *n)
    {
    	// TODO: Add your implementation code here
              *n=40;
    	return S_OK;
    }
    please let me know how to pass string parameters.

    Thanks in advance...

  2. #2
    Addicted Member
    Join Date
    Oct 2006
    Location
    Chennai, India
    Posts
    198

    Re: could you say how to send string parameters to a ATL com method

    You need to pass it as a Pointer object meaning character array obviously...
    Regards
    Srinivasan Baskaran
    India

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2007
    Posts
    167

    Re: could you say how to send string parameters to a ATL com method

    Hi cheenu_vasan,
    i could not get you. could u please explain detailed?

    Thanks in advance...

  4. #4
    Addicted Member
    Join Date
    Oct 2006
    Location
    Chennai, India
    Posts
    198

    Re: could you say how to send string parameters to a ATL com method

    Meaning try using the BSTR datatype which is a predefined string which should be used, since VB is object based instead of Object Oriented ...
    Regards
    Srinivasan Baskaran
    India

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    May 2007
    Posts
    167

    Re: could you say how to send string parameters to a ATL com method

    Hi cheenu_vasan,

    i tried like this...

    Code:
    STDMETHODIMP CSampleFunction14::Method14(BSTR S1, BSTR S2, long *Num)
    {
    	// TODO: Add your implementation code here
    	*Num=40;
    	return S_OK;
    }
    It is working good. Thanks.....
    Last edited by raghunadhs; Feb 5th, 2008 at 03:34 AM.

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