Click here to Skip to main content
16,004,820 members
Home / Discussions / COM
   

COM

 
GeneralRe: pass character string to COM Pin
MKUser1-Jul-08 3:20
MKUser1-Jul-08 3:20 
GeneralRe: pass character string to COM Pin
Vi21-Jul-08 17:40
Vi21-Jul-08 17:40 
GeneralRe: pass character string to COM Pin
MKUser1-Jul-08 18:42
MKUser1-Jul-08 18:42 
GeneralRe: pass character string to COM Pin
MKUser1-Jul-08 21:22
MKUser1-Jul-08 21:22 
GeneralRe: pass character string to COM Pin
CPallini1-Jul-08 22:05
mveCPallini1-Jul-08 22:05 
GeneralRe: pass character string to COM Pin
MKUser1-Jul-08 23:19
MKUser1-Jul-08 23:19 
QuestionRe: pass character string to COM Pin
CPallini1-Jul-08 23:33
mveCPallini1-Jul-08 23:33 
AnswerRe: pass character string to COM Pin
MKUser2-Jul-08 19:53
MKUser2-Jul-08 19:53 
Ok Let me explain my problem in detail.
In COM i create one function which takes one input and another output argument
idl file contains
HRESULT functionname([in] int length,[out,retval] BSTR* OutArray)

In function definition in COM class

HRESULT functionname(int length,BSTR* OutArray)
{
WSTR warray;
suppose warray contains some string and i want to return that string so i'll write

*OutArray = (BSTR) warray;

or if i try with following code then i think it's not correct
*OutArray = SysAllocString(wstr);
}

i use this dll and call it like
BSTR str;
str = cominterface->functionname(pass input length here);

When i build exe it generate tlh and tli files.
The tli file contains following code for that function
inline _bstr_t IExportComDll::functionname( int length ) {
BSTR _result = 0;
HRESULT _hr = raw_functionname(length, &result);
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
return _bstr_t(_result, false);
}

Now please tell me where i can change the code. Where to use SysAllocString. I cant change the code inside tli file. This function returns a string. So ATL write its wrapper code in tli file. When i call this function in some exe,After returning from wrapper code of tli file i get memory error because it try to free BSTR string.

Manoj Kumar Chauhan

GeneralRe: pass character string to COM Pin
CPallini2-Jul-08 21:18
mveCPallini2-Jul-08 21:18 
GeneralRe: pass character string to COM Pin
MKUser2-Jul-08 21:56
MKUser2-Jul-08 21:56 
GeneralRe: pass character string to COM Pin
CPallini2-Jul-08 22:08
mveCPallini2-Jul-08 22:08 
GeneralRe: pass character string to COM Pin
MKUser2-Jul-08 22:58
MKUser2-Jul-08 22:58 
GeneralRe: pass character string to COM Pin
Vi22-Jul-08 22:08
Vi22-Jul-08 22:08 
GeneralRe: pass character string to COM Pin
MKUser2-Jul-08 23:02
MKUser2-Jul-08 23:02 
GeneralRe: pass character string to COM Pin
Vi22-Jul-08 17:38
Vi22-Jul-08 17:38 
GeneralRe: pass character string to COM Pin
CPallini1-Jul-08 22:08
mveCPallini1-Jul-08 22:08 
GeneralRe: pass character string to COM Pin
CPallini1-Jul-08 3:25
mveCPallini1-Jul-08 3:25 
QuestionHow to add another activex control to web page dynamically. Pin
vies0028-Jun-08 22:28
vies0028-Jun-08 22:28 
AnswerRe: How to add another activex control to web page dynamically. Pin
pascal9181-Mar-10 16:48
pascal9181-Mar-10 16:48 
QuestionDefine a enum type variable on the Interface (ATL project) ? Pin
iman_kh27-Jun-08 10:31
iman_kh27-Jun-08 10:31 
AnswerRe: Define a enum type variable on the Interface (ATL project) ? Pin
Stephen Hewitt1-Jul-08 15:03
Stephen Hewitt1-Jul-08 15:03 
AnswerRe: Define a enum type variable on the Interface (ATL project) ? Pin
Vi21-Jul-08 17:33
Vi21-Jul-08 17:33 
QuestionPassing an array from an ActiveX class Pin
Hampus@foi26-Jun-08 2:55
Hampus@foi26-Jun-08 2:55 
AnswerRe: Passing an array from an ActiveX class Pin
KarstenK26-Jun-08 3:22
mveKarstenK26-Jun-08 3:22 
GeneralRe: Passing an array from an ActiveX class Pin
Hampus@foi26-Jun-08 3:39
Hampus@foi26-Jun-08 3:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.