For example, when I'm trying to make a line move from top to bottom,
int CChildView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add specialized writing code here.
SetTimer(0, 10, NULL);
return 0;
}
When you do this and
int CChildView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add specialized writing code here.
SetTimer(0, 1, NULL);
return 0;
}
This is the same speed.
As far as I know, the second factor of SetTimer
becomes faster as the value is lower, so why does it become the same speed if you put any number below 10?
How should the OnTimer
function be fixed if you want a faster speed when calling the OnCreate
function?
If uElapse is less than USER_TIMER_MINIMUM (0x0000000A), the timeout is set to USER_TIMER_MINIMUM. If uElapse is greater than USER_TIMER_MAXIMUM (0x7FFFFFFF), the timeout is set to USER_TIMER_MAXIMUM.
If you look at the official document, it only stores values from 0xA to 0x7ffffffff. 0xA is 10. If you put a value less than 10, it will be set to 10.
One way to speed things up is to generate and process timer messages at shorter intervals, but on the other hand, if you increase the amount (width) of things moving when processing timer messages, things move faster.
© 2024 OneMinuteCode. All rights reserved.