473,396 Members | 1,914 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,396 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 7355
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.