|
-
Jan 31st, 2008, 11:30 AM
#1
Thread Starter
Addicted Member
[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...
-
Jan 31st, 2008, 12:29 PM
#2
Addicted Member
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
-
Jan 31st, 2008, 12:35 PM
#3
Thread Starter
Addicted Member
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...
-
Jan 31st, 2008, 12:39 PM
#4
Addicted Member
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
-
Feb 1st, 2008, 12:50 AM
#5
Thread Starter
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|