|
-
Apr 24th, 2002, 02:01 PM
#1
Thread Starter
Fanatic Member
Pop Up Program
I need my program to be able to become the window on top and on top with focus.
then I need a new form to pop up from that window.
I am doing it now but the window's blue caption bar blinks and it does not let me type into a text box until I click the form with my mouse.
I call the setwindowspositon API
then I set focus to the form
what else should I try?
Kurt Simons
[I know I'm a hack but my clients don't!]
-
Apr 24th, 2002, 02:03 PM
#2
Try SetForegroundWindow
VB Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Sub Form_Load()
'KPD-Team 1999
'URL: [url]http://www.allapi.net/[/url]
Dim lHandle As Long
'First we're going to retrieve the handle of this window
' "ThunderRT5Form" is the classname of a VB-window
lHandle = FindWindow("ThunderRT5Form", Me.Caption)
'Set this window to the foreground
lHandle = SetForegroundWindow(lHandle)
End Sub
-
Apr 24th, 2002, 02:05 PM
#3
Junior Member
I think you mean the show event.
You can show a form with the show event. The parent form can not be used until the showed form is unloaded. So even if you click on it in the taskbar the show form will come up.
frmShow.show 1
That is what you mean I think
-
Apr 24th, 2002, 02:34 PM
#4
Thread Starter
Fanatic Member
my Lhandle keeps coming back as a 0
i'm using windows 2000
Kurt Simons
[I know I'm a hack but my clients don't!]
-
Apr 24th, 2002, 02:36 PM
#5
Thread Starter
Fanatic Member
I am using the show 1 but first I have to make sure my application is the one in the foreground.
1. bring app to front
2. pop up the next form
Kurt Simons
[I know I'm a hack but my clients don't!]
-
Apr 24th, 2002, 02:41 PM
#6
Junior Member
-
Apr 24th, 2002, 02:55 PM
#7
Thread Starter
Fanatic Member
bartbouw,
I got the same results,
I need to get my application in the front, but with focus.
what happens now is that it goes to the front but the focus seems to be lost because the blue caption bar is blinking
Kurt Simons
[I know I'm a hack but my clients don't!]
-
Apr 24th, 2002, 03:04 PM
#8
Thread Starter
Fanatic Member
I added this
- - - - - - - - - - - - - - - - - - - - - --
SendKeys "{enter}", True
myform.show 1
text1.setfocus
- - - - - - - - - - - - - - - - - - - - - --
and all is good
Kurt Simons
[I know I'm a hack but my clients don't!]
-
Apr 24th, 2002, 03:05 PM
#9
Junior Member
If you use the code explained in the other thread and you put this code right behind:
frmMain.setfocus
your form will get the focus and be on top. After that you can use the .show command
-
Apr 24th, 2002, 04:31 PM
#10
Thread Starter
Fanatic Member
it didn't work until I added the sendkeys.
the form just blinked in the task bar until a key was pressed or the user clicked the form
Kurt Simons
[I know I'm a hack but my clients don't!]
-
May 8th, 2002, 01:43 AM
#11
Lively Member
Thanks - this worked for me also when nothing else would on W2K
One clarification - obviously the call:
has to be in the Form_Activate event so that this gets called when the form is shown....correct?? [worked for me!]
-
May 8th, 2002, 06:16 AM
#12
Thread Starter
Fanatic Member
you are correct, that is where i had it, I guess I was typing fast
Kurt Simons
[I know I'm a hack but my clients don't!]
-
May 8th, 2002, 05:39 PM
#13
Lively Member
-
May 30th, 2002, 07:29 PM
#14
Lively Member
Just a quick follow-up (sorry to add to an old thread).
I actually removed the line:
Code:
SendKeys "{enter}", True
I found that if I had another application open that it sent an enter key to that app .. not great if you are writing a letter ..
It still seems to work OK on W2K (using just the setfocus call)
Cheers,
Tim
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
|