Results 1 to 14 of 14

Thread: Pop Up Program

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833

    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!]

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Try SetForegroundWindow
    VB Code:
    1. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    2. Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
    3. Private Sub Form_Load()
    4.     'KPD-Team 1999
    5.     'URL: [url]http://www.allapi.net/[/url]
    6.     'E-Mail: [email][email protected][/email]
    7.     Dim lHandle As Long
    8.     'First we're going to retrieve the handle of this window
    9.     ' "ThunderRT5Form" is the classname of a VB-window
    10.     lHandle = FindWindow("ThunderRT5Form", Me.Caption)
    11.     'Set this window to the foreground
    12.     lHandle = SetForegroundWindow(lHandle)
    13. End Sub

  3. #3
    Junior Member
    Join Date
    Jan 2002
    Location
    The Netherlands
    Posts
    22
    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

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    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!]

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    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!]

  6. #6
    Junior Member
    Join Date
    Jan 2002
    Location
    The Netherlands
    Posts
    22
    That problem is solved in this trhread

    http://www.vbforums.com/showthread.p...w+to+the+front

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    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!]

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    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!]

  9. #9
    Junior Member
    Join Date
    Jan 2002
    Location
    The Netherlands
    Posts
    22
    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

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    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!]

  11. #11
    Lively Member tgoodmannz's Avatar
    Join Date
    Sep 2000
    Location
    Mid On at the Pavillion End
    Posts
    102
    Thanks - this worked for me also when nothing else would on W2K

    One clarification - obviously the call:

    Code:
    text1.setfocus
    has to be in the Form_Activate event so that this gets called when the form is shown....correct?? [worked for me!]

  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    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!]

  13. #13
    Lively Member tgoodmannz's Avatar
    Join Date
    Sep 2000
    Location
    Mid On at the Pavillion End
    Posts
    102
    No Worries!

  14. #14
    Lively Member tgoodmannz's Avatar
    Join Date
    Sep 2000
    Location
    Mid On at the Pavillion End
    Posts
    102
    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
  •  



Click Here to Expand Forum to Full Width