|
I dont know for sure, but my guess is you need to remember the result of AllocSysString() and call SysFreeString() on it.
Luc Pattyn
|
|
|
|
|
CoInitialize() involves loading up COM and setting up various things like data structures and windows for the STA. Some of that data is process-wide and won't be freed when you call CoUninit. So really, don't worry about it
Last modified: 5hrs 34mins after originally posted --
|
|
|
|
|
thanks for your reply.
but i called CoUninitialize();
Have A Nice Day!
Murali.M
|
|
|
|
|
There is already one memory leak indicated by Luc.
You can modify your code like this,
HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL,
CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice);
if( SUCCEEDED( hr ) )
{
BSTR bsSpeech = m_strSpeech.AllocSysString();
hr = pVoice->Speak(bsSpeech, 0, 0);
SysFreeString(bsSpeech);
pVoice->Release();
}
|
|
|
|
|
thanks prasad. I try with this one. but not. my problem of memory consumption if 1,XXX K. This is not due to String allocation.
Have A Nice Day!
Murali.M
|
|
|
|
|
in c++ we can used the cin and cout , plz tel me in VC++ what function we used.
a lot of thank 's
-- modified at 5:39 Saturday 16th December, 2006
-- modified at 5:41 Saturday 16th December, 2006
naveen padiyar
|
|
|
|
|
- On console apps keep using cin/cout (even printf/scanf are a valid option).
- On windowed apps you have to use any of the text drawing methods of MFC
(e.g. CDC::TextOut, CDC::DrawText, ... or the original GDI calls TextOut, DrawText, ... ). For fancy effects, give a look at GDI+.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
where do you need it? It differs according to your need. Btw, VC++ is not something totally different from C++. C++ is still inside VC++ . If you are making a console application using VC++, you can still use "cin,cout" if MFC (or SDK), and if you want(most probably) to get from a textbox (CEdit) ::GetWindowText(), ::SetWindowText()
:Gong: 歡迎光臨 吐 西批 :Gong:
|
|
|
|
|
To disable a menu item in an sdi app i tried
(pFrame->GetMenu)->EnableMenuItem(IDC_MY_ID,MF_GRAYED);
but it did not work. How to do this?
Thanks in advance.
KIRAN PINJARLA
|
|
|
|
|
Hi Kiran,
try this :-
pFrame->GetMenu)->EnableMenuItem(IDC_MY_ID,MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
Regards,
vinsankar
|
|
|
|
|
Thank you.
But it did not work.
KIRAN PINJARLA
|
|
|
|
|
Then try to post more info about...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi,
You can use the following Macro ,
ON_UPDATE_COMMAND_UI( MENU_ID, memberFxn ) and in the definition
void memberFxn( CCmdUI* pCmdUI )
{
pCmdUI->Enable(false);
}
Regards,
vinsankar
|
|
|
|
|
|
hi
ok as guys are not able to understand what i am asking i will try to be specific
run spy++ and in windows section(ctrl+w) you see different windows handel values,
i want to use one of those value in my program and send a message to that particular window, defined by the window handel id,
exm:
in spy++ one appliction window has id 2222
i want to send message to 2222 window handel id
how to do tht,
as far i know u simply cant do like this HWND h=2222;
my app
for suppose there is xyz window or application, i query for HWND in Spy++, it returns me 2222, i want to use tht value in my application to send a message to tht window,
SendMessage( hwnd a, ...,...,...);
how to do hwnd a = 2222;
any idea or suggestion,
the basic doubt is how to use a handel value provided by spy++, if app does nt have a window or a hidden application or tray icon.
-- modified at 17:10 Sunday 17th December, 2006
|
|
|
|
|
swarup wrote: it returns me 2222, i want to use tht value in my application to send a message to tht window,
SendMessage( hwnd a, ...,...,...);
how to do hwnd a = 2222;
You can use this value as handle in SendMessage .
swarup wrote: if app does nt have a window or a hidden application or tray icon.
How would you get handle , if there is no window ?
|
|
|
|
|
Actually he can, if the app has the window hidden.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
why cant you , if you dont see a window tht does mean one ap does nt hv a window, anyway tht is not my problem what is ma problem is i knw from external program the hwnd value and i want to use tht value in ma application to send message to tht hwnd value, any idea
|
|
|
|
|
As said earlier. You can use SendMessage . if you have handle to that window. No matter if its hidden.
swarup wrote: knw from external program the hwnd value and i want to use tht value in ma application to send message to tht hwnd value, any idea
Then what problem?
|
|
|
|
|
i know i have to use sendmessage, but how to code it in my application, now dont tell me use this way SendMessage(2222, "any message","any message","any message");
how to use a hwnd value returned or shown by spy++, in the VC++ program programaticaly
|
|
|
|
|
swarup wrote: how to use a hwnd value returned or shown by spy++, in the VC++ program programaticaly
Mentioning SPY++ from start leads to confusion. You can look in to this[^] article, to see how to get windows handle.
Alternatively, you can use FindWindow() , if you have title to window in question.
|
|
|
|
|
no i dont want sample for spy, i can make spy++,
1st ? can there be a window with out name
2nd dont u think there are windows or application who has a window but hidden.
so in tht case how to get there handel
you query in SPY++ and you come to know about the handel value
now you want to hard code tht value in your app and send some message
for this do u have any idea or it cant be done ?
|
|
|
|
|
CPallini wrote: Actually he can, if the app has the window hidden.
Yes, But I was concerned about "if application does not have window" statement.
|
|
|
|
|
In fact, his words where a bit inaccurate. Anyway what he was asking was enough clear, at least to me...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
CPallini wrote: Anyway what he was asking was enough clear, at least to me
It was not clear, atleast for me ..
I was assuming from start, he has way to get window handle. But he was asking for it in actual.
|
|
|
|