Results 1 to 10 of 10

Thread: always on top

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    120

    always on top

    i am using SetWindowPos function to set my application on top but my form starts flashing for 2-3 times when loads(may be other app try to get focus) how can stop my form from flashing?

    i am using these values
    SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE

  2. #2
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: always on top

    Have you tried just loading the form as vbModal until the user does whatever they need to?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    120

    Re: always on top

    yes i am loading the form as vbModal.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    120

    Re: always on top

    any other suggestions?

  5. #5
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: always on top

    can you show the code in loading proc..
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    120

    Re: always on top

    everything is fine but after flashing for 2-3 sec my form lost it's focus. Is there any way so that my form always load in focus?
    Last edited by xor83; Jan 8th, 2007 at 05:46 AM.

  7. #7
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: always on top

    But you dint show us the code to analyse...anyway check the attached zip file to load a form as Always on Top....
    Attached Files Attached Files
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  8. #8

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    120

    Re: always on top

    there is no problem with always on top code i want my app to be always in focus.

  9. #9
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    263

    Re: always on top

    Try this:

    VB Code:
    1. Const HWND_TOPMOST = -1
    2. Const HWND_NOTOPMOST = -2
    3. Const SWP_NOSIZE = &H1
    4. Const SWP_NOMOVE = &H2
    5. Const SWP_NOACTIVATE = &H10
    6. Const SWP_SHOWWINDOW = &H40
    7.  
    8. Public Sub ActivateWindow()
    9.  
    10.     With FrmMain
    11.         If Not .Visible Then .Visible = True
    12.         .WindowState = vbNormal
    13.         BringWindowToTop .hWnd
    14.         SetWindowPos .hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
    15.         SetWindowPos .hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
    16.     End With
    17.    
    18. End Sub

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    120

    Re: always on top

    no help ... app doing the same thing

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