473,385 Members | 1,373 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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("Winamp 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("Winamp 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(hWndHandler, 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

Jul 17 '05 #1
1 7353
I have started to use GetForegroundWindow 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(hWndHandler, WM_CLOSE, 0&, 0&)
"BadOmen" <ba*******@hotmail.com> skrev i meddelandet
news:S%********************@newsc.telia.net...
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("Winamp 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("Winamp 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(hWndHandler, 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

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Clara | last post by:
Hi,... I meant to write an application where there is a button in a window and when you click on the button, it will open a new window, but I want the first window to close, replaced by the second...
10
by: Shang Wenbin | last post by:
Hi, When I want to close the current window using window.close() in IE6.0, there will be a confirm box that: The web page you are viewing is trying to close the window. Do you want to close this...
4
by: trinity | last post by:
I am wondering if it is possible to accept and close the active window using its handle. I already have the handle using getActiveWindow(). I need to be able to click on the "yes" button to...
2
by: mahsa | last post by:
hi how can I open this link in new pop up window using javascript? <asp:HyperLink id="HLink_Amex" runat="server" NavigateUrl="images/cvv_amex.gif">Amex?</asp:HyperLink> -- mahsa
4
by: Bernie Yaeger | last post by:
I'd like to allow the user to zoom a window using a trackbar, say from 80% to 120% the size of the original window. I'm trying to do this with the following code, but it fails pretty miserably:...
3
by: dibakar | last post by:
Hello I want to open a window using Window.showModalDialog once i click inside of a TextBox.And that window need to come just under the TextBox,so that it seems to a same control. So,what...
7
by: tapanreddy | last post by:
I am looking to perform an action when we close the window using the close tab at the top of the screen. I know how to do it using a close button but I was wondering if there is way to achieve the...
5
by: kalyangvd | last post by:
Hi Guys, I am trying to get the Field Id from the Parent Window in the pop up window using window.opener ex: var var1 = window.opener.document.getElementById("text1").value; ...
13
by: NoaD | last post by:
Hello i have a button that clicking on it should open a pop-up with a calendar. I'm working with IE 7. the behaviour that follows clicking on the button is not persistent. if i use the mouse...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.