Quitting a window, using GetActiveWindow() API, returns 0???

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • BadOmen

    #1

    Quitting a window, using GetActiveWindow() API, returns 0???

    I am using the GetActiveWindow () API but it returns 0

    I have a remote that I activate this code with:

    Code:
    WinAmpHandler = GetActiveWindow
    WinAMPhWnd = FindWindow("Win amp v1.x", vbNullString)

    I have the WinAmp window active but the GetActiveWindow returns a 0 instead
    of the window handler, way?
    I am using this WinAMPhWnd = FindWindow("Win amp v1.x", vbNullString) to se
    the correct WinAmp hWnd, it works fine.

    I want to get the handler for the active window and use it to quit the
    active program:

    Code:
    Public Const WM_QUIT = &H12

    PostMessage(hWn dHandler, WM_QUIT, 0&, 0&)

    It work if i use WinAMPhWnd to quite WinAmp, but I want it to work on all
    active programs...

    If there is another bather way of quitting a active program than please tell
    me :-)

    Yours, Jonas



  • BadOmen

    #2
    Re: Quitting a window, using GetActiveWindow () API, returns 0???

    I have started to use GetForegroundWi ndow instead now.

    But I don't know when I should use WM_CLOSE and WM_QUIT I can quit IE with
    WM_CLOSE but not with WM_QUIT and I can quit WinAmp with WM_QUIT but not
    with WM_CLOSE...

    How do I know where to use QUIT and CLOSE?
    How can I make my program to decide when to use CLOSE an QUIT?



    PostMessage(hWn dHandler, WM_CLOSE, 0&, 0&)


    "BadOmen" <badomen02@hotm ail.com> skrev i meddelandet
    news:S%PZb.8355 0$dP1.227292@ne wsc.telia.net.. .[color=blue]
    > I am using the GetActiveWindow () API but it returns 0
    >
    > I have a remote that I activate this code with:
    >
    > Code:
    > WinAmpHandler = GetActiveWindow
    > WinAMPhWnd = FindWindow("Win amp v1.x", vbNullString)
    >
    > I have the WinAmp window active but the GetActiveWindow returns a 0[/color]
    instead[color=blue]
    > of the window handler, way?
    > I am using this WinAMPhWnd = FindWindow("Win amp v1.x", vbNullString) to se
    > the correct WinAmp hWnd, it works fine.
    >
    > I want to get the handler for the active window and use it to quit the
    > active program:
    >
    > Code:
    > Public Const WM_QUIT = &H12
    >
    > PostMessage(hWn dHandler, WM_QUIT, 0&, 0&)
    >
    > It work if i use WinAMPhWnd to quite WinAmp, but I want it to work on all
    > active programs...
    >
    > If there is another bather way of quitting a active program than please[/color]
    tell[color=blue]
    > me :-)
    >
    > Yours, Jonas
    >
    >
    >[/color]


    Comment

    Working...