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...
Printable View
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...
Can you ellaborate on what is it that you need to accomplish, please.
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.
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
Set its Enabled property to False.
Thanks. :thumb:
You're welcome but which method worked for you - it's just out of curiosity.
setting the enabled property to false is what i wanted :)
Oh, ok. :afrog:
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... :ehh:
could you minimize it? did you try the other way?
Quote:
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???
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.
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
Nobody knows?
:(
which os are u working with, exactly? your code gave me a big error message that made my vb crash. something in user32.dll
i'm using WinXP prof. SP2
That's strange with the error you have...
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.