Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




End Program On Shutdown/logoff


I have a program in a windows 2k environment that continually listens on a port using winsock, it works fine except that when the user logs off or shutsdown the computer, I get that "End Program Now" window because the program is still listening for connections.

My question is, how can I listen for the WM_CLOSE windows send me when it wants to close my program ? all the examples I found were is I wanted to SEND the message, not respond to it.

Thanks,
g.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Shutdown,Restart, Logoff
Hi I am using Windows XP! Is there a way to shut down, Log-Off and Restart my Computer using VB6?

Shutdown,Restart,Logoff
Hi I am using Windows XP! Is there a way to shut down, Log-Off and Restart my Computer using VB6?

Detect LogOff && ShutDown (QueryUnload)
How can i differentiate (not sure if this word even exists lol)
i.e Get the difference between a pc being ShutDown and Logging Off..

Currently Both of these return the value of 2 (vbAppWindows) in the QueryUnload event..

Detect LogOff && ShutDown (QueryUnload)
How can i differentiate (not sure if this word even exists lol)
i.e Get the difference between a pc being ShutDown and Logging Off..

Currently Both of these return the value of 2 (vbAppWindows) in the QueryUnload event..

Detect Shutdown And Logoff Operations
Hai,

I've to detect when the system is shutdown or logged off using VB. Could anyone help me out with the code for this. or suggest some APIs used

Thank you,

Regards,
K. Sripriya

Computer Shutdown / Restart / Logoff
I have an application that seems to interfere with the session ending.

I do cancel the form.closing event temporarily to allow some threads to clean up, and then I exit the application. My application does quit, as well as most other processes, according to Windows Task Manager.

At one time I had a sessionending event handler but it is gone and my computer still will not perform shut/restart/logoff.

I Need The Codes For (Shutdown,logoff,restart,standby) The PC?
I just need for this codes:
turning off the PC,restart,logoff and stand by

Program Still Can Run After Logoff
i vb6 program running in server.
how to make sure the program is running as well after logoff from the server? any code will help?

thank

Run VB Program In Background When User Is LogOff
Is there any API function which allow us to run VB-program at the time of LogOff by user and keep executing in memory until next LogIn

[Solved]How Can I Uninstall Program Automatically When The Program Shutdown?
Hi all,

I have one more question, since my question about closing program automatically (schedule also) after running a period of time. I want to know how can i call uninstall.exe within the program dir to unstall itself when reached the end date? I mean after close the program when it reached the due date (period of time), I want to run uninstall.exe immediately to uninstall the program?

=============

Hi all again

I have solved it for myself, just using Call Shell() function before End the application.


.:ldlp:.

Edited by - dungla on 11/18/2004 11:13:27 PM

Save Program Information After Program Shutdown
Hi all!
I've done a small program which uses some values for working.
Up till now i saved these values in a file. The program also has to write into the file when something has changed.
Everything worked perfectly until i put it on a server on which a normal user doesn't have the right to write files

Does anyone know a (simple) solution, where I can store these information except files?

Bye, Jeannette

Shutdown Program
Hey guys, I want to write program which will shutdown computer after writing special command. I have 1 textbox where is place to write command and one button to run this command. I have this code and it doesnt work :/

Private Sub Command1_Click()
If Text1.Text = "shutdown" Then
ExitWindowsEx EWX_SHUTDOWN, 0
Else
MsgBox "Wrong Command", vbExclamation, "Error [Demon v1.0]"
End If
End Sub

I aslo have this in modules:

Private Const TOKEN_ADJUST_PRIVILEGES = &H20
Private Const TOKEN_QUERY = &H8
Private Const SE_PRIVILEGE_ENABLED = &H2
Private Const EWX_SHUTDOWN As Long = 1

I will be so glad if u help me

Program Will Not Shutdown All They Way
Hello, This has been the first time this has happend to me. After hitting the x button on the form the program still stays in the proccess list in windows xp prof.

I think i got all the correct unload stuff. I dont think anything else is still in memory.

If anyone could take a quick glance at it i would be in debt.. I "think" i done everything correctly.

I even put a delay, to make sure the program finishes its current task before shutting down.

Not sure though =/


Code:
Private Sub cmdStart_Click()
If cmdStart.Caption = "Start" Then
cmdStart.Caption = "Stop"
'Uncomment Pause 8 If Your In Full Screen.
'Pause 8
Call Main
Else
cmdStart.Caption = "Start"
End If
End Sub

Private Sub Main()

While cmdStart.Caption = "Stop"

Pause 1

Mouse1.MouseMove 123, 456
Mouse1.LeftClick
Mouse1.LeftClick

Pause 1

Mouse1.MouseMove 789, 123
Mouse1.LeftClick
Mouse1.LeftClick

Pause 7

Wend

End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
'Give The Program Enouph Time To Finish Its Current Operation Then Shutdown
frmMain.cmdStart.Caption = "Start"
frmMain.Caption = "Shutting Down"
Pause 7
Unload Me
End Sub

Program Shutdown
I've had a problem with a VB 5 program of mine. Users will close out the last visible form by clicking on the "X" at upper right and assume they're done. However, the program is still running, just not doing anything. This leads to multriple instances if they start it again, (and leads to confusion if they load a new version).

I suppose that I should keep an exit screen, maybe a small one, that stays up and has a method for graceful shutdown. However, I was wondering whether or not it was possible to trap the "X" click.

(I'm new here, i used to contribute to "VB Area," which disappeared.)

API To Shutdown Program?
I am looking for an API to unconditionaly shut down any program running by its handle or something like that.

I have tried all the SendMessage and PostMessage variations and they are not quit capable of shutting down AOL 100% of the time.

Is what I am doing is:

I have an icon in the task bar and when I double click it, AOL shuts down.

Why? Because AOL has a habit of just sitting there consuming my resources for unbelievable amounts of time while it decides if its going to let me turn it off.

I would like it to be like ctrl alt delete without any message displayed.

Even if smoke comes out the back of my computer, I want AOL to turn off when I say so! ;<)

Any Ideas?

JDT

Program-Shutdown
How could I make a program that when run, it would schedule itself to run every time the computer is started? And every time the task is run, the computer would shutdown or restart.

Having Your Program Run At Shutdown
I have a program that I need to run at shutdown (after you click shutdown or restart from the menu). Does anybody know the code to do this and when I would have to load the program up in the first place (run the program at Startup and then it know when the computer is shutting down. Also I guess I need to know how to stop the computer from fully shutting down until my program is done and one it is done, how to let the computer continue shutting down! Phew!

thanks for everything!

Run Program At Shutdown
I am creating a program that has a scheduling ability to it to run a batch file at a set time or interval. I have daily, hourly, at startup, etc. The only thing I want to add is an "At Shutdown" (or logoff) feature. All it needs to do is run a Shell command. Is there anyway to do this?
Thanks

Exit Your Program + Shutdown
A newbi question: i was wondering what code is needed for me to exit my entire application. And also im working with timers and the shutdown command i have found. and It is giving me an error like "Only comments may appear after End sub, End function or End property"

this is the decleration i have for the shutdown line:
Private Const EWX_SHUTDOWN As Long = 1
Private Declare Function ExitWindowsEx Lib "user32" (ByVal dwOptions As Long, ByVal dwReserved As Long) As Long

and this:
lngResult = ExitWindowsEx(EWX_SHUTDOWN, 0&)

now i have added this command to a button just for testing the code to see if it works.. and i get the above ^ error about the comments... whats doing? Hope ive explained it half clear...

Hope you can help

Could My Program Cause This Xp Shutdown Problem
My program is currently being tested on a network. One of the computers on the network refuses to shutdown. Ms office is also on this
computer which runs on winXP. Having looked it up on google i think it might be an ms office problem, something to do with "CTFMON".

There is a bug in my program that when a user closes the current form the program might occasionally fail to load the next form and the program literally vanishes, (no comments on this please!). There are then no open forms.

I presume the variables of my modules will still be in memory and could they somehow cause the above prob?

Also if i click the restart button wouldn't this completely eliminate my program from memory, so that if the computer refuses to shutdown next time it couldn't possibly have anything to do with my prog?

Is there some way of detecting what progs are currently running, even if they are not visible?

Thanks

Disable Shutdown Using A Program
hey. how can i Disable Shutdown using a program? and then enable it using command buttons?

VB Program Prevent Shutdown Of PC
I have a VB program running on a PC (XP). Some other program is also running (nonVB). This program wants to shutdown the PC using an shutdown API, but my program doesn't allow this (using the mild version of this API). How can I add code to tell, when I will accept a shutdown? Will a shutdown overrule a writing to the disk?

Thanks in advance.

How To Shutdown A Running Program?
Hi,
I have a VB program running on a network share. I want to be able to shut it down from my workstation, so I can replace it with the new version.

How can I shut down a running program?

Auto Run Program Before Shutdown
Hi guys I’m a new VB programmer and I need a bit of help please. I have written as small program that I would like to run when I click on the windows start menu -> “Turn off computer” but only start then or maybe have it run at startup but then the main code must run when I click on shut down.

Please can someone help me and tell me how I must go about this.
Thanking you all in advance

VB6 Program Shutdown By Windows2000
Hello,

I have searched but have not found anything relating to this. I am not sure if it belongs on this forum.
When running a VB6 .exe (called Cidars) on a Windows 2000 PC - the following error is generated from time to time (not always but several times a day).

PROGRAM ERROR:
Cidars2K.exe has generated errors and will be closed by Windows.
You will need to restart the program.

An error log is being created. (ok button)

This causes loss of data, etc. We are running IE 5.5 with service pack 2.

Thanks!






 

Shutdown Inside A Program
Is there a way to reboot or shutdown the computer from inside a program? I'm making a joke program to give my friend. There is a button on a form, and when you click the button, a message box pops up. The box says that important system files have been deleted, and after that is when I need the code to reboot or shutdown the computer. If anybody can help, I'd appreciate it.

Shutdown Program W/ Idling Feature
Greetings! I'm actually making a shutdown program with idling features, which means when there is no mouse or keyboard activity within a period of time then it will trigger the shutdown event.

My idea is to put the code in a loop.The timer will count down (example, the user sets idle for 5 minutes), when it reaches to zero then the system will trigger to shutdown. One question though, how can I make VB determine if there is a mouse or keyboard activity.

I need your help on how to do this, I'm a beginner in VB. Any ideas will gladly appreciated. Thank you very much!

Auto Run Program Before Windows Shutdown
I have a small program, I want to activate it when I click on the windows start menu and click Turn off Computer When I click on that, I want MY program to do a specific function (I have write the program and can make it work fine if it opens its own form and I click on a VB button).

This function will do something like check my PC, if all is ok I would like the program to stop running and then the PC can continue to close. However if my program DOES meet one of my requirements, a msg box will pop up. And only once I have clicked OK on the msg box then my program must close and then the PC must continue to shut down.

Please can someone help me and tell me how I must go about this.
Thanking you all in advance

How To Keep Program From Being Shutdown Via NT Task Manager
I'd like to have a program run in the back ground, not be shown in the NT task manager Application listing - these
things I can do.

I'd also like to do one of two additional things. Hide the program from the
NT task manager Processes listing, or be able to have the program unable to be shutdown like the system exe's -
when a user tried to shut one down using the
processes listing in task manager, a window pops up and says
"The operation could not be completed. Access Denied."

Thanks in advance.

Lawson.

How To Call A Vb Program During The Windows Shutdown?
Hi, I have a vb application which is run to disable a particular NIC(network Interface Card) when the windows is started. When the windows is shutdown, the program is to detect if the NIC is enabled and disable it, if so.

I would like to know how to call the program when the windows shutdown occurs?

*** RESOLVED *** Error Occurs During Shutdown Of Program
Hi everyone. I am trying to be a good little programmer person type and I am trying to create a shutdown sub routine for my program. Unfortunately I seem to be having a problem. In the past I was taught that you should close your recordset objects when you are done with them after filling a listview or getting the data out of your DB. If I do this and then in my shutdown sub routine I test the recordset object to see if it is open I get an error. Here is my code for accessing the database and filling my extended listview:
    
Code:Public Sub loadList()

    Dim strSQL As String
    Dim oListItem As ListItem
    Dim ResidentName As String
    Dim DrName As String

    strSQL = "SELECT tblAppt.Appointment_Date, tblAppt.Appointment_Time, tblResident.Last_Name," _
            & " tblResident.First_Name, tblResident.Apt_Num, tblResident.Phone_Number, tblResident.Mobility," _
            & " tblResident.Complex_Side, tblDoctor.Dr_Last_Name, tblDoctor.Dr_First_Name," _
            & " tblDoctor.Dr_Phone_Num, tblDoctor.Dr_Address, tblDoctor.Dr_City, tblDoctor.Dr_CrossStreet" _
            & " FROM tblResident INNER JOIN (tblDoctor INNER JOIN tblAppt ON tblDoctor.Dr_ID = tblAppt.Dr_ID)" _
            & " ON tblResident.Resident_ID = tblAppt.Resident_ID Order By tblAppt.Appointment_Date , tblAppt.Appointment_Time"

    Set mySearchRS = New ADODB.Recordset

    mySearchRS.Open strSQL, myDbConn, adOpenForwardOnly, adLockOptimistic

        elvResults.FullRowSelect = True

        elvResults.ColumnHeaders.Add , , "APPT DATE", 1200
        elvResults.ColumnHeaders.Add , , "APPT TIME", 1200
        elvResults.ColumnHeaders.Add , , "RESIDENT'S NAME", 2000
        elvResults.ColumnHeaders.Add , , "PHONE NUMBER", 1700
        elvResults.ColumnHeaders.Add , , "APT. #", 800
        elvResults.ColumnHeaders.Add , , "SIDE", 700
        elvResults.ColumnHeaders.Add , , "MOBILITY", 1100
        elvResults.ColumnHeaders.Add , , "DOCTOR'S NAME", 1800
        elvResults.ColumnHeaders.Add , , "DOCTOR'S ADDRESS", 2200
        elvResults.ColumnHeaders.Add , , "PHONE NUMBER", 1650
        elvResults.ColumnHeaders.Add , , "CROSS STREETS", 3500

    If mySearchRS.RecordCount > 0 Then
        mySearchRS.MoveFirst

        elvResults.ListItems.Clear

        Do While Not mySearchRS.EOF

            ResidentName = mySearchRS!First_Name & " " & mySearchRS!Last_Name
            DrName = mySearchRS!Dr_First_Name & " " & mySearchRS!Dr_Last_Name

            Set oListItem = elvResults.ListItems.Add(, , mySearchRS!Appointment_Date)
                oListItem.SubItems(1) = mySearchRS!Appointment_Time
                oListItem.SubItems(2) = ResidentName
                oListItem.SubItems(3) = mySearchRS!Phone_Number
                oListItem.SubItems(4) = mySearchRS!Apt_Num
                oListItem.SubItems(5) = mySearchRS!Complex_side
                oListItem.SubItems(6) = mySearchRS!Mobility
                oListItem.SubItems(7) = DrName
                oListItem.SubItems(8) = mySearchRS!Dr_Address
                oListItem.SubItems(9) = mySearchRS!Dr_Phone_Num
                oListItem.SubItems(10) = mySearchRS!Dr_CrossStreet
            Set oListItem = Nothing

            mySearchRS.MoveNext
        Loop
    Else
        'norecords!
        Beep
    End If

        'set the focus on the first row in the listview if there are any.
    If elvResults.ListItems.Count > 0 Then
        elvResults.ListItems(1).Selected = True
        elvResults.ListItems(1).EnsureVisible
    End If

    mySearchRS.Close        'here is where I am closing the recordset object and setting it to nothing
    Set mySearchRS = Nothing

End Sub

Now below is my code for closing all of the objects and forms:

    Code:Public Sub ProgramShutdown()

    On Error GoTo nErr
    
        'mySearchRS needs to be closed and set to nothing
    If mySearchRS.State = adStateOpen Then
        mySearchRS.Close
        Set mySearchRS = Nothing
    End If
    
        'frmAppointments needs to be unloaded

        'myDbConn needs to be closed and set to nothing

        'frmSplash needs to be unloaded

    frmAppointments.Visible = False
    Exit Sub

nErr:

    message2 = MsgBox("We have a problem Houston!", vbOKOnly, "Shutdown Error Warning")
    Exit Sub

End Sub

If I comment out my RS closing and = nothing lines in my first bit of code everything works fine when I shutdown. If I leave it like this I always get an error and I don't finish by going back to the calling routine which is:

    Code:Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

Instead I always find myself one line above the nErr line in my code. If I set a breakpoint in my code, say at the beginning of the subroutine than I step through the code when it gets there it will always go back to the end of the calling routine before it finishes responding.

Anyway, I may just not understand how this works and it may be working fine but I don't want to write improper code so I thought I would ask here.

Also I did research the city postings and read the FAQ's and other posts that related to this problem. That is where I came up with doing the shutdown this way. If anyone has a template of code that they always use and they want to post it so I can adapt it to work with my program I would appreciate it but any help I can get will be much appreciated.

Thanks to you all for helping. Later,


Cliff R.
Mesa, AZ
Check out my website at http://crogers.org
Being an organ donor is giving the greatest gift that someone can give.
It is giving the gift of life. Please register to be an organ donor.


Edited by - crogers on 7/19/2005 5:32:26 PM

HOWTO Shutdown/Terminate Windows MediaPlayer From VB Program?
Sheesh..seems Ive managed to stump the experts here!

What Im Trying to do in my VB networked program is use ShellExecute to launch the Windows Media Player, and then shut it down from the program.

First the code to LAUNCH:

Dim ItemFile As String
ItemFile = "Training1.mpg"
Call ShellExecute(hwnd, "Open", ItemFile, "", App.Path & "Items", 1)
bIsPlaying = True ' SETS THE MULTIMEDIA FLAG!!!

So now I have the Media running; what I WANT to have happen is when the user clicks the Next Item button, code in the click event ENDS/CLOSES/KILLS the Windows Media Player!

Ive looked at the SendMessage, TerminateProcess, and CloseHandle API calls but NONE of them work! I can't guarantee just WHERE the MediaPlayer.exe is on a Network, so If I need to find the path of the executable that is running the ShellExecute function-how do I do that?

Does ANYONE have an idea of how to simply close the MediaPlayer with code from the VB program that will work in Windows 98 AND NT 4.0?? Id really appreciate any help. Thanks!

Prevent Shutdown And Get Shutdown Type?
ok what i want to do is this - make an app like this:
http://www.vbaccelerator.com/home/VB...wn/article.asp

basically make an app that can detect shutown / log off etc and cancel it - but i need it to differenciate between a logoff, shutown or RESTART - now i know this is possible as there is a delphi eg at:
http://72.14.235.104/search?q=cache:...&ct=clnk&cd=11

on how to do this, however when tring to find out how to do this in vb i had little success - and found this from microsoft:


Quote:




lParam
This parameter can be one or more of the following values. If this parameter is 0, the system is shutting down or restarting (it is not possible to determine which event is occurring).





at http://msdn.microsoft.com/library/de...endsession.asp

Logoff
Dear All,
I want to write a program which will remaind me some thing while log.How do I

Run At Logoff??
Hi,
How to run my exe at windows logoff?

How To Logoff
whats the command to logoff or shutdown, if its possible, how can i shutdown other computer connected to lan

Logoff?
Is there anyway of me 'running' the 'proper' logoff option in Windows XP? When you select logoff from the start menu, it greys out the background... I want to write a VB app that mimicks this so I can get it to grey out the background. I'm not talking about re-creating the whole logoff option, but just launching the buit-in windows one.
 
Is this possible?

Many thanks/...

Logoff
How would I create a little application that pops up a message saying 'Are you sure you want to logoff?' with an OK button and a Cancel button. With the OK button obviously logging them of and the cancel button doing nothing.

Thanks/...



Edited by - ldoodle on 10/3/2003 3:51:22 AM

How To Logoff The Windows 95,98 And Me?
Hi, i want to logoff the windows 95,98 and Me using API.
I have the following code for logoff windows NT based (NT,2000,XP).
How to logoff windows 95,98 and Me?
Thanks


Code:
Private Const EWX_LOGOFF = 0
Private Const EWX_SHUTDOWN = 1
Private Const EWX_REBOOT = 2
Private Const EWX_FORCE = 4
Private Const TOKEN_ADJUST_PRIVILEGES = &H20
Private Const TOKEN_QUERY = &H8
Private Const SE_PRIVILEGE_ENABLED = &H2
Private Const ANYSIZE_ARRAY = 1
Private Const VER_PLATFORM_WIN32_NT = 2

Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type

Private Type LUID
LowPart As Long
HighPart As Long
End Type

Private Type LUID_AND_ATTRIBUTES
pLuid As LUID
Attributes As Long
End Type

Private Type TOKEN_PRIVILEGES
PrivilegeCount As Long
Privileges(ANYSIZE_ARRAY) As LUID_AND_ATTRIBUTES
End Type

Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
Private Declare Function OpenProcessToken Lib "advapi32" (ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, TokenHandle As Long) As Long
Private Declare Function LookupPrivilegeValue Lib "advapi32" Alias "LookupPrivilegeValueA" (ByVal lpSystemName As String, ByVal lpName As String, lpLuid As LUID) As Long
Private Declare Function AdjustTokenPrivileges Lib "advapi32" (ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, PreviousState As TOKEN_PRIVILEGES, ReturnLength As Long) As Long
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (ByRef lpVersionInformation As OSVERSIONINFO) As Long


'Detect if the program is running under NT platform
Private Function IsWinNT() As Boolean
Dim myOS As OSVERSIONINFO
myOS.dwOSVersionInfoSize = Len(myOS)
GetVersionEx myOS
IsWinNT = (myOS.dwPlatformId = VER_PLATFORM_WIN32_NT)
End Function

' Log off the current user
Public Sub LogOff()
Dim ret As Long
Dim Flags As Long
Flags = EWX_LOGOFF
If IsWinNT Then
Flags = Flags + EWX_FORCE
ExitWindowsEx Flags, 0
End If
End Sub

LogOff Question!
Hey How can I check when a user logs off/switches user/tries to shut down... also, how can I check if some process if running... Say For example I made an exe Project1.exe... and user tries to run it again... how can i check if its already running...

Logoff When System Is Not Doing Anything.
I want to Logoff WINDOWS XP PROFESSIONAL when system is not performing any task (as screen saver pops), how can it be coded in VB 6.0.

Logoff NT User
is there any code to list all the currently online users in a combo box, and when one has been selected, there is a button, and when the button is pressed the user will be logged off?

is this possible

thanks in advance

Logoff Windows
Hi,

I have tried this:

VB Code:
Call ExitWindowsEx(0, 0)


and this:

VB Code:
Shell "rundll32 shell32.SHExitWindowsEx 0"


too logoff windows. They both work fine on my computer(win 98), but ive sent it to somene that is using win ME, and it still shows the desktop icons behind the windows logon dialog when they r logged off

Why is it doing this?

Application Logoff
Hi,

I have been asked to develop a log off method to our existing vb application. When the user click on the exe file I display frmLogin to authenticated the user. When the user type a userid and password and the authentication is valid I then, displayed frmMain.

Our vb application run a client machine like Windows NT or windows 2000. Multiple users can login on the same machine.

I need to be able from the frmMain allow each user the ability to log off without existing the application every single time for another user to login.

I will be ideal to do something like Windows NT or Windows 2000 does ("CTRL+ALT+DELETE")

Any code sample will be appreciated.

Thanks
cc

Windows Logoff
I want to detect when the user of a network decides to logoff so I can delete a folder. How would I do that?

Thanks in advance.

Remote Logoff
how to remote logoff through vb???????

Force LogOff (@XP)
I'm making an app that, on request from an internet sent signal, logs the user of another computer off, or, even better if possible, performs "switch user". I actually got the communications part working painlessly through the winsock control, but now it's the part about forcing a log-off / user switch. I came across a piece of code I used in this program's precessor, but it's actually for old NT or even Windows 9x, and the computer has WinXP. It worked, but it caused the "turn off" button at the corner of the full-screen login (blue with square pictures, you know) to disappear.

I wonder if I can get the button back, and if there's a more XP compatible way to do this. As much as I admire those who understand the inner of windows, short simple code without API and cryptic declares is preferred (it could even be a script) if possible. Any way is better than nothing ofcourse

Logon And Logoff
Hi
need code for the above task
i have a form that has a menu item logoff
when i start the app i go thru a login form and load my app
what i need is when the user clicks the logoff menu item on the main form then this form is unloaded and the login form is loaded and displayed
what prob m facing is that the main form has the menu item logoff
on the click event i write code to unload the main form and load the logon form but what happens is once the main form is unloaded it cannot load ne other form right??
and if on the click event i load the login form and then unload the main form then the login form is displayed and after successful login the main form shud be displayed but instead the app exits
whats the bug?

Samir
Skill is successfully walking a tightrope over Niagara Falls. Intelligence is not trying.

VB6 Logoff Service
I have a vb6 application that I installed using srvany.exe. It's purpose is to track idle time and count in seconds how long since the last interaction from the mouse or keyboard. This part works fine. The problem I am having is once a specific time is reached, say 3 hours, it's supposed to Shell a command file that will log the workstation off.
If I run the command file without using the service, it will log the workstation off without problems. But if the service is running and it calls the command file, it doesn't logoff, instead it looks like it's performing a shutdown because the message "It's now safe to turn off your computer" shows up.
I have tried several different ways to try to logoff the workstation and each time the service runs, I get the message and it does not log the workstation off. I guess the problem has to lie with the VB6 app or the way the service is running. I have no idea.

Any help would be appreciated.

Thanks

Copyright 2005-08 www.BigResource.com, All rights reserved