I have a thread in my program that scrolls a bitmap. I have noticed that if i move the mouse across the window the scrolling speeds up. Also if i move the cursor over the close button the scrolling stalls for a sec. Why would this be so if the thread has its own cpu time slice. I have some global variables in the thread but that should not matter because their not acted on anywhere else in the program after it is initialized. Its just something that bugs me. I need an explanation for everything i guess.

thoughts appreciated :alright:

ThreadProc PROC ;USES ebx Param:DWORD
mov var3, 0
invoke LoadBitmap,hInstance,35
mov hBitmap,eax
invoke SelectObject,cdc,hBitmap
mov obitmap,eax

mov ebx,BMW
mov var1, 0
.while var1 < ebx ;<< Bitmap width
invoke BitBlt,hdc,300,1,BMW,BMH,cdc,var1,0,SRCCOPY
invoke GetTickCount
mov var2, eax
add var2, 25

.while eax < var2
invoke GetTickCount

add var1,2

jmp bla

ThreadProc ENDP
Posted on 2001-09-06 12:49:12 by titan
I can't answer this, but i can say it happens else where... namely in Note pad etc.. If i select a passage of text larger than the screen, it scrolls and captures more if i move the mouse from side to side...

I've know of this for quite some time... but never gave it a thought till now...

Posted on 2001-09-06 13:24:17 by NaN
I've seen the same thing happen when working in Visual Basic. Moving the mouse fast would speed things up for no reason whatsoever it seemed.
Posted on 2001-09-06 14:23:09 by vcv
Maybe it's because windows sends you more messages
(every mousemove it's another message) and this is giving you more control over CPU than other processes
(especially if you're doing something on message loop)
Posted on 2001-09-06 17:39:23 by Eugen

I think that if more messages were going the que it would slow my thread down because my thread is a worker thread and does not recieve messages. The cpu would devote more time to the main window messages i would think.

I dunno
Its gonna bug me forever:mad:
Posted on 2001-09-06 18:09:58 by titan
Your thread does not receive messages, but your process does.
I guess your thread time is a part of your process time and thus if your process has more time, your thread has more time also..

Im not very sure though ...
Posted on 2001-09-06 18:34:15 by Eugen

i wonder if it has anything to do with the cache
Posted on 2001-09-06 22:18:38 by titan
Windows does schedule the thread with the foreground window a higher prioty. Look up an API reference to find out exactly what the difference is.
Posted on 2001-09-07 07:19:34 by huh