473,811 Members | 3,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Jul 17 '05 #1
1 7378
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" <ba*******@hotm ail.com> skrev i meddelandet
news:S%******** ************@ne wsc.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("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

Jul 17 '05 #2

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

Similar topics

6
6944
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 window. I open a login window and start the mainloop, when the user click on the login button, the __call__ function of VerifyProcessor is executed and it will call the new window which is the file manager window The thing is,.. I don't know how...
10
38032
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 window? I have to click yes to close the window. How can I close the current window directly without this dialog box? Thank you.
4
8075
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 close the window. Is this possible? and if it is, how do I do it? (The "no" button is selected by default).
2
1560
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
3834
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: (from the form) Dim per As Decimal per = CDec(zoomit.Value) setzoom(Me, Me.Font, per) ' per is the current value of the trackbar as a
3
4550
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 will be its code in javascript?
7
3357
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 above. Waiting for some suggestions Thanks
5
2599
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; alert(var1); I also used as window.opener.document.loginForm.text1.value but the field value is not getting in the pop up window. What am i missing here. Please let me know what i am missing here.
13
2266
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 to click the button i succeed, but when i navigate with tabs, sometimes it works right away, sometimes it needs 1-2 tries to open the window, and sometimes it doesn't succeed. the problem is that window.open(...) returns null
0
9734
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10652
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10395
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10408
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10137
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9211
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6895
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5561
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5700
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.