Running Programs...

I have a home computer that I allow every one to use. I have a program that is started with the autoexect.bat file when the computer is starting up. How ever I would not like this program to run when I log in to the machine (using standard windows login) win95. I decided that I would just put a small program in the startup folder for my login that would terminate this program but I can't seem to do it??? When I press ctr-alt-del the program does not even show up... I guess my experences is lacking in this area. Any help would be nice. (Please tone it down though) Thanks!
testing38Asked:
Who is Participating?
 
danlevansConnect With a Mentor Commented:
testing38

Have your dos program to run only when a file does not exist. Then when you logon have your startup create this file--then wait long enough for your dos program to sense it and quit, then delete the file.

Rinky dink but it works. The only way I know for a dos program started before windows to communicate with a windows program.

Have Fun

Dan
0
 
MicheltCommented:
If You Can't find it under Programs, try active Processes.  

Okay Try the following.

This will give you list of all the Active processes.

Create a form with a Command button and a Listbox

Add a module and enter the following code:

Option Explicit
Public Const TH32CS_SNAPPROCESS As Long = 2&
Public Const MAX_PATH As Integer = 260
Public Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szExeFile As String * MAX_PATH
End Type
Public Declare Function CreateToolhelpSnapshot Lib "Kernel32" _
Alias "CreateToolhelp32Snapshot" _
(ByVal lFlags As Long, ByVal lProcessID As Long) As Long

Public Declare Function ProcessFirst Lib "Kernel32" _
Alias "Process32First" _
(ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long

Public Declare Function ProcessNext Lib "Kernel32" _
Alias "Process32Next" _
(ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long

Public Declare Sub CloseHandle Lib "Kernel32" _
(ByVal hPass As Long)


Then in the main form enter this code under the command button

Dim hSnapShot As Long
Dim uProcess As PROCESSENTRY32
Dim r As Long
hSnapShot = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0&)
If hSnapShot = 0 Then
Exit Sub
End If
uProcess.dwSize = Len(uProcess)
r = ProcessFirst(hSnapShot, uProcess)
Do While r
List1.AddItem uProcess.szExeFile
r = ProcessNext(hSnapShot, uProcess)
Loop
Call CloseHandle(hSnapShot)
0
 
Erick37Commented:
testing
What is the program you want to terminate?
Most Autoexec.bat exe's are device drivers and are resident before Windows loads.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
kamallCommented:
I would suggest the opposit approach. That is, depending on the login name, you either run the program or not. This can be done by removing the program from the autoexec.bat, making a small VB program that will detect the login name, and then decide to whether run (shell) the program or not.
Regards.
0
 
rovermCommented:
Kamall is correct, you can use something like this:

Declare Function WNetGetUser& Lib "Mpr" Alias "WNetGetUserA" (lpName As Any, ByVal lpUserName$, lpnLength&)

Private Sub StartUp()
Dim cbusername As Long, username As String

username = Space(256)
cbusername = Len(username)
If WNetGetUser(ByVal 0&, username, cbusername) = 0 Then
    If Left(username, (Len(RTrim(username)) - 3)) <> "MyLoginName" Then
        Shell "appname"
    End If
End If

End Sub

I've used an API to retreive the name of the user logged in, then checked it against your own log in name. If it is not the same then the SHELL statement fires the application.

Good Luck !

RoverM

0
 
testing38Author Commented:
I'm afraid that the 'starting the program after login' wont work. The program needs to be started in the autoexect.bat file before windows. I guess then windows could not stop it... But maybe. Any one else have any ideas? Also the program does not show up under the Processes. It does, however show up when I type mem /c /p at the dos command prompt, if that helps any.
0
 
kamallCommented:
Is it a DOS program?
If it is, it will show as 'winoldapp' (or something like that) in the processes.
I wonder why it wont work after windows loads. What program is that?
0
 
testing38Author Commented:
danlevans: I think I can pull this off! This is a good idea. Not what I had in mind but it will work. Thanks for the help!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.