Click here to Skip to main content
15,887,880 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to use Fmodce.dll API Pin
Pete O'Hanlon21-Aug-13 4:53
mvePete O'Hanlon21-Aug-13 4:53 
GeneralRe: How to use Fmodce.dll API Pin
sxrenren200622-Aug-13 15:19
sxrenren200622-Aug-13 15:19 
GeneralRe: How to use Fmodce.dll API Pin
NotPolitcallyCorrect21-Aug-13 4:57
NotPolitcallyCorrect21-Aug-13 4:57 
GeneralRe: How to use Fmodce.dll API Pin
sxrenren200622-Aug-13 15:23
sxrenren200622-Aug-13 15:23 
QuestionBlocking application from starting from a wpf-client Pin
Oscar Andersson20-Aug-13 21:14
Oscar Andersson20-Aug-13 21:14 
AnswerRe: Blocking application from starting from a wpf-client Pin
Eddy Vluggen21-Aug-13 1:52
professionalEddy Vluggen21-Aug-13 1:52 
GeneralRe: Blocking application from starting from a wpf-client Pin
Oscar Andersson21-Aug-13 20:38
Oscar Andersson21-Aug-13 20:38 
AnswerRe: Blocking application from starting from a wpf-client Pin
Oscar Andersson21-Aug-13 20:40
Oscar Andersson21-Aug-13 20:40 
I am trying this solution. In this test solution i kill all application that starts. If you see anything strange or something that is wrong. Let me know. I hop this help other

// I call this method when i start my wpf-client
private bool Run()
{
bool bRun = false;

try
{
WqlEventQuery query = new WqlEventQuery("__InstanceCreationEvent", new TimeSpan(0, 0, 1), "TargetInstance isa \"Win32_Process\"");

m_Watcher = new ManagementEventWatcher(query);
m_Watcher.Options.Timeout = new TimeSpan(0, 0, 5);
m_Watcher.EventArrived += new EventArrivedEventHandler(HandleEvent);
m_Watcher.Start();
}
catch (Exception exc)
{}
return bRun;
}// End of Run


// Method that handle events from ManagementEventWatcher

private void HandleEvent(object sender,EventArrivedEventArgs e)
{
try
{
ManagementEventWatcher watch = sender as ManagementEventWatcher;
ManagementBaseObject manBasObj = null;
String strName = String.Empty;
String strPath = String.Empty;
String strPID = String.Empty;

if (watch != null)
{
Object obj;
manBasObj = e.NewEvent;

obj = ((ManagementBaseObject)manBasObj["TargetInstance"])["Name"];
if (obj is String)
strName = obj.ToString();

obj = ((ManagementBaseObject)manBasObj["TargetInstance"])["ExecutablePath"];
if (obj is String)
strPath = obj.ToString();

obj = ((ManagementBaseObject)manBasObj["TargetInstance"])["processId"];
if (obj != null)
{
try
{
strPID = obj.ToString();
}
catch (Exception exc){}
}

//str = String.Format("Process {0} has been created, path is: {1} , PID: {2}",strName,strPath,strPID);

KillProcess(strName, strPath, strPID);
}

}
catch (Exception exc)
{
}
}// End of HandleEvent

// Method that kill the process

private void KillProcess(String strName, String strPath, String strPid)
{
try
{
Process proc = null;

if (!String.IsNullOrEmpty(strPid))
{// We have PID
proc = Process.GetProcessById(int.Parse(strPid));
proc.Kill();
}

// If you want to kill process by name we can do this
/*Process[] pro;
if(!String.IsNullOrEmpty(strName))
{// We have name
pro = Process.GetProcessesByName(strName);

foreach (Process p in pro)
{
p.Kill();
}

}*/
}
catch (Exception exc)
{
}
}// End of KillProcess
AnswerRe: Blocking application from starting from a wpf-client Pin
Bernhard Hiller21-Aug-13 21:59
Bernhard Hiller21-Aug-13 21:59 
GeneralRe: Blocking application from starting from a wpf-client Pin
Oscar Andersson21-Aug-13 22:17
Oscar Andersson21-Aug-13 22:17 
QuestionBlock webbrowser from accessing webpages in C# Pin
Oscar Andersson20-Aug-13 21:13
Oscar Andersson20-Aug-13 21:13 
GeneralRe: Block webbrowser from accessing webpages in C# Pin
Richard MacCutchan20-Aug-13 23:25
mveRichard MacCutchan20-Aug-13 23:25 
AnswerRe: Block webbrowser from accessing webpages in C# Pin
Eddy Vluggen21-Aug-13 1:51
professionalEddy Vluggen21-Aug-13 1:51 
AnswerRe: Block webbrowser from accessing webpages in C# Pin
Dave Kreskowiak21-Aug-13 4:19
mveDave Kreskowiak21-Aug-13 4:19 
GeneralRe: Block webbrowser from accessing webpages in C# Pin
Oscar Andersson21-Aug-13 20:48
Oscar Andersson21-Aug-13 20:48 
GeneralRe: Block webbrowser from accessing webpages in C# Pin
Eddy Vluggen22-Aug-13 5:13
professionalEddy Vluggen22-Aug-13 5:13 
GeneralRe: Block webbrowser from accessing webpages in C# Pin
Oscar Andersson22-Aug-13 20:43
Oscar Andersson22-Aug-13 20:43 
GeneralRe: Block webbrowser from accessing webpages in C# Pin
Dave Kreskowiak22-Aug-13 6:21
mveDave Kreskowiak22-Aug-13 6:21 
AnswerRe: Block webbrowser from accessing webpages in C# Pin
Bernhard Hiller21-Aug-13 21:55
Bernhard Hiller21-Aug-13 21:55 
QuestionBluetooth Pairing Problem Win8 Pin
LearnTheCoding20-Aug-13 20:50
LearnTheCoding20-Aug-13 20:50 
QuestionCollection with unique key by property Pin
Elfin Darkglow20-Aug-13 17:51
Elfin Darkglow20-Aug-13 17:51 
AnswerRe: Collection with unique key by property Pin
BillWoodruff20-Aug-13 19:14
professionalBillWoodruff20-Aug-13 19:14 
AnswerRe: Collection with unique key by property Pin
Bernhard Hiller20-Aug-13 21:12
Bernhard Hiller20-Aug-13 21:12 
QuestionHow To Add Buttons In Textbox? Pin
gaofq20-Aug-13 16:03
gaofq20-Aug-13 16:03 
AnswerRe: How To Add Buttons In Textbox? Pin
BillWoodruff20-Aug-13 18:13
professionalBillWoodruff20-Aug-13 18:13 

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.