|
LRESULT MyComboBox::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch((int)LOWORD(wParam))
{
case CBN_DROPDOWN:
fn1();
break;
}
return CComboBox::WindowProc(message, wParam, lParam);
}
I tried this already, but the problem still exists
|
|
|
|
|
Have you read this part?
This message is sent when the list box of a combo box is about to be made visible. <br>The parent window of the combo box receives this message through the <code>WM_COMMAND</code> message.
|
|
|
|
|
Why are you not implementating handlers for CBN_DROPDOWN and CBN_CLOSEUP ?
What version of Visual Studio are you using?
"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
|
|
|
|
|
Visual Studio 2005 Standard Edition.
|
|
|
|
|
Dear Techies,
I created a dialog based TCP/IP server using CAsycScoket to handle multiple clients. Things are fine when multiple clients connect and exchange data. I have the port nos and addresses of all the clients stored in a structure. (using ::GetPeerName())
But when a client gets disconnected, I can't identify which one got disconnected.
I know the framework calls ::OnClose() function when a client gets disconnected. But how do I identify the client which got disconnected?
Please help..
Thank you..
|
|
|
|
|
If client disconnect without shutdown call, server cannot detect the client disconnected unill tcp timeout.
To solve such that situation, need some techniques like;
1) let client always call shutdown
2) implement application level keep alive mechanism
3) implement server a polling to client after some interval from last client access
4) server force cut client after non transmission interval
...
Consider 1), 4) is most cost effective and 2), 3) makes increase packets.
Choose suitable method(s) to your system and application.
|
|
|
|
|
Hi,
I have something like the following:
CObArray array1;
CObArray array2;
.....array2.Add(&array1); ....
.....
'CObArray::Copy' : cannot convert parameter 1 from 'CObject *' to 'const CObArray &'
How Can I get this done?
Thanks
sft
|
|
|
|
|
Check the prototype of CObArray::GetAt .
|
|
|
|
|
Thanks for pointing in the right direction.
I was doing
array1.Copy( (CObArray*)array2.GetAt(0)); I should have been doing *(CObArray*) instead. Does this make sense?
Thanks
sft
|
|
|
|
|
Hours of debugging have finally paid off, and I've learned that I can't do this:
class C {
C(void);
C(int iNum);
C(int iNum, BOOL bBool);
}
C::C(void) { C(0); };
C::C(int iNum) { C(iNum, FALSE); };
C::C(int iNum, BOOL bBool) { }; I couldn't find any documentation telling me I couldn't do it that way, but it was definately causing problems.
So, is there another way to do it, or do I have to either (a) duplicate the code or (c) call a "constructor method" like this:
class C {
public:
C(void) { constructor(0, FALSE); };
C(int iNum) { constructor(iNum, FALSE); };
C(int iNum, BOOL bBool) { constructor(iNum, bBool); };
protected:
void constructor(int iNum, BOOL bBool);
};
void C::constructor(int iNum, BOOL bBool) {
}; As always, any assistance, or indicators towards what to read, are greatly appreciated.
MZR
modified on Thursday, June 4, 2009 10:32 AM (forgot return type for C::constructor() )
|
|
|
|
|
That is fine. However make sure you don't need a hierarchy where the base class implements the (int,bool) ctor and the derivations can call it using the initialization list.
class base
{
protected:
base(int n, bool b);
};
class myclass : base
{
public:
myclass();
};
myclass::myclass():base(1,true){}
Also check out Scott Meyers book Effective C++ for things like this and much more.
|
|
|
|
|
|
Mike the Red wrote: I couldn't find any documentation telling me I couldn't do it that way, but it was definately causing problems.
Such as? I used your class like the following and the constructors behaved as expected:
void main( void )
{
C c1;
C c2(1);
C c3(2, TRUE);
}
"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
|
|
|
|
|
I guess he want like java constructor like these;
class A {
public A(int a, int b, int c) {
}
public A(int a, int b) {
this(a, b, 0);
}
public A(int a) {
this(a, 0, 0);
}
}
|
|
|
|
|
You want C++ 0x[^]. Unfortunately, it's not finalised, much less fully implemented
I would use the 'constructor method' approach personally.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Stuart Dootson wrote: much less fully implemente
Yeah, I already checked 2008 feature pack, not there.
|
|
|
|
|
They're not going to be in VS2010 either, AFAIK - it'll have some C++0x features, but not that one.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
That's not good news. But at least tomorrow is still FRIDAY!
|
|
|
|
|
The issue is that a standalone constructor call is creating a new instance that you do nothing with, then exits not having actually initialized anything in the instance it was called for.
It may be a bit of a hack, but for my class I was able to get away with the method below. Really, though, anything with a properly overloaded operator= should be fine, I think.
CClass::Class()
{
int iDefault = 1000.0f;
*this = Class( iDefault );
}
Edit: Frankly, though, I feel like I'm brain-farting on something here. I, too, expected it to work like you originally detailed.
modified on Friday, June 5, 2009 2:19 PM
|
|
|
|
|
Hi there,
I might be in the wrong place here, but lacking another idea where to post, I give it a shot.
I am presently developing in the audio/speech streaming area. I built a TTS system that works quite nicely, streaming (via RTP) the audio in small data packages, which contain the samples. Each 16-bit linear sample is stored in a short.
Now I was wondering if there is any possibility to somehow calculate how long the resulting audio file will be (or was), in miliseconds.
There are programs that do it, like Audacity, so I should be able to get there, as well. Only I don´t have a clue.
Any ideas?
Souldrift
|
|
|
|
|
If you're creating the samples in your own system, then surely you should be able to just work it out from no. samples / sample rate. (* 1000 if you want it in milliseconds.)
Or are you using an external library or app to create the audio?
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
Haha, of course, it´s so easy. I found out myself just now.
But thanks a lot. Your hint was the one I was looking fro.
I am actually using an external lib to synthesize the text. But of course I have the number of samples and the sample rate.
Thanks again ... and I just found this (if anyone is interested) to verify my own calculations:
http://www.angelfire.com/ga/bunnycymru/sound.html[^]
Cheers
Souldrift
|
|
|
|
|
Hi
What kind of reason will cause program crashed at:
CWnd* CWnd::GetDlgItem(int nID) const
{
-----> ASSERT(::IsWindow(m_hWnd));
}
Thank you very much,
|
|
|
|
|
|
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|