Click here to Skip to main content
15,921,351 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: using namespace std; <-- is evil? Pin
Tim Smith3-Mar-02 13:57
Tim Smith3-Mar-02 13:57 
GeneralRe: using namespace std; <-- is evil? Pin
Christian Graus3-Mar-02 15:24
protectorChristian Graus3-Mar-02 15:24 
GeneralRe: using namespace std; <-- is evil? Pin
Felix Cho4-Mar-02 17:38
Felix Cho4-Mar-02 17:38 
GeneralSend To IrDA printer in Pocket PC Pin
Mesut3-Mar-02 1:18
Mesut3-Mar-02 1:18 
GeneralSimple question Pin
John Cruz3-Mar-02 0:50
John Cruz3-Mar-02 0:50 
GeneralRe: Simple question Pin
Rama Krishna Vavilala3-Mar-02 1:55
Rama Krishna Vavilala3-Mar-02 1:55 
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 
Guys

As a few of you might be aware of, I am trying ATL out.
Say I have a function like this :-
STDMETHODIMP CIniEdit::TestMethod(BSTR *pbstr)
{
	OLECHAR tmpString[512];
	wcscpy(tmpString,L"Nish is learning ATL");
	*pbstr=SysAllocString(tmpString);
	return S_OK;
}


and from ASP or VB say, I do this :-
Dim x
Set x = CreateObject("SIMPLE.SimpleStuff")
MsgBox x.TestMethod()
Set x = Nothing


You'd think, all was fine. But to my utmost horror I suddenly realized that I had happily allocated a string using SysAllocString, but I am not calling SysFreeString.

Horror of horrors!!!!

What is the work-around to this, dear friends?

Am I doomed to be stuck among the ultimate dangers of memory leaks?

Writing another function just to free the string seems pathetic. And I am sure that from ASP/VB this function might be called several times, thus resulting in a memory leak, each single time Frown | :-(

Nish Eek! | :eek:

It's seven o'clock
On the dot
I'm in my drop top
Cruisin' the streets - Oh yeah
I got a real pretty, pretty little thing that's waiting for me
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 
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 

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.