ActiveX Control

I am making a activex textbox control in visual basic 6.0 and i want to create it so that when the user drags the mouse inside the textbox it changes colour and when their mouse exits the textbox the textbox goes back to the original colour..
How could i make this happen?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Are you trying to simulate cut, copy , paste feature ?
Hi adam8!
Use API function

Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Public Type POINTAPI
        x As Long
        y As Long
End Type

Put Timer object on the control and in
Timer1_Timer Event put code that checks that mouse still in range
   dim l as long
   If tPoint.x > Text1.Left and tPoint.x < text1.Left + text1.Width and
tPoint.y > Text1.Top and tPoint.y<Text1.Top+Text1.Width then
   end if

  Timer1.Enabled= True in Text1_MouseMove event

Set the Timer1 interval to 1


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
adam8Author Commented:
I knew there was a way to do that involving a timer but I don't like using timers too much unless i really need to because they slow down the program a bit.. Is there any other possibility.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

adam8Author Commented:
I tried what you told me and it didn't work..
Could you please help.
Hi adam8 !
Can You explane what a problem , because it has to work. So what You mean it doesn't work .
adam8Author Commented:
i will explain in detail.
when i wrote the first comment i said that when the cursor entered inside (Not clicked but moved inside) the textbox i wanted the textbox to change color and then when the mouse exited the textbox i wanted it to go back to it's normal color.
i tried the thing you wrote and i changed it so instead of the cursor changing the textox would change but instead the textbox stayed the color it was supposed to change into. so for some reason the program thought the cursor was always inside the textbox..
That was what went wrong.
I think that You forgot in Timer1_Timer
when You had write
  If 'Mouse not in range of text then
to add the operator

try to put breakpoint on Timer1.Enabled=False
and look when it will arrive to it

If that will not work so I send the part of Timer1_Timer code and will see together.

adam8Author Commented:
i added the text1.color comment and i added it under the timer1_Timer
and i set the interval to 1 and i set the timer to enabled and i entered the API and i don't know what i am doing wrong.
adam8Author Commented:
something happened...
when i entered the cursor inside the textbox it changed color....
but when i moved the cursor outside the textbox it didn't go back to the original color....
How can this be fixed..
You have to fix it in IF condition by that You identificating textbox range.So in else of the IF You have to put
'it has to be some thing like that

IF MyPoint.x > text1.left and MyPoint.X < text1.left+text1.width and MyPoint.y> and MyPoint.Y < + text1.Height then
end if
adam8Author Commented:
It is like that but i will try again...
The mousmove function enables timer1 but the mousemove function only occurs when the mouse moves within text1. which means if the mouse is outside the textbox the timer wont become enabled because the mouse move function wont be used...
Is that what is going wrong?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.