Click here to Skip to main content
15,895,606 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# Sucks! Pin
Luis Alonso Ramos23-Sep-05 15:26
Luis Alonso Ramos23-Sep-05 15:26 
AnswerRe: C# Sucks! Pin
Mohamad Al Husseiny23-Sep-05 13:56
Mohamad Al Husseiny23-Sep-05 13:56 
QuestionWhat message is called when the X in the upper right of a dialog is closed Pin
Dan Neely23-Sep-05 10:04
Dan Neely23-Sep-05 10:04 
AnswerRe: What message is called when the X in the upper right of a dialog is closed Pin
Mohamad Al Husseiny23-Sep-05 12:52
Mohamad Al Husseiny23-Sep-05 12:52 
AnswerRe: What message is called when the X in the upper right of a dialog is closed Pin
mav.northwind23-Sep-05 19:18
mav.northwind23-Sep-05 19:18 
GeneralRe: What message is called when the X in the upper right of a dialog is closed Pin
Dan Neely26-Sep-05 3:13
Dan Neely26-Sep-05 3:13 
Questionmscorlib::Not enough storage is available to complete this operation. Pin
Kant23-Sep-05 8:15
Kant23-Sep-05 8:15 
AnswerRe: mscorlib::Not enough storage is available to complete this operation. Pin
Dave Kreskowiak23-Sep-05 9:14
mveDave Kreskowiak23-Sep-05 9:14 
Real-time event notifications don't work very good over a WAN connection. I found that I had to buffer them and get an update pack about every 15 seconds to get it to work correctly. The VBScript code I used went something like this:
Set objWMIServices=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & machineName & "\root\CIMV2")
 
set objSink = WScript.CreateObject("WbemScripting.SWbemSink","SINK_")
 
WScript.Echo "Starting Listeners... Win32_Process"
objWMIServices.ExecNotificationQueryAsync objSink, "SELECT * FROM __InstanceCreationEvent WITHIN 60 WHERE TargetInstance ISA 'Win32_Process'"
 
Sub SINK_OnObjectReady(wmiObject, wmiAsyncContext)
	Set objTargetInstance = objWMIServices.Get(wmiObject.Properties_("TargetInstance").Value.Path_.Path)
	WScript.Echo Now() & " - " & objTargetInstance.GetObjectText_()
	WScript.Echo objTargetInstance.CreationClassName
	If objTargetInstance.CreationClassName = "Win32_Process" Then
		Rtn = objTargetInstance.GetOwner(strNameOfUser, strDomain)
		If Rtn <> 0 Then
			Wscript.Echo "Could not get owner info for process " & objTargetInstance.Name & VBNewLine & "Error = " & Rtn
		Else 
			Wscript.Echo "Process launched by " & strDomain & "\" & strNameOfUser & "."
		End If
	End If
End Sub

This code is part of a "quick little tool" that watches for new processes to launch and notifies me whenever it happens. I was looking for a certain someone to start gambling on company time and I needed to catch him with his hand in the cookie jar, so to speak.

The "WITHIN 60" clause just means I get an update from the remote machine every 60 seconds instead of right when the event happens. Over a slow connection, real time events tends to get dropped if they happen in quick succession. This was the work around to get more reliable notifications.



RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

GeneralRe: mscorlib::Not enough storage is available to complete this operation. Pin
Kant23-Sep-05 10:33
Kant23-Sep-05 10:33 
QuestionSharePoint Customization - Possible? Pin
stan2823-Sep-05 7:32
stan2823-Sep-05 7:32 
Questioncontextmenu Pin
PHDENG8123-Sep-05 7:29
PHDENG8123-Sep-05 7:29 
AnswerRe: contextmenu Pin
Judah Gabriel Himango23-Sep-05 8:05
sponsorJudah Gabriel Himango23-Sep-05 8:05 
GeneralRe: contextmenu Pin
PHDENG8126-Sep-05 1:57
PHDENG8126-Sep-05 1:57 
GeneralRe: contextmenu Pin
Judah Gabriel Himango26-Sep-05 4:11
sponsorJudah Gabriel Himango26-Sep-05 4:11 
QuestionListing Database Names Pin
Member 205875323-Sep-05 7:28
Member 205875323-Sep-05 7:28 
AnswerRe: Listing Database Names Pin
Mohamad Al Husseiny23-Sep-05 14:09
Mohamad Al Husseiny23-Sep-05 14:09 
GeneralRe: Listing Database Names Pin
Member 205875326-Sep-05 7:23
Member 205875326-Sep-05 7:23 
Questionneed to understand once and for all.... Pin
...---...23-Sep-05 5:49
...---...23-Sep-05 5:49 
AnswerRe: need to understand once and for all.... Pin
Robert Rohde23-Sep-05 6:21
Robert Rohde23-Sep-05 6:21 
GeneralRe: need to understand once and for all.... Pin
...---...23-Sep-05 6:56
...---...23-Sep-05 6:56 
GeneralRe: need to understand once and for all.... Pin
Dan Neely23-Sep-05 7:05
Dan Neely23-Sep-05 7:05 
GeneralRe: need to understand once and for all.... Pin
...---...23-Sep-05 7:17
...---...23-Sep-05 7:17 
GeneralRe: need to understand once and for all.... Pin
Guffa23-Sep-05 8:06
Guffa23-Sep-05 8:06 
GeneralRe: need to understand once and for all.... Pin
...---...23-Sep-05 8:39
...---...23-Sep-05 8:39 
GeneralRe: need to understand once and for all.... Pin
Dave Kreskowiak23-Sep-05 8:48
mveDave Kreskowiak23-Sep-05 8:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.