|
I'm not sure i completely understand your problem. What do you mean by "click enter button", you mean, you have a button labeled "Enter" on your dialog and you click that with the mouse and want a new line inserted into your edit box?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
first i very sorry for my poor english
click enter button is means click KeyBoard's enter button,so my program
must to capture the KeyBoard input what key
i do not know how to implement
thanks
|
|
|
|
|
I guess, you need to handle PreTranslateMessage[^]. Check for message WM_KEYDOWN[^] and parameter VK_RETURN . Once you got this, make sure your control has focus, so that you can make sure enter key is clicked from that control.
|
|
|
|
|
jeansea wrote: but when i click 'enter' button text in edit box doest't chagne line
Did you also remember to add the ES_WANTRETURN style? Otherwise, the ENTER key will cause the dialog to close.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
You don't have to do any coding for that.
Just set Multiline property to true and Want Return property to true.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
WebService::CWebService * web = new WebService::CWebService ;
........;
........;
if( web->ReverseIP( bstr_key , bstr_text ,&bstr,&len ) == S_OK )
{
for (int i=0;i < len;i++)
{
CComBSTR domain = *bstr++ ;
m_listbox.AddString( (LPCTSTR) domain );
}
}
delete web;
The code have memory leak,where,who can tell me ? thankyou
|
|
|
|
|
guqingkui wrote: The code have memory leak
If you know it has memory leak, why can't you figure out where it has leaks? Read about RAII[^].
|
|
|
|
|
but how to figure out ,please tell me .thank you .i am a beginner.
where memory leak ,please tell me
|
|
|
|
|
If any exception occurred, your delete web won't get called and you have a leak there. RAII (provide link in my last post) is a common idiom in C++ to handle such situations. Or use some thing like boost smart pointers[^].
|
|
|
|
|
I know, thank you . other place have questions ?
|
|
|
|
|
What's the type of bstr ? If it's a BSTR then using ++ on it is wrong.
Steve
|
|
|
|
|
thank you yes ,it is BSRT
but why
can you give me a example ? thankyou
|
|
|
|
|
Actually, I take my previous statement back: ++ is ok as long as you don't treat the returned value as a BSTR .
Steve
|
|
|
|
|
"your previous statement "sorry I hava not serched,can you tell me more Specific ,very thanks .
|
|
|
|
|
You probably need to do a SysFreeString of the BSTRs that are being allocated inside the ReverseIP function.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
We need to know the type of the bstr variable. I assume it's a raw BSTR because the ++ compiles without errors. If this is the case, what is the point of the ++ ?
Steve
|
|
|
|
|
For gcc-3.3 compiler's Optimization function, who can provide some c source code for each optimize Options?
And provide more introduction resources for -O2 option.
Thank you!
|
|
|
|
|
Some source code compiled by gcc-3.3 running exception when using -O2 option, running OK while no using -O2 option.
|
|
|
|
|
My app needs a window to appear on top of all existing windows on the desktop. I have therefore coded :-
CAlarmEndDlg dlgEnd;
dlgEnd.SetTime(szTime);
dlgEnd.SetWindowPos(&wndTopMost,60,80,0,0,SWP_NOSIZE);
dlgEnd.DoModal();
However, on compiling I get :-
D:\Programming projects\MyAlarm\MyAlarmDlg.cpp(219) : error C2065: 'wndTopMost' : undeclared identifier
I have found wndTopMost in wincore.cpp
const AFX_DATADEF CWnd CWnd::wndTopMost(HWND_TOPMOST);
which appears to be some sort of data definition (of which I'm not familiar) but why is this not being picked up during compilation ?
Any help would be appreciated !
Doug
|
|
|
|
|
If this code is outside a CWnd object (which is probably the case), you should try this:
CAlarmEndDlg dlgEnd;
dlgEnd.SetTime(szTime);
dlgEnd.SetWindowPos(&CWnd::wndTopMost,60,80,0,0,SWP_NOSIZE);
dlgEnd.DoModal();
|
|
|
|
|
DougButtimer wrote: dlgEnd.SetWindowPos(&wndTopMost,60,80,0,0,SWP_NOSIZE);
Use dlgEnd.SetWindowPos(&CWnd::wndTopMost,60,80,0,0,SWP_NOSIZE); instead.
|
|
|
|
|
Thanks for both replies !! Yes, the use was within a global function (Timer callback) and the use of CWnd:: has cured the problem. Just given myself a smacked hand for not trying that before posting the cry for help !! Thanks again !
Doug
|
|
|
|
|
Hi,
Hope I am not asking a stupid question
But since notification of say receive or send is done via messages
Is there a Windows Based message to go with Virtual Function say
OnReceive e.g. WM_SOCKET_RECEIVE
and its user based message that the Server sends What if the Server is
a non Windows/DOS BASED computer
|
|
|
|
|
Notification of send or receive is done by the CAsyncSocket class using the OnReceive virtual function. If you don't use this class you will not get any notification. It would simply be the send /recv or WSASend /WSARecv function calls. CAsyncSocket class probably uses these functions internally.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
In otherwords the DLL used by AfxSockinit
on a Send From (the Server on the Some other machine/Computer)
would know to call CASycSocket::OnReceive ???
(I have been able to send messages using the WinSock/SDK "C" api's )
So in other words there aren't any message map entries necessary for
OnReceive
thankx again
|
|
|
|