Click here to Skip to main content
15,926,443 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: VB Codes Pin
Richard MacCutchan2-Mar-10 21:29
mveRichard MacCutchan2-Mar-10 21:29 
QuestionPop up Notification Design Pin
structures832-Mar-10 12:04
structures832-Mar-10 12:04 
AnswerRe: Pop up Notification Design Pin
Wayne Gaylard2-Mar-10 14:07
professionalWayne Gaylard2-Mar-10 14:07 
AnswerRe: Pop up Notification Design Pin
The Man from U.N.C.L.E.2-Mar-10 22:42
The Man from U.N.C.L.E.2-Mar-10 22:42 
QuestionThread slow down system Pin
Gagan.201-Mar-10 23:36
Gagan.201-Mar-10 23:36 
AnswerRe: Thread slow down system Pin
Paulo Zemek2-Mar-10 1:54
Paulo Zemek2-Mar-10 1:54 
GeneralRe: Thread slow down system Pin
Gagan.204-Mar-10 3:59
Gagan.204-Mar-10 3:59 
AnswerRe: Thread slow down system Pin
Dave Kreskowiak2-Mar-10 1:56
mveDave Kreskowiak2-Mar-10 1:56 
It slows down the entire system because your code is horribly inefficient.

Did you notice that you're calling Process.GetProcesses (kind of expensive) each and every time you look at a new item in the MonitorList?

You're also consuming 100% of the CPU since your loops doesn't yield at all.

You also have the problem of killing off a legit process running off the hard drive with the same name as one stored on the stick.

Killing off a process rather abruptly opens the system up for data corruption and system instability if the app doesn't get the chance to close gracefully.

Your have two "fixes" for the performance problem. First, switch your loops so your only getting the Process list once per pass. Second, put in a Thread.Sleep (with an appropriate value) to put this thread to sleep for a second or two before it goes for another pass.


Look, you really can't stop someone from running applications off of a USB stick like this. There is a group policy that can stop this without you constantly killing the CPU to do it. It's also quite easy to kill off your process and launch an app anyway.

A guide to posting questions on CodeProject[^]



Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007, 2008
But no longer in 2009...




GeneralRe: Thread slow down system Pin
Gagan.204-Mar-10 4:04
Gagan.204-Mar-10 4:04 
GeneralRe: Thread slow down system Pin
Dave Kreskowiak4-Mar-10 12:57
mveDave Kreskowiak4-Mar-10 12:57 
Questioncould not find a part of the path... [modified] Pin
mehrnoosh1-Mar-10 21:01
mehrnoosh1-Mar-10 21:01 
AnswerRe: could not find a part of the path... Pin
εїзεїзεїз2-Mar-10 1:40
εїзεїзεїз2-Mar-10 1:40 
GeneralRe: could not find a part of the path... Pin
mehrnoosh5-Mar-10 18:30
mehrnoosh5-Mar-10 18:30 
QuestionHow do you consume an existing web serivce Pin
gengel1-Mar-10 20:14
gengel1-Mar-10 20:14 
AnswerRe: How do you consume an existing web serivce Pin
Steven J Jowett2-Mar-10 0:38
Steven J Jowett2-Mar-10 0:38 
GeneralRe: How do you consume an existing web serivce Pin
gengel2-Mar-10 1:12
gengel2-Mar-10 1:12 
QuestionAdding a signature to vb.net form Pin
fresh12071-Mar-10 15:52
fresh12071-Mar-10 15:52 
AnswerRe: Adding a signature to vb.net form Pin
EliottA1-Mar-10 16:45
EliottA1-Mar-10 16:45 
GeneralRe: Adding a signature to vb.net form Pin
fresh12072-Mar-10 12:32
fresh12072-Mar-10 12:32 
GeneralRe: Adding a signature to vb.net form Pin
Dave Kreskowiak2-Mar-10 12:40
mveDave Kreskowiak2-Mar-10 12:40 
GeneralRe: Adding a signature to vb.net form Pin
fresh12072-Mar-10 16:13
fresh12072-Mar-10 16:13 
GeneralRe: Adding a signature to vb.net form Pin
Dave Kreskowiak2-Mar-10 18:45
mveDave Kreskowiak2-Mar-10 18:45 
QuestionFile.Exist Not Working Correctly Pin
Dominick Marciano1-Mar-10 5:08
professionalDominick Marciano1-Mar-10 5:08 
AnswerRe: File.Exist Not Working Correctly Pin
Steven J Jowett1-Mar-10 5:59
Steven J Jowett1-Mar-10 5:59 
GeneralRe: File.Exist Not Working Correctly Pin
Dominick Marciano1-Mar-10 7:09
professionalDominick Marciano1-Mar-10 7:09 

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.