Sent via Deja.com http://www.deja.com/
Before you buy.
Just curious, what app are you trying to kill? Can't you just tell it
not to launch at start up?
In article <85091t$dso$1...@nnrp1.deja.com>,
Well, the program is an servey that is automatically being ran via NT
domain login stuff. I want to put something in my startup group that
will kill it off. hehe
In article <850b0c$fht$1...@nnrp1.deja.com>,
--
JaimeP
1. Open your registry and find the key below.
Key: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
Data Type: REG_SZ
2. For each program you wish to start automatically create a new string
value using a descriptive name, and set the value of the string to the
program executable.
For example, to automatically start Notepad, add a new entry of
"Notepad"="c:\windows\notepad.exe".
Note: Remember to include the full path to the file, if the directory is
not included in your default search path.
If you're trying to remove a program and can not find it in the default
key, then additionally try these keys as well:
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run]
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce]
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices]
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce]
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
NT\CurrentVersion\Winlogon\Userinit]
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce]
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunServices]
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce]
[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows]
I have used this technique to terminate an application who's Window Caption
I knew. (the caption was "Ticker"). If you don't know the caption of the app
(or if it varies) there are other ways - let me know.
Best of luck!
Shabbir
'============== Put the following code in a module =============='
' Note: Piece of code to modify in this module --- Mid(strWindowTitle, 1, 6)
= "Ticker"
' Remember to replace the word "Ticker" with the caption of the app you are
trying to terminate.
' Also make sure you replace the number 6 with the length of the caption. (6
is the length of word "Ticker")
Option Explicit
Declare Function EnumWindows Lib "user32.dll" (ByVal lpEnumFunc As Long,
ByVal lParam As Long) As Long
Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA"
(ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hwnd
As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As
Long
Dim lngRetVal As Long
Dim strWindowTitle As String * 100
Const NILL = 0&
Const WM_SYSCOMMAND = &H112
Const SC_CLOSE = &HF060&
' Getting window caption first.
lngRetVal = GetWindowText(hwnd, strWindowTitle, 100)
' If window caption matches, then go ahead and terminate app.
If Mid(strWindowTitle, 1, 6) = "Ticker" Then
' this code actualy terminates the other app.
hwnd = SendMessage(hwnd, WM_SYSCOMMAND, SC_CLOSE, NILL)
End If
EnumWindowsProc = 1 ' return value of 1 means continue enumeration
End Function
'======================= End =========================='
'== Put the following code where you want the other app to be terminated
==='
' (in your case you might want to put this in the Form Load event)
Dim varRetVal As Variant
varRetVal = EnumWindows(AddressOf EnumWindowsProc, 0)
'======================= End =========================='
JaimeP <alli...@my-deja.com> wrote in message
news:85091t$dso$1...@nnrp1.deja.com...
¤ I've got an app that I'd like to kill when my system starts up. If I
¤ know what the name of the app is in task magager, how can I do this?
¤ What API do I call? Any help would be appreciated.
Take a look at the following MS KB article:
HOWTO: Programmatically Close a Separate Application
http://support.microsoft.com/support/kb/articles/Q176/3/91.ASP
Paul
~~~~
pcle...@ameritech.net