|
Somewhere: "SetTimer(1,10,0);"
10 means the function below is called in every "10 miliseconds"
void CDDDView::OnTimer(UINT nIDEvent)
{
if (nIDEvent==1)
{
//draw a bitmap in different points to simulate an animation
}
}
10 miliseconds is too less for a Pentium II ,so the bitmap cant redraw at every 10 miliseconds.
NOW, THE EXCITING PART:
I have a CTreeCtrl in my view. When i move the mouse over the tree the bitmap redraw 3 times faster!!!!!!!!!
Is there a guru on Earth to explain this???
PS: if somebody wants to see the application i'll send by e-mail. It is my graduated project.
Sorry for not a good English.
|
|
|
|
|
> "SetTimer(1,10,0);" 10 means the function below is called in
> every "10 miliseconds"
No. Windows timers use INT 8 interrupt internally, which fires at 18.2 Hz. The minimal elapsed time is about 55 ms, even if you pass 10 to SetTimer. And, OnTimer is not guaranteed to be called when time elapses - WM_TIMER messages are posted to the message queue and have the lowest priority.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Ok! Ok!
I think i didn't make myself clear!
In my view derived class i have a bitmap who redraws in VM_TIMER handle.I have a tree control, and a multiline edit control too.
Normaly, the bitmap move on the screen with a speed lets say "x".
WHEN I MOVE THE MOUSE OVER THE TREE CONTROL, OR WHEN I SELECT THE TEXT WITHIN A MULTIEDIT CONTROL (FROM MY CView DERIVED CLASS) THE BITMAP MOVES WITH A SPEED "3*x". I KNOW THIS SOUNDS WEIRD!
Why? Why? Why?
|
|
|
|
|
The Windows scheduler boosts the priority of the thread that owns the window, when a window receives input, such as timer messages, mouse messages, or keyboard input. Priority boost gives more processor time and your bitmap is redrawn faster.
BTW: Do you really think that SCREAMING makes you more readable?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
And how comes in the following cases the bitmap doesn't move faster and implicitly Windows scheduler doesnt boost the priority of my thread?
1)Put all my fingers on the keyboard.
2)Click the mouse 5 times a second OUT OF THE TREE and OUT OF THE EDIT CONTROL.
Does Windows scheduler boost the priority of my thread ONLY when my view receives messages from the child windows? How can you explain that?
For you it seems all right. For me not.
Sorry for screaming.
|
|
|
|
|
> And how comes in the following cases the bitmap doesn't move
> faster and implicitly Windows scheduler doesnt boost the
> priority of my thread?
I have no idea - maybe your WM_KEYDOWN handler is glacially slow. You can use Performance Monitor to check what's going on with the priority base/boost. Anyway, if you want smoothly animated bitmap in your program, you'll have to create a separate "painter" thread.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
The problem is when you move your mouse, you are probably causing a an invalidate on the tree control, which means you are forcing events to repaint you window, this will be as fast as you pc can handle.
SetTimer ( ... ) & OnTimer ( ... )== 55 milli seconds is the fasters you can do.
Now using an idle loop you can go as fast as you like (Idle Loop Processing in MSDN)
BOOL bDoingBackgroundProcessing = TRUE;
while ( bDoingBackgroundProcessing )
{
MSG msg;
while ( ::PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
{
if ( !PumpMessage( ) )
{
bDoingBackgroundProcessing = FALSE;
::PostQuitMessage( );
break;
}
}
// let MFC do its idle processing
LONG lIdle = 0;
while ( AfxGetApp()->OnIdle(lIdle++ ) )
{
// Do nothing
}
// Now you can check if at least 10 ms have passed if so do paint, if not loop
}
|
|
|
|
|
> The problem is when you move your mouse, you are probably
> causing a an invalidate on the tree control
It's not the default Windows behavior. Tree control isn't invalidated when mouse moves over it, even with TVS_TRACKSELECT style set, unless application calls InvalidateRect 'manually' in response to WM_MOUSEMOVE.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I had a go at writing a class that takes an optional member pointer as an argument. It's
along the lines of
<br />
class AttributeInt {<br />
char * CXMLNode::*m_units;<br />
<br />
...<br />
<br />
public:<br />
AttributeInt (... , char * CXMLNode::*units = NULL) : .. ,m_units(units)<br />
<br />
According to the debugger this sticks 0xffffffff into the member if no parameter is given (I'd expected 0, but I suppose it's conceivable 0 might be a valid offset).
The question is, how do I test for this, preferably in a portable way.
I've tried
m_units == NULL (never succeeds)
m_units == (char * CXMLNode::*)-lL (won't compile)
|
|
|
|
|
This works for me (VC6 SP5). Pointer to member representation set to "Best case always" in Settings/C++/C++ language.
class CXMLNode
{
public:
char *p1;
char *p2;
};
class AttributeInt
{
char * CXMLNode::*m_units;
public:
AttributeInt(char * CXMLNode::*units = NULL) : m_units(units) {}
void test()
{
if (m_units == NULL)
{
printf("m_units is NULL\n");
}
else
{
printf("m_units is not NULL\n");
}
}
};
void main( void )
{
AttributeInt a;
a.test();
AttributeInt b(&CXMLNode::p1);
b.test();
}
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
i want to get realtime audio data with g723.1 format.how to set g723.1?
//how to set these code
wfx.wFormatTag = ;
wfx.nChannels =
wfx.nSamplesPerSec =
wfx.wBitsPerSample =
wfx.nBlockAlign = ;
wfx.nAvgBytesPerSec = ;
wfx.cbSize = 0;
|
|
|
|
|
I think it`s not possible to put a G723-Stream directly to the input of the wave-device because you have to decode it first.
Anyway the parameters of an decoded G723 usually are:
8kHz / Mono / 16Bit
|
|
|
|
|
i have put a G723-Stream directly to the input of the wave-device
but i was bewildered by the new problem as blow :
i set the g723format to waveinopen,and transmit the data in UDP socket ,then waveoutpen .i found it too long before the data reach
another computer(lan).why !
when i set PCMformat,it's quicker .
i set the g723 as blow
static const struct {
WAVEFORMATEX wf;
BYTE extra[10];
} g7231format = {
{ 66, 1, 8000, 800, 24, 0, 10 },
{ 2, 0, 0xce, 0x9a, 0x32, 0xf7, 0xa2, 0xae, 0xde, 0xac }};
i set the pcm as blow:
mwaveFormatEx.cbSize=0;
mwaveFormatEx.nAvgBytesPerSec=16000;
mwaveFormatEx.nBlockAlign=2;
mwaveFormatEx.nChannels=1;
mwaveFormatEx.nSamplesPerSec=8000;
mwaveFormatEx.wBitsPerSample=16;
mwaveFormatEx.wFormatTag=WAVE_FORMAT_PCM;
and set the databuf as blow;
#define MAXWAVEBLOCK 5 //the max_num of buffer
#define MAXWAVEBUFFER 800//rthe max_size of buffer
someone help me
|
|
|
|
|
I have an app monitoring incoming mail.
The problem arose when my name became one of many (there are several people with first name like my own).
So, my e-mail address is now Darko.Hadzija@something.42, my alias is DarkoHa, and my app cannot connect to my 'mailbox' whatever name I use.
The question is:
how the heck can I connect via POP to my 'mailbox' (what name should I use),
and BTW password is what? - is it my password to computer or is it generated by God or (M$) or is it unimportant.
Thanks in advance,
Darko
|
|
|
|
|
Your Internet Service Provider is supposed to tell you the username and password for connecting to the POP server. Ask them (whoever they are).
|
|
|
|
|
Contact your network administrator or ISP for the username to use for POP. It's not necessarily the same as the stem of your email address and they will know what it should be.
The password is assigned by the same people. Nothing to do with your windows password.
|
|
|
|
|
Are you for real??
Anyway,
The name you should use is the user name you have been set up by your network admin or ISP provider.
If you have more than one aliase then you need to contact your network admin. otherwise the name is the whole string "Darko.Hadzija"
As for the password, it is your email password , it is not your computer password. The password is generated for you by the network admin.
Be strong and contact your network admin! Most network Admin are friendly (Insert comment here)
It also helps if you specified what is the
"app monitoring incoming mail" you are using
cheers
Alfadhly
|
|
|
|
|
Hi,
I want to implement Whois lookup in ISAPI DLL Extension. I used CSocket class for that. When I compile it's not showing any error. But, It's not giving any output in the browser. Let me know the reason, why its not showing the output.
Thanks in advance,
K.V.Raja
|
|
|
|
|
I think some code would be helpful here.
Cheers
|
|
|
|
|
we have developed a multithreaded win32 application using vc 6.0.Try catch exceptions are handled.But still when the exceptions are thrown, the threads get frozen except the primary thread.
Can anyone give suggestions?
|
|
|
|
|
Don't use exception handling, re-code in a defencive manor, checking things rather than waiting for things to explode.
|
|
|
|
|
> Don't use exception handling
This may be impossible - if he's using some library reporting error conditions using exceptions.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi all, i use the same code in my CView derived class to draw icons to both the screen and the printer. I use CDC::DrawIcon to do the drawing. The icons show up properly on the screen, and on print previews. They just don't actually print. I've also tried using ::DrawIconEx, but to no avail.
Any suggestions? Thanks in advance!
|
|
|
|
|
There are tow hosts in a local network. One has database source files ( mdb files ) and the other accesses them by using ODBC DSN. sometimes it happens that a database source file breaks down and
message dialog says to repair the databse file immediately.
Why does the database file break down ????
Somebody help me.
Thanks in advance.
|
|
|
|
|
hi,
I think you need to synchronize your access.Give more detail so that I may help you.
joey_tribbiani
|
|
|
|