Detect If User Requested Shutdown
Feb 5, 2010is there a way to detect if the user is shuting down?
View 1 Repliesis there a way to detect if the user is shuting down?
View 1 RepliesI've been making a program and for it I need to be able to detect shutdown. I've been told to do vbAppWindows etc. but there's a problem. For some reason it says "vbAppWindows is not declared" Does anyone have another way of doing it?Then I've used my.settings throughout the program and it has just started to not work. It wont save anymore.
[Code]...
I have an application that starts from Sub Main and I need to run a sub when the system is about to shut down, restart or logoff so it can save it's settings. I found some code on google:
Imports Microsoft.Win32
Public Sub Main
AddHandler SystemEvents.SessionEnding, AddressOf OnShuttingdown
[code].....
I want to detect when employees in our company are shutting down or restarting their computers. Is there a Windows API Call that will do that which I can hook onto? I found WindowsExitEX but it actually restarts the computer!
View 2 RepliesI have an application that starts from Sub Main and I need to run a sub when the system is about to shut down, restart or logoff so it can save it's settings. I found some code on google:
Imports Microsoft.Win32
Public Sub Main
AddHandler SystemEvents.SessionEnding, AddressOf OnShuttingdown
[Code]....
But it doesn't seem to work, Windows shuts down yes but when I re-start the vm and run the app it opens with the old settings, not the ones that I changed before I shut down the vm. Anyone know of a way to do this or to fix the code above, I don't think my OnShuttingdown event is being handled.
I'm working on a web browser named Hyvar.NET and i'd like to integrate a form of shutdown detection into it.
Currently, it simply uses a tri-option setting to decide how it opens - like this
If My.Settings.LoadLastOnStart = True Then
frm.wbTab.Navigate(My.Settings.LastOpenedPage.ToString)
ElseIf My.Settings.HomeOnStart = True Then
[Code]....
Each variable is appropriately named for its job as you can see.
However, i want to change this to react to correct and incorrect shutdowns - unexpected and user instigated ones for example. I.E: if the settings variable for the detection contained 0x000000, it could indicate a clean exit and continue as normal with a new session, but 0x000001 would indicate an unclean shutdown and present the user with an option of reopening the last session or continueing as normal, like in IE 7/8
Im 100% sure this will require a windows API call
I'm trying to fill out a webform where the user gets a image in a picturebox and then enters the requested text.But when i submit it to the forum nothing happens This is the code of the html page:
<input id="response_field" type="text" autocapitalize="off" autocorrect="off" name="response_field" autocomplete="off">
How could i add this: value="test" to the above line while the page is beging generated so its part of the webpage?
My
With WebBrowser1.Document.Forms("form")
.All("response_field").SetAttribute("value", "test")
End With
I've written a VB.NET program for a client that stores all of its data in XML files. I use the XMLReader to read the data into a dataset. When I run the sub to encrypt the XML file, I'll get the following message: Error: mscorlib: The requested operation cannot be performed on a file with a user-mapped section open.
It doesn't happen all the time, so I know it does work. But on occassion, I'll get this message. I've been all over the forums and I've tried everything I've read to try and stop this error.
I close the reader object and set it equal to Nothing. I've even tried using DoEvents to make sure the object finished closing before running the Encrypt sub. Nothing has helped.
I develop on a x32 PC. It works fine on the development machine. But then, when the client runs it on a x64 PC, he gets these errors. Could the x64 system really be running so fast that the .Close() and the = Nothing and evern the .DoEvents() can't keep up?
I know that using Dim currUser As String = Request.ServerVariables("LOGON_USER") retunrs the DomainUsername, but I want to know what Group that user is in say in Active Directory.
View 2 RepliesI got the above error when i deploy my web application into windows server 2003. How do i resolve it? [code]
View 3 RepliesI am using VB .Net 2.0. I know I can detect the OS using
System.Environment.OSVersion
Can anyone tell me if there's a list somewhere where I can find what that generates for different OS versions.
Specifically I am trying to detect if a user is running Windows 7 64-bit.
How do I detect if an arbitrary user is an administrator on a machine? I have the user's domain and username but not password. The user is NOT the currently logged in user,so I can't just use WindowsIdentity.GetCurrent.
View 3 RepliesI have an application that when it starts, it checks the internet to see if a new version is available. My problem is this: If there is no net connection, the program 'pauses' as it tries to check for the new version.
Is there a function that I can use to detect if the user is currently online, with a working connection?
I'm trying to work out how to detect if the user has pressed an f key I have this so far:
Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
Label1.Text = e.KeyChar
End Sub
This detects when the user presses a character key and outputs it via Label1.text, but it doesnt work on all keys?
Dim hostname As IPHostEntry = Dns.GetHostEntry(TextBoxIP.Text)
Dim ip As IPAddress() = hostname.AddressList
TextBoxIP.Text = ip(0).ToString()
I have a windows form with the code above to get the ip address of the user. what would be the easiest way to get the country location of the user? based on the IP in the textbox. The solution doesnt need to be 100% accurate but good enough to work most of the time. the simpler the better.is there are any work arounds or built in fuctions for pulling a users country or language, this would be better than creating or managing a giant database.
I found that snippet, edited it a little bit and now im trying to use it...the problem that ocurres, is that its never going into the first IF... so already there seems to be an error.Im working on XP SP3 with admin privileges..
Private Shared Function GetCurrentPrivileges() As Privileges
If My.User.IsAuthenticated() Then
If My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator) Then
[code]......
No doubt a simple question, but I'm a beginner (I learnt GW BritingASIC in 3 months long ago - but after 6 months grappling with vb 2008 I am still bewidered).
I have written a program that asks the user at run time to choose 1 of 40 buttons. These are themselves defined at run time. Whichever button is chosen the same algoritm will run (using different data). Question: To save writing the same Button_Click routine 40 times, what code should I write - and where in the program - to detect which of the 40 the user has chosen?
Is there for my .Net application to detect if a user has logged on? It is a Windows Service, so it will be running before logon.What I want to do is display a "popup" when a user logs on to tell them the status of the application
View 2 RepliesI need to detect whenever user clicks the mouse, no matter what form is selected at the given time.
I know that detected keypresses globally can be done through a Keyboard hook so I assume that i am going to need some sort of Mouse Hook.
How would I go about having my program monitor all open (or at least the current active) Internet Explorer windows and their current URLs? Basically, I want my program (running in system tray) to monitor the web page that is being viewed in an Internet Explorer window (NOT an integrated web browser control), and if it detects the loading of a specific URL address, execute whatever code.
View 6 RepliesAdding How would you detect if the user is using the computer? I want a program to detect if the user is using the computer (i.e. mouse and keyboard movements), and if the user doesn't type or move the mouse for a specific amount of time, it executes a command. Normally I would do this with the Application.Idle, but I want it to be detected throughout the system. Any starters?
View 22 RepliesI have Example and i need to kill the session when user close his browser window.
i tried page_unload() not working. the example is:i have parent windows and window will open from it i need to delete session when user close the child window.
How do I determin if a user has given me what I am asking for in terms of data type.
Example if my prompt to the user say "Give me a number of double data type"
How can I tell that the user entered a double xx.yy?
Or if I am testing for integers and I get user input ABC.GH?
I know about CDbl and CInt and CStr but these don't work unless data is provided. Also how do you test if the conversion took place? Also how do you differencate between 12.00 being integer?
How to detect if the user pasted in more than one line of text in VB? You could answer in C# if you like (I can convert it later
View 4 RepliesI need to find out if the user's screen is set to normal 96 dpi (small size), large 120 dpi fonts, or something else. How do I do that in VB.NET (preferred) or C#?
View 2 RepliesI'm trying to find out a way to detect when ever the user presses CTRL -ALT - DEL or Window + L to lock the PC.The code I'm using is
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If (GetAsyncKeyState(17) AndAlso GetAsyncKeyState(18) AndAlso GetAsyncKeyState(46)) Or ((GetAsyncKeyState(91) Or GetAsyncKeyState(92)) AndAlso GetAsyncKeyState(76)) Then[code]....
However, as soon as the user presses CTRL-ALT-DEL the Windows Security Screen comes up and it is too fast for VB to detect that the keys have been pressed.I did a little reaserch on how to work around this issue and found that a GINA stub can be written which can delay the Windows Security Screen by some time say 2 secs which would be enough for VB to detect that the keys have been pressed.Also disabling Ctrl-Alt-Del through VB does not work because it is too fast for VB and I would like not to disable CTRL-ALT-DEL
I have aconsole application that executes 2 other processes, and then closes the processes once it's finished its work.
If the user closes the console application prematurely, the 2 other processes go rogue and sit idle (As they are expecting to be closed by the console).
Is it possible to detect when the user clicks the X or closes the console app in another fashion, so I can also destroy the spawned processes?
I want to detect when the user has changed the content of a Textbox.
The following does not work for me, because: When the user navigates through the database (using my navigation buttons), the textbox is also changed, but NOT by the user making input. I would only like to know when the user EDITED the Textbox.
Private Sub mskStudentNumber_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles mskStudentNumber.TextChanged
If Not Movement Then '' If not navigation
[Code]....
I have created a class which builds a Crystal report and displays it in a report viewer. However, without the Crystal Redistributable, the code crashes. How can I programatically detect whether the end-user has the Crystal DLL installed? The code I am required to include is:
[Code]...
The user can enter text into the system but I want to detect if the previous string entered is the same as the next string entered. if it is an error message or something will appear.
View 4 Replies