Click here to Skip to main content
15,908,111 members
Home / Discussions / C#
   

C#

 
GeneralRe: Signed XML Pin
Alex Korchemniy8-Nov-04 8:43
Alex Korchemniy8-Nov-04 8:43 
QuestionHow to reduce the width of the KATAKANA charactor (in Japanese) Pin
sachinkalse4-Nov-04 22:08
sachinkalse4-Nov-04 22:08 
AnswerRe: How to reduce the width of the KATAKANA charactor (in Japanese) Pin
Dave Kreskowiak5-Nov-04 0:28
mveDave Kreskowiak5-Nov-04 0:28 
GeneralCalling the same form.. Pin
xiaowenjie4-Nov-04 19:50
xiaowenjie4-Nov-04 19:50 
GeneralRe: Calling the same form.. Pin
Jay Shankar4-Nov-04 21:17
Jay Shankar4-Nov-04 21:17 
GeneralRe: Calling the same form.. Pin
Stefan Troschuetz4-Nov-04 21:24
Stefan Troschuetz4-Nov-04 21:24 
GeneralRe: Calling the same form.. Pin
sreejith ss nair4-Nov-04 21:36
sreejith ss nair4-Nov-04 21:36 
GeneralC# Code works under win2000 but not XP Pin
Loug524-Nov-04 16:41
Loug524-Nov-04 16:41 
Hi, all.
I am working on a C# code that can retrieve system log by using WMI.
However, the code is working fine under windows 2000, but got error messages
under Windows XP.
The erro message is :

Unhandled Exception: System.Management.ManagementException:Access denied.
at System.Management.Management.Exception.ThrowWithExtendedInfo(ManagementStatus errorCode)
at System.Management.ManagementEventWatcher.Start()

Part of my code is like following and I believe this is where the problem at:

----------------------------------------------------------------
public static ManagementEventWatcher getWatcher(string comp, string LogName)
{
ConnectionOptions co;
ManagementPath mp;
ManagementScope ms;
WqlEventQuery EventQuery;
ManagementEventWatcher watcher;
string wql;
string wqlAnd;

co = new ConnectionOptions();
co.Timeout = new TimeSpan(0, 0, 60);
co.EnablePrivileges = true;

mp = new ManagementPath();
mp.NamespacePath = @"\root\cimv2";
mp.Server = comp; // comp is the computer you are connecting to
ms = new ManagementScope(mp, co);
Console.WriteLine("host is" + comp +"Logname is "+LogName);

switch(LogName.ToUpper())
{
case "ALL":
wqlAnd = "";
break;
case "SECURITY":
wqlAnd = " AND TargetInstance.Logfile ='Security'";
break;
case "SYSTEM":
wqlAnd = " AND TargetInstance.Logfile ='System'";
break;
case "APPLICATION":
wqlAnd = " AND TargetInstance.Logfile ='Application'";
break;
default:
wqlAnd = "";
break;
}

wql = "select * from __instancecreationevent where targetinstance isa 'Win32_NTLogEvent'" + wqlAnd;

EventQuery = new WqlEventQuery(wql);

watcher = new ManagementEventWatcher(ms, EventQuery);
Console.WriteLine("end of first watcher");

return watcher;
}
---------------------------------------------------------
Could any of you tell me how to solve this problem?
Thanks a lot.
GeneralRe: C# Code works under win2000 but not XP Pin
sreejith ss nair4-Nov-04 17:06
sreejith ss nair4-Nov-04 17:06 
GeneralRe: C# Code works under win2000 but not XP Pin
Loug524-Nov-04 17:16
Loug524-Nov-04 17:16 
GeneralRe: C# Code works under win2000 but not XP Pin
Charlie Williams4-Nov-04 18:16
Charlie Williams4-Nov-04 18:16 
GeneralRe: C# Code works under win2000 but not XP Pin
cdmlb@hotmail.com4-Nov-04 18:21
cdmlb@hotmail.com4-Nov-04 18:21 
GeneralRe: C# Code works under win2000 but not XP Pin
Dave Kreskowiak5-Nov-04 3:13
mveDave Kreskowiak5-Nov-04 3:13 
GeneralQuestion about C# handle Windows Messages Pin
momer4-Nov-04 16:07
momer4-Nov-04 16:07 
GeneralRe: Question about C# handle Windows Messages Pin
Alex Korchemniy5-Nov-04 14:02
Alex Korchemniy5-Nov-04 14:02 
GeneralAbout IE context Pin
Jason Xie4-Nov-04 14:53
Jason Xie4-Nov-04 14:53 
GeneralRe: About IE context Pin
Nick Parker4-Nov-04 15:06
protectorNick Parker4-Nov-04 15:06 
GeneralRe: About IE context Pin
Jason Xie4-Nov-04 15:23
Jason Xie4-Nov-04 15:23 
GeneralRe: About IE context Pin
Nick Parker4-Nov-04 16:25
protectorNick Parker4-Nov-04 16:25 
GeneralRe: About IE context Pin
Jason Xie4-Nov-04 16:32
Jason Xie4-Nov-04 16:32 
GeneralRe: About IE context Pin
Nick Parker4-Nov-04 16:54
protectorNick Parker4-Nov-04 16:54 
GeneralRe: About IE context Pin
Jason Xie4-Nov-04 17:01
Jason Xie4-Nov-04 17:01 
GeneralRe: About IE context Pin
IronSnake5-Nov-04 9:36
IronSnake5-Nov-04 9:36 
GeneralRe: About IE context Pin
Jason Xie5-Nov-04 13:42
Jason Xie5-Nov-04 13:42 
Generalstring methods Pin
John L. DeVito4-Nov-04 14:02
professionalJohn L. DeVito4-Nov-04 14:02 

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.