Results 1 to 13 of 13

Thread: Window always has focus

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 1999
    Location
    J-ville, NC
    Posts
    54
    I was wonder if anyone knew how to make a foreign window always have focus.....I mean always Active but I could still open other foreign windows and that window still should be active.
    David Underwood
    Cannabatech Corporation

    ICQ - 14028049
    E-mail - [email protected]

    AIM - DK4ever23[/b]


  2. #2
    Guest
    Hi!

    I don't understand exactly what you mean but try this
    Code:
    'declarations
    Private Const HWND_TOPMOST = -1
    Private Const SWP_NOSIZE = &H1
    Private Const SWP_NOMOVE = &H2
    Private Const SWP_FRAMECHANGED = &H20        '  The frame changed: send WM_NCCALCSIZE
    Private Const SWP_DRAWFRAME = SWP_FRAMECHANGED
    Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
    
    'in function
    Call SetWindowPos(Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE Or SWP_DRAWFRAME)
    This makes the specified window (in this case me - me.hwnd) always stay on top.
    ______________
    regards,
    da_bob

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 1999
    Location
    J-ville, NC
    Posts
    54
    What I mean is, you know how you're working with this browser right now?? It's active because you can tell by the title bar by the color is is. Lets say you open a program, the brower will become inactive because the color will change to that light grey color. Now I'm wondering if there's a way to make that program always be active, even if I open and work with another program.
    David Underwood
    Cannabatech Corporation

    ICQ - 14028049
    E-mail - [email protected]

    AIM - DK4ever23[/b]


  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    No, AFAIk, windows system can only have one window active at a time. If you want a window active all the time you could use setforegroundwindow api frequently but i'm sure that the "working with other application" part is not going to work.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5
    Guest
    Yes, you cannot have two Active Windows, however, I believe you can have a window which will always be in the Foreground.

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    What do you mean
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  7. #7
    Guest
    Say for example you have a program running. You can also have another program running in the Foreground.


  8. #8
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    What? I mean that "two active windows" part.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  9. #9
    Guest
    Yes that's right. You can have a Foregound Window that's Inactive but not two Active Windows.

  10. #10
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    No, not that, the Foreground Window IS the Active Window. A Window on top may be on top of that window but it's not the foreground window
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  11. #11
    Addicted Member Mih_Flyer's Avatar
    Join Date
    Mar 2000
    Location
    some place there
    Posts
    241
    You can make a fake title bar with the same color of the system title bar, just an idea

  12. #12
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    WHAT?=! Why didn't I think about that, that's damn cleaver Mih_Flyer! LOL, We programmers should all think like you
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  13. #13
    New Member
    Join Date
    Nov 2003
    Posts
    8
    Hello!
    I have a question here.

    I have one VB program and another non-VB application (exe app) opened. My VB program is my active program. When I click a certain button, I want my non-VB program (which is not minimized and it is standing behind the active program) to be on top of the VB program (to indicate to the user that he/she must now work with the (non-VB program now).

    So, how can I do that? I try looking for command setBackGround in VB but there is none. So, is there any other way?

    Appreciate if someone could help. Thanks in advanced

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