I am trying to capture SHUTDOWN and LOGOFF Events, so that I can be alerted when my process stops. The below code works in detecting these events. I am trying to get it to release the monitoring of the system events after the email has been sent, Being newer to VB, I am not sure how to do this. I copied this code from another google forum.
What i wish to find is a message or the like that I can use to detect between specific 'shutdown' like events, ie: I wish to be able to find the difference between a shutdown, restart, logoff and sleep initiation.
The problem i have found (as displayed below) is using oClosingEvent.CloseReason the return types provide no further information other then the WindowsShutDown constant (the others are obviously irrelevant in this case).
Private Sub frmMain_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing Dim oClosingEvent As System.Windows.Forms.FormClosingEventArgs
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
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 want to capture the system logoff time and i have to store the time in .txt file. when ever the user logging in and logging off i have to capture the time and store the time in .txt file.i konw how to use windows services.but how to capture the log off time and log on time?
I've written an app with a simple textbox which attempts to identify a user from their typing habits (interval between key presses, duration key is held, time between key strokes ie a->s is quicker than a->v for some users, shorter for others depending on typing style). It's far from perfect but it does correctly identify moderate-large differences in style.I'm hoping to use this as a form of security monitor - If the typing style of the user doesn't fit a recognised pattern, report to a central server.
Of course, the next step in testing this is to begin to capture "regular" typing habits - ie when browsing, switching between apps, etc.What I can't figure out how to do is capture keyboard input for all applications (excluding the login/welcome screen, alternate desktops, etc. - I have no reason to parse that and there's probably not enough input to analyse anyway)Disclaimer: Yes, I know this comes dangerously close to writing a keylogger which is verboten but if I wanted to do that, I'd write a keyboard driver in C++ - I'm sure it would be far more streamlined and easier to obfuscate than a hulking .Net MSIL assembly. I have no doubt I'll be fending off "That's a keylogger" comments but I've hit a wall and need to ask somewhere.
How can we capture events of msmq in vb.net.I dont see any events if I declare object type of System.MessageQueue. Do I need to include the COM MS Message Queue 3.0 lib to deal with events and message queue?
I'm writing a Windows Forms app that uses a DataGridView control. I have row select enabled on the control. I would like to trap the DoubleClick event, but it doesn't seem to fire reliably - I often have to double-click on a row 2 or 3 times before the event is triggered. Could anyone point me to a way to capture this more reliably?
I am trying to capture keyboard events in my vb.net applications. I am able to capture all the single key events. I am not able to capture (<) key which is (shift + ,) and (>) key which is (shift + .).
I'm trying to automate a product that provides no such automation capability.I've take a cursory look at loading the app in a separate AppDomain, and also, through reflection, executing the Program.Main() to get the app running. I also tried getting the windowhandle from a separately created Process object (which I've learned will not work).If I have a reference to their assembly added to my project so I can reference an instance of "TheirProduct.FormMain", what, if it's possible, is the best way to go about capturing events from that form? What I need to do is to be able to capture a couple events, and perform a few Button.PerformClick() against the form.
I am trying to find a way to capture keyboard events with the intent of preventing users from being able to hit Ctrl + Alt + Del while my application is running. I've spent several hours poking around looking for inspiration but only finding unclear and half-baked examples. As such, I was thrilled to stumble across the article: Managing Low-Level Keyboard Hooks in VB .NET written by Paul Kimmel [URL] This article is insightful, comprehensive, well-written, and I thought it was a huge help. One little problem though, the code that was provided did not work, (I knew it was too good to be true!).
Now, Mr. Kimmel seemed very knowledgable and I think that he probably tested his code, so quite likely the problem is something that I'm doing wrong seeing as I am a newbie. As the article suggests I cut and pasted his code into a module in my project (solution I guess is the proper term), and I call the HookKeyboard method from a button on a form, and Presto! Nothing happens. Stepping through this code I see that the second line in HookKeyboard:
I have a distributed print control application that is done in a combination VB6 and Visual C++. The application launches at startup on a workstation and waits for a user to login. Once that happens, we track time in the session, along with how many print jobs the guy performs.
We have separate session SW that allows a person to add money to their accounts. The problem is that if there's an active session, typically due to the individual being logged into one of the above mentioned workstations, I can no longer ensure updates to the DB will be atomic.
I would like to have the money terminal send a log off command to the remote workstation session if it detects a user is currently logged in elsewhere. But I'm not sure if there's an existing API for this.
I want to create a windows service which will record the time when a user Logs in or logs Off from his machine.If i am able to track the events that are fired when a user logs in and logs off then i think i will be able to solve the problem.
So I am hacking together an app which listens to traffic using SharpPcap library, it reconstructs the packets from sessions using the code from TpcRcon.
Listening and reconstructing part work on their own . What I want is on each packet arrival main window gets an event so it can display the packet , and when session is reconstructed display a complete packet (I am interested in HTTP ones) . -That is where it breaks with weird symptoms: for example right now it does not stop on invoking stop listening method - the sharppcap library function hangs there forever waiting on this line of code : m_pcapThreadEvent.WaitOne();//wait for the 'stopped' signal from thread
I also had it not working and crashing in sharppcap function because I had omitted one parameter in form delegate- which makes no sense, because form delegate does not deal with packet capture at all and only reacts on "New Packet" event from my "Listener" class (which is only there to notify main form)
My app starts as module main instancing class "Listener". MainForm has it registered as friend with event and handles even "New Packet"
Main Form: Private Sub uiListenStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btListenStart.Click aLogger.AddMessage("Started Listening")
I have been trying to implement the jQuery weekcalendar using .net. What I can't seem to figure out is why weekcalendar states events.events is undefined after I make an ajax call to a webmethod I created which returns JSON. Below is the relevant code:
Shutting down a pc in vb.net is easy:Process.Start("shutdown", "-s -t 00")less the user has locked the pc in which case the above fails.How do I get around this in vb.net? How do I shutdown a locked PC?
I am making a program that takes a time input from the user or a countdown amount and when that time comes it will shutdown or restart or log off the computer. I know how to make the timing code and everything else but i don't know how to shutdown or restart or log off.
I'm currently writing a small system tray app that needs to shutdown my PC at a certain time. That bit's easy:Process.Start("shutdown", "-s -t 00")But how do I do this when my PC is locked? The above doesn't work and I don't want to leave my PC unlocked and unattended
I've written a program which I propose to give a local club, which sadly may be'attractive' to pirates so I propose to build in some sort of anti-copying feature.My idea is to hide a file in a folder somewhere in the club's laptop, then on program start up I'll check to see if that file exists and if it's not there, which it's unlikely to be on a pirates machine, I'll flag up a message box saying that if they have a legitimate reason to install the program on a different machine they'll have to contact myself.By way of nuisance value, pressing the 'OK' button on the message box will cause the machine running, what I'm assuming is a pirated copy, to shut down.I've been looking at the VB.NET forum and MSDN for ideas as to how to achieve this and the general opinion seems to be:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Process.Start("shutdown", "-s")
I have a fully working application which runs in the background while a user is logged in. What I need the application to do, is disconnect itself from the database, save the users settings and close itself when the user shuts the computer down or logs off.I know how to do those things, the issue I am facing is figuring out how to detect when the computer is logging off or shutting down. I thought about using log off scripts to do this but then it would be impossible to call classes and methods from my application as the log off scripts are not associated with my application at all. Are there any other methods of telling my application when the computer is shutting down and then run some lines of code?
I have a program with the line process.start("shutdown", "-s -f -t 00") However, when it's executed, everything exits, and the logging off text appears, then the screen blackens out and there's only the mouse pointer. Nothing can be done like opening the task manager, I just have to shut it down using the main button, holding it for 7 sec.
I'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.
Is there any way to turn off a remote pc that's not by using shutdown /s /m \computer name etc...I just want to turn off the server computer at night from my laptop. Is it possible to make the program check for pings and then shutdown? Or is there an easier way? (Maybe if I'm not on the local network send over a "signal"(?) to the pc so that it'll shut down..?)