|
You can add a log event source by using the static method EventLog.CreateEventSource (calling WriteEntry the first time will do this automatically, too). Then instantiate a new instance of the EventLog class, specifying the same source name in the constructor.
In order for event IDs to be resolved, you have to use the registry to add a key (see http://msdn.microsoft.com/library/en-us/debug/base/adding_a_source_to_the_registry.asp[^] for more details) that points to a native Win32 dll. The IDs match up with String resource IDs for the invariant or current language that the OS is using.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Does anyone know how to change the permissions or add a user to a particular registry key programmatically? I know you can do this manually with regedit so it follows that you should be able to do it programmatically. I just haven't seen any clear docs on how this might be accomplished with C#. I've looked at using the Registry functions in the framework, however, nothing stands out as a way to accomplish this. Any suggestions?
Thanks.
-Matt
p.s. I am trying to do this from an installer/deployment app.
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
perlmunger wrote:
I've looked at using the Registry functions in the framework, however, nothing stands out as a way to accomplish this. Any suggestions?
I suggest you read it again! Its all rather clear...
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
Jerk!
Seriously though, all I see is information on reading the permissions, not changing them. Do you have particular links you can point me to?
-Matt
p.s. I'm surprised at you leppie. You've not been a smart ass when answering my questions before.
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Regards,
Hello every buddy, wishing all are coding greate(!) I have the following question:
Suppose following runtime invokation:
myInstance.getType().InvokeMember(aMember, BindingFlags.Public|BindingFlags.Instance|BindingFlags.GetField|BindingFlags.GetProperty, null, new object[] {});
If I execute this line while aMember is an inherited member property name of myInstance (not it's own) it works and returns the value.
Now if I call the same member and try to set the same member(inherited member property) it will throw an exception that 'Member not found'.
myInstance.getType().InvokeMember(aMember, BindingFlags.Public|BindingFlags.Instance|BindingFlags.SetField|BindingFlags.SetProperty, null, new object[] {newValueArray});
How can I fix this and set inherited properties of myInstance using Reflections?
Thank you
---
"Art happens when you least expect it"
|
|
|
|
|
BindingFlags.SetField|BindingFlags.SetProperty
Get rid of that!
and this:
BindingFlags.GetField|BindingFlags.GetProperty
its not needed!
But better, use the GetProperty() method rather. Also ALWAYS check the return member info 1st, more than off its null , and then bang BIG BADA BOOM!
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
Thanks but:
If I get rid of 'BindingFlags.SetField|BindingFlags.SetProperty' then how can I set a property or field runtime using Reflection????
---
"Art happens when you least expect it"
|
|
|
|
|
Ok, thread is over!
About my last question I got it now, using PropertyInfo.SetValue()... Thanks but:
I made a mistake posting this thread start. Type.InvokeMember(... BindingFlags.SetField|BindingFlags.SetProperty...) DOES return and set inherited types, the mistake was that I was tryong to set aMember into other type value than it's own, so Such 'aMember' with that target type could not be found and null would be returned.
Thank you and sorry for the mistake,
-nSun
---
"Art happens when you least expect it"
|
|
|
|
|
Any one have got sample of the book Developing Microsoft .Net Applications Window!
Please send me it!
Sillyboy0009@yahoo.com
Thanks!
xyz
|
|
|
|
|
Go to the publishers site, its more than likely there!
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
So: I have created ActiveX control inherits from the Control Class, as it written in Morgan Skinner's article. It was successfully registered in system, but when I have tried to add it in C# winform application, the mistake message was given:
"Converting the type library to a .Net assembly failed. Object reference not
set"
or if i try add .tlb file the mistake message was:
"Converting the type library to a .Net assembly failed. Type library was exported from a CLR assembly and can not re-imported as a CLR assembly"
What can i do? Что делать?
|
|
|
|
|
This post is rather puzzling. In the same sentence, ActiveX refers to something from the unmanaged world, and the Control class refers to something from the managed world.
Did you create an ActiveX control using an unmanaged compiler like VB6 or VC++6 ? If yes, then you can import it into the managed world by opening the toolbox window, right-click on it, select "Customize toolbox" (VS.NET 2002) or "Add or Remove Item" (VS.NET 2003), then click in the components tab, browse so you find the ActiveX dll, and finally drop it onto the form.
There are several cases however where the ActiveX import will fail. Most of the time, it just works.
RSS feed
|
|
|
|
|
I have created this control in С# in VS.Net 2002 => using a managed compiler
|
|
|
|
|
1) The C# compiler does not create ActiveX controls.
2) If you are in an unmanaged environment, it is possible to use a .NET user control like it was an ActiveX control, thanks to an undocumented technique, but I am not sure that's what you are talking about.
3) If you created that non-ActiveX user control with the C# compiler, then why don't you just include the .cs file in your other project? What is the tlb import for?
RSS feed
|
|
|
|
|
1. Thanks for lesson.
2. This control will be used with Delphi or CBuilder, that is why i need to do non-ActiveX control.
3.Do you know how can i do that.(use with Delphi)
4.(thanks to an undocumented technique) - what technique?
Thanks.
|
|
|
|
|
3) I would look around Delphi.NET and #Builder
4) Here[^] it is.
RSS feed
|
|
|
|
|
I've got a datagrid, and all I want to do is select an item, push a button, and have a new windows form show up w/ information based on that item. I'm completely lost on sending the data to the new form, someone *please* help!
<---signature--->
Your kid gets into Duke.
You pay the tuition.
That tuition goes into my checking account.
My money in my checking account goes into beer, porn, and other such fun. Thank you
|
|
|
|
|
|
Don't need anything in ASP, need the C# stuff to open windows forms.
<---signature--->
Your kid gets into Duke.
You pay the tuition.
That tuition goes into my checking account.
My money in my checking account goes into beer, porn, and other such fun. Thank you
|
|
|
|
|
|
How can we connect to com port with c# (without using Assembly )?
|
|
|
|
|
You can't.
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
IF u dont mind downloading the VBResourceKit, u can find one in there
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
hi anyone knows if there're classes or libraries about that protocol?
thanks in advance
Paolo Ponzano
|
|
|
|
|
How can I maintain selected items in a bound list box control when it is bound to a datasource. What I currently do is add the item to a the underlying datasource which then automatically adds it to the listbox. I then use the setselected method of the list box to select the newly added item. This works great, but it unselects all my previous items that were selected. How do i get around this?
Thanks,
Ryan
|
|
|
|