Results 1 to 7 of 7

Thread: I don't want to GetFocus

  1. #1

    Thread Starter
    Fanatic Member arsmakman's Avatar
    Join Date
    Dec 2001
    Location
    Leiden, Netherlands.
    Posts
    719

    I don't want to GetFocus

    Can I make a form that isn't able to get a focus?
    Example: I start WinAmp, then click my form. WinAmp should keep it's focus.

    Or else: Is there a way to reset the focus to the form that lost it.
    Example: I start WinAmp, then click my form. My form get's the focus but the code in GetFocus resets the focus to the previous form, being WinAmp.

    (It should work for other programs too, not just WinAmp)

    I hope you understand what my problem is....
    No matter how fool-proof your program is, there will always be a better fool.

    Was a post helpful to you? Rate it!

  2. #2
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089
    May I ask, whats that you are trying to achieve, maybe theres a work-around

  3. #3

    Thread Starter
    Fanatic Member arsmakman's Avatar
    Join Date
    Dec 2001
    Location
    Leiden, Netherlands.
    Posts
    719
    I'm making somesort of desktop.

    I can start a program from the desktop by clicking on an item. The selected program starts and runs. Then, when I click the desktop, the program loses its focus. That shouldn't happen. The program should keep it's focus even though my desktop is selected.
    No matter how fool-proof your program is, there will always be a better fool.

    Was a post helpful to you? Rate it!

  4. #4
    Member
    Join Date
    Mar 2004
    Location
    Texas
    Posts
    53
    Hi you can do this:

    In your form:
    VB Code:
    1. Private Sub Form_Load()
    2.     Call ShowWindow(Me.hwnd, SW_SHOWNOACTIVATE)
    3. End Sub

    In a module:
    VB Code:
    1. Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    2.  
    3. Private Const SW_HIDE = 0
    4. Private Const SW_MAXIMIZE = 3
    5. Private Const SW_MINIMIZE = 6
    6. Private Const SW_RESTORE = 9
    7. Private Const SW_SHOW = 5
    8. Private Const SW_SHOWDEFAULT = 10
    9. Private Const SW_SHOWMAXIMIZED = 3
    10. Private Const SW_SHOWMINIMIZED = 2
    11. Private Const SW_SHOWMINNOACTIVE = 7
    12. Private Const SW_SHOWNA = 8
    13. Private Const SW_SHOWNOACTIVATE = 4
    14. Private Const SW_SHOWNORMAL = 1

    Hope it works! Good luck.
    Good programming site:
    *http://www.planet-source-code.com

    Our CS Clan Page:
    *http://h2p.inter-gamer.com/index.html

  5. #5
    Member
    Join Date
    Mar 2004
    Location
    Texas
    Posts
    53
    OPS i misunderstood your question. So i think you want to keep focus at all times, you want to make the window stay on top at all times, seach this forum for how to do that,I remember seeing that. Sorry for the misunderstanding
    Good programming site:
    *http://www.planet-source-code.com

    Our CS Clan Page:
    *http://h2p.inter-gamer.com/index.html

  6. #6
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089
    Originally posted by Insane_Magician
    OPS i misunderstood your question. So i think you want to keep focus at all times, you want to make the window stay on top at all times, seach this forum for how to do that,I remember seeing that. Sorry for the misunderstanding
    no brother, u understood him correctly in the first case. he doesnt want to get focus on his application.

  7. #7
    Member
    Join Date
    Mar 2004
    Location
    Texas
    Posts
    53
    K cool, thanks veryjonny. I wrote that all out then I re read the question and I think i second guessed myself. Oh well, Ill wait for them to reply to see how it works
    Good programming site:
    *http://www.planet-source-code.com

    Our CS Clan Page:
    *http://h2p.inter-gamer.com/index.html

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