|
-
Sep 14th, 2005, 05:27 AM
#1
Thread Starter
Hyperactive Member
msgbox when focus is lost on picturebox
how do i make it so when the mouse is not on a picturebox anymore, it gives the user a msgbox. i tried using the lostfocus function, but it doesnt seem to do anything.
-
Sep 14th, 2005, 05:28 AM
#2
Re: msgbox when focus is lost on picturebox
How about the MouseMove event?
-
Sep 14th, 2005, 05:31 AM
#3
Thread Starter
Hyperactive Member
Re: msgbox when focus is lost on picturebox
that's only when the mouse is still on the picturebox right? i tried that and did msgbox "hello", and it only pops up hello when it's ON it. how do i make it pop "HELLO" once it leaves the picturebox(i want to make a msgbox pop right away when the mouse leaves the picturebox)
-
Sep 14th, 2005, 06:44 AM
#4
Re: msgbox when focus is lost on picturebox
VB Code:
Option Explicit
Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function GetCapture Lib "user32" () As Long
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (X < 0) Or (Y < 0) Or (X > Picture1.Width) Or (Y > Picture1.Height) Then
ReleaseCapture
MsgBox "The mouse is no longer over the picture control"
ElseIf GetCapture() <> Picture1.hwnd Then
SetCapture Picture1.hwnd
'the mouse is over the picture control
'if you want to do something when this happens
'here is where you would put your code.
End If
End Sub
-
Sep 14th, 2005, 09:06 PM
#5
Thread Starter
Hyperactive Member
Re: msgbox when focus is lost on picturebox
-
Sep 15th, 2005, 01:15 AM
#6
Re: msgbox when focus is lost on picturebox
VB Code:
Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function GetCapture Lib "user32" () As Long
Hack!! can u plz explain the function of these 3 functions??
thnx
-
Sep 15th, 2005, 02:57 AM
#7
Re: msgbox when focus is lost on picturebox
You can download API Guide, it will explain all API functions.
http://www.mentalis.org/index2.shtml
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|