Click here to Skip to main content
16,007,111 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Simple question Pin
Michael P Butler3-Mar-02 9:55
Michael P Butler3-Mar-02 9:55 
GeneralAn amazingly puzzling ATL enigma! Pin
Nish Nishant2-Mar-02 23:10
sitebuilderNish Nishant2-Mar-02 23:10 
GeneralRe: An amazingly puzzling ATL enigma! Pin
Christian Graus2-Mar-02 23:31
protectorChristian Graus2-Mar-02 23:31 
GeneralRe: An amazingly puzzling ATL enigma! Pin
Mazdak2-Mar-02 23:35
Mazdak2-Mar-02 23:35 
GeneralRe: An amazingly puzzling ATL enigma! Pin
Nish Nishant2-Mar-02 23:54
sitebuilderNish Nishant2-Mar-02 23:54 
GeneralRe: An amazingly puzzling ATL enigma! Pin
Mazdak3-Mar-02 0:24
Mazdak3-Mar-02 0:24 
GeneralRe: An amazingly puzzling ATL enigma! Pin
Mazdak3-Mar-02 0:26
Mazdak3-Mar-02 0:26 
GeneralRe: An amazingly puzzling ATL enigma! Pin
3-Mar-02 1:52
suss3-Mar-02 1:52 
You don't need to free it, the scripting engine automatically frees it for you by calling SysFreeString (actually it calls VariantFree. That's why you use SysAllocString and not the operator new in C++.

Here is what happens from scripting engine point of view

1. Gets IDispatch interface to your object

2. Calls GetIDsOfNames to get ID of "TestMethod"

3. Calls Invoke method with that ID

4. The return value comes in pvarResult

5. Calls VariantFree to pvarResult after MsgBox function is called

6. VariantFree checks for the type of the Variant and sess that it is a BSTR and calls SysFreeString

That's the reason why you use BSTR because you have standard functions for allocating and deallocating which are known by both you and the consumer (script engine).




GeneralRe: An amazingly puzzling ATL enigma! Pin
Nish Nishant3-Mar-02 14:16
sitebuilderNish Nishant3-Mar-02 14:16 
GeneralRe: An amazingly puzzling ATL enigma! Pin
pba_3-Mar-02 2:45
pba_3-Mar-02 2:45 
GeneralRe: An amazingly puzzling ATL enigma! Pin
Nish Nishant3-Mar-02 14:18
sitebuilderNish Nishant3-Mar-02 14:18 
GeneralRe: An amazingly puzzling ATL enigma! Pin
Mazdak3-Mar-02 4:02
Mazdak3-Mar-02 4:02 
GeneralRe: An amazingly puzzling ATL enigma! Pin
Nish Nishant3-Mar-02 14:17
sitebuilderNish Nishant3-Mar-02 14:17 
GeneralRe: Hmmmmm Pin
Tim Smith3-Mar-02 5:12
Tim Smith3-Mar-02 5:12 
GeneralADSI: Problem with Binding Pin
hph2-Mar-02 22:59
hph2-Mar-02 22:59 
GeneralDLL Pin
Peter Liddle2-Mar-02 22:58
Peter Liddle2-Mar-02 22:58 
GeneralRe: DLL Pin
Michael Dunn3-Mar-02 7:33
sitebuilderMichael Dunn3-Mar-02 7:33 
Questionhow do i use DeleteObject()... Pin
John Cruz2-Mar-02 21:44
John Cruz2-Mar-02 21:44 
AnswerRe: how do i use DeleteObject()... Pin
Christian Graus2-Mar-02 21:44
protectorChristian Graus2-Mar-02 21:44 
GeneralRe: how do i use DeleteObject()... Pin
John Cruz2-Mar-02 21:57
John Cruz2-Mar-02 21:57 
GeneralTexture filter in OpenGL Pin
Mazdak2-Mar-02 19:30
Mazdak2-Mar-02 19:30 
GeneralRe: Texture filter in OpenGL Pin
alex.barylski2-Mar-02 22:55
alex.barylski2-Mar-02 22:55 
GeneralRe: Texture filter in OpenGL Pin
Mazdak2-Mar-02 23:23
Mazdak2-Mar-02 23:23 
GeneralUsing Delimiter EOF :: C++ Pin
valikac2-Mar-02 19:26
valikac2-Mar-02 19:26 
GeneralRe: Using Delimiter EOF :: C++ Pin
Mazdak2-Mar-02 19:29
Mazdak2-Mar-02 19:29 

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.