Jan 14th, 2005, 11:32 AM
#1
Thread Starter
Lively Member
How to display form without losing focus
Hello everybody!
Can somebody tell me how to display a form without setting focus on it? (a king of tool-tip window).
Thanks in advance...
Last edited by Bhairava; Jan 15th, 2005 at 02:21 AM .
...
Jan 14th, 2005, 11:41 AM
#2
Re: How to display form without losing focus
Can you ellaborate on what is it that you need to accomplish, please.
Jan 14th, 2005, 11:50 AM
#3
Thread Starter
Lively Member
Re: How to display form without losing focus
Usually when you open a new form, it automatically gets the focus.
I want to open a form, without losing focus from where it is.
Example:
The application I want to make will display an alarm message from 5 to 5 minutes. Whenever I display the form, it gets the focus, and this is pretty annoying when you write something or playing a game in another application.
A good example of what I want is the window that appear in the right of the screen - from Yahoo Messenger or Windows Messenger. Those windows don't get my focus from where it is.
Thanks.
Jan 14th, 2005, 11:56 AM
#4
Re: How to display form without losing focus
You may simply reset focus back to "calling" form so perhaps something like the following quick sample will work for you:
VB Code:
Private Sub Command2_Click()
Form2.Show , Me
Me.SetFocus
End Sub
Jan 14th, 2005, 11:57 AM
#5
Re: How to display form without losing focus
Set its Enabled property to False.
Jan 14th, 2005, 12:02 PM
#6
Thread Starter
Lively Member
Re: How to display form without losing focus
Thanks.
Jan 14th, 2005, 12:05 PM
#7
Re: How to display form without losing focus
You're welcome but which method worked for you - it's just out of curiosity.
Jan 14th, 2005, 12:08 PM
#8
Thread Starter
Lively Member
Re: How to display form without losing focus
setting the enabled property to false is what i wanted
Jan 14th, 2005, 12:09 PM
#9
Re: How to display form without losing focus
Oh, ok.
Jan 15th, 2005, 02:19 AM
#10
Thread Starter
Lively Member
Re: How to display form without losing focus
Sorry, after testing a little more, and made the executable file, it still gets the focus, even if the form which is displayed is not enabled .
I'm thinking there must be some sort of API stuff to do it...
Jan 15th, 2005, 02:22 AM
#11
Re: How to display form without losing focus
could you minimize it? did you try the other way?
Jan 15th, 2005, 02:38 AM
#12
Re: How to display form without losing focus
Private Sub Command2_Click()
Form2.Show , Me
Me.SetFocus
End Sub
VB Code:
Private Sub Command2_Click()
Form2.Show , Me
Me.Show
End Sub
pete
oops you mean that this happens when some other prgram has focus, not your program???
Jan 15th, 2005, 03:05 AM
#13
Thread Starter
Lively Member
Re: How to display form without losing focus
It works indeed if I show the main form, but when it is not shown, the new form gets the focus.
i've attached a sample of what i'm working at.
Please see attached project.
Thanks.
Attached Files
Jan 15th, 2005, 04:36 AM
#14
Re: How to display form without losing focus
i had a look at you program, looks very nice.
appactivate immediately after showing the form work, but you will need to use api call to get title of top most window prior to showing your form
rgds pete
if the current application covers the location of your form then it will not actually be seen
maybe if you set it to topmost and put it up into the caption bar area it will be out of the way
Last edited by westconn1; Jan 15th, 2005 at 04:40 AM .
Jan 17th, 2005, 01:25 AM
#15
Thread Starter
Lively Member
Re: How to display form without losing focus
Nobody knows?
Jan 17th, 2005, 01:33 AM
#16
Frenzied Member
Re: How to display form without losing focus
which os are u working with, exactly? your code gave me a big error message that made my vb crash. something in user32.dll
Jan 17th, 2005, 01:40 AM
#17
Thread Starter
Lively Member
Re: How to display form without losing focus
i'm using WinXP prof. SP2
That's strange with the error you have...
Jan 17th, 2005, 01:52 AM
#18
Frenzied Member
Re: How to display form without losing focus
well, i am using win 98. so the error is expected.
edit:
note: i will have to get back home to see what can be done in xp. i will let u know if i can do anything about it.
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