为EventViewer创建dll [英] Create dll for EventViewer

查看:80
本文介绍了为EventViewer创建dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我执行时:EventLog.WriteEntry(strSource,strEntry,

EventLogEntryType.Error,intEventID)


事件查看器报告


源(Siclops_WS_Mobile)中事件ID(234)的描述不能找到
。本地计算机可能没有必要的注册表信息

或消息DLL文件来显示来自远程计算机的消息。


我想我需要创建一个dll返回事件IDa的错误消息。

这个dll可以用VB.NET编写吗?

任何指向文档的指针都告诉我如何创建这个dll?


或者我错过了什么并且完全错了?


提前致谢。

克里斯。

When I perform: EventLog.WriteEntry(strSource, strEntry,
EventLogEntryType.Error, intEventID)

The event viewer reports

The description for Event ID ( 234 ) in Source ( Siclops_WS_Mobile ) cannot
be found. The local computer may not have the necessary registry information
or message DLL files to display messages from a remote computer.

I think I need to create a dll that returns error messages for event IDa??s.
Can this dll be written in VB.NET?
Any pointers to documentation that tells me how to go about creating this dll?

Or am I missing something and have got it totally wrong?

Thanks in advance.
Chris.

推荐答案

你需要查看源是否存在并创建它,如果它不...那么

写给它:


public shared sub LogEvent(byval Source as string,byval Message as string,

byval类型为eventlogentrytype)

dim eventLog as new system.diagnostics.eventlog

try

if if eventLog.SourceExists(Source)then

eventLog.CreateEventSource (来源,这里的日志名称)

eventLog.Log =" Log Name Here"

eventLog.WriteEntry(Source,Message,Type)

catch ex as Exception

抛出新的ApplicationException(ex.message,ex.innerexception)

结束尝试

end sub


hth ,


史蒂夫

" Chris Podmore" <章********** @ discussions.microsoft.com>在留言中写道

新闻:CD ********************************** @ microsof t.com ...

|当我执行:EventLog.WriteEntry(strSource,strEntry,

| EventLogEntryType.Error,intEventID)

|

|事件查看器报告

|

| Source(Siclops_WS_Mobile)中事件ID(234)的描述

不能

|被发现。本地计算机可能没有必要的注册表

信息

|或消息DLL文件,以显示来自远程计算机的消息。

|

|我想我需要创建一个dll来返回事件ID的错误消息。

|这个dll可以用VB.NET编写吗?

|任何指向文档的指针都告诉我如何创建这个

dll?

|

|或者我错过了什么并且完全错了?

|

|在此先感谢。

|克里斯。
you need to see if the source exists and create it if it doesn''t...then
write to it:

public shared sub LogEvent(byval Source as string, byval Message as string,
byval Type as eventlogentrytype)
dim eventLog as new system.diagnostics.eventlog
try
if not eventLog.SourceExists(Source) then
eventLog.CreateEventSource(Source, "Log Name Here")
eventLog.Log = "Log Name Here"
eventLog.WriteEntry(Source, Message, Type)
catch ex as Exception
throw new ApplicationException(ex.message, ex.innerexception)
end try
end sub

hth,

steve
"Chris Podmore" <Ch**********@discussions.microsoft.com> wrote in message
news:CD**********************************@microsof t.com...
| When I perform: EventLog.WriteEntry(strSource, strEntry,
| EventLogEntryType.Error, intEventID)
|
| The event viewer reports
|
| The description for Event ID ( 234 ) in Source ( Siclops_WS_Mobile )
cannot
| be found. The local computer may not have the necessary registry
information
| or message DLL files to display messages from a remote computer.
|
| I think I need to create a dll that returns error messages for event ID''s.
| Can this dll be written in VB.NET?
| Any pointers to documentation that tells me how to go about creating this
dll?
|
| Or am I missing something and have got it totally wrong?
|
| Thanks in advance.
| Chris.


你需要查看源是否存在并创建它,如果它不...那么

写入它:


public shared sub LogEvent(byval Source as string,byval Message as string,

byval类型为eventlogentrytype)

dim eventLog作为新的system.diagnostics.eventlog

尝试

如果不是eventLog.SourceExists(Source)那么

eventLog.CreateEventSource(Source," Log姓名在这里)

eventLog.Log =" Log Name Here"

eventLog.WriteEntry(来源,消息,类型)

catch ex作为例外

抛出新的ApplicationException(ex.message,ex.innerexception)

结束尝试

end sub


hth,


史蒂夫

" Chris Podmore" <章********** @ discussions.microsoft.com>在留言中写道

新闻:CD ********************************** @ microsof t.com ...

|当我执行:EventLog.WriteEntry(strSource,strEntry,

| EventLogEntryType.Error,intEventID)

|

|事件查看器报告

|

| Source(Siclops_WS_Mobile)中事件ID(234)的描述

不能

|被发现。本地计算机可能没有必要的注册表

信息

|或消息DLL文件,以显示来自远程计算机的消息。

|

|我想我需要创建一个dll来返回事件ID的错误消息。

|这个dll可以用VB.NET编写吗?

|任何指向文档的指针都告诉我如何创建这个

dll?

|

|或者我错过了什么并且完全错了?

|

|在此先感谢。

| Chris。
you need to see if the source exists and create it if it doesn''t...then
write to it:

public shared sub LogEvent(byval Source as string, byval Message as string,
byval Type as eventlogentrytype)
dim eventLog as new system.diagnostics.eventlog
try
if not eventLog.SourceExists(Source) then
eventLog.CreateEventSource(Source, "Log Name Here")
eventLog.Log = "Log Name Here"
eventLog.WriteEntry(Source, Message, Type)
catch ex as Exception
throw new ApplicationException(ex.message, ex.innerexception)
end try
end sub

hth,

steve
"Chris Podmore" <Ch**********@discussions.microsoft.com> wrote in message
news:CD**********************************@microsof t.com...
| When I perform: EventLog.WriteEntry(strSource, strEntry,
| EventLogEntryType.Error, intEventID)
|
| The event viewer reports
|
| The description for Event ID ( 234 ) in Source ( Siclops_WS_Mobile )
cannot
| be found. The local computer may not have the necessary registry
information
| or message DLL files to display messages from a remote computer.
|
| I think I need to create a dll that returns error messages for event ID''s.
| Can this dll be written in VB.NET?
| Any pointers to documentation that tells me how to go about creating this
dll?
|
| Or am I missing something and have got it totally wrong?
|
| Thanks in advance.
| Chris.


我知道检查源是否存在。确实如此,这就是我实际上如何获得事件日志中的内容。我想要做的是停止源(Siclops_WS_Mobile)中的事件ID(234)的

描述不能找到b $ b b。我在事件查看器中输入的消息。


" steve"写道:
I know about checking if the source exists. It does and that''s how I actually
manage to get enties in the event log. What I want to do is stop the "The
description for Event ID ( 234 ) in Source ( Siclops_WS_Mobile ) cannot be
found" message for my entries in the event viewer.

"steve" wrote:
你需要查看源是否存在并创建它,如果它没有...然后
写入:
public shared sub LogEvent(byval Source as string,byval Message as string,
byval type as eventlogentrytype)
dim eventLog as new system.diagnostics.eventlog
如果不是eventLog,请尝试
.SourceExists(Source)然后
eventLog.CreateEventSource(Source," Log Name Here")
eventLog.Log =" Log Name Here"
eventLog.WriteEntry(Source,Message,Type )
赶上ex Exception
抛出新的ApplicationException(ex.message,ex.innerexception)
结束尝试
结束子

hth,
史蒂夫

" Chris Podmore" <章********** @ discussions.microsoft.com>在消息中写道
新闻:CD ********************************** @ microsof t.com。 ..
|当我执行:EventLog.WriteEntry(strSource,strEntry,
| EventLogEntryType.Error,intEventID)
|
|事件查看器报告
|
| Source(Siclops_WS_Mobile)中事件ID(234)的描述不能
|被发现。本地计算机可能没有必要的注册表信息
|或消息DLL文件,以显示来自远程计算机的消息。
|
|我想我需要创建一个dll来返回事件ID的错误消息。
|这个dll可以用VB.NET编写吗?
|任何指向文档的指针都告诉我如何创建这个
dll?
|
|或者我错过了什么并且完全错了?
|
|在此先感谢。
|克里斯。
you need to see if the source exists and create it if it doesn''t...then
write to it:

public shared sub LogEvent(byval Source as string, byval Message as string,
byval Type as eventlogentrytype)
dim eventLog as new system.diagnostics.eventlog
try
if not eventLog.SourceExists(Source) then
eventLog.CreateEventSource(Source, "Log Name Here")
eventLog.Log = "Log Name Here"
eventLog.WriteEntry(Source, Message, Type)
catch ex as Exception
throw new ApplicationException(ex.message, ex.innerexception)
end try
end sub

hth,

steve
"Chris Podmore" <Ch**********@discussions.microsoft.com> wrote in message
news:CD**********************************@microsof t.com...
| When I perform: EventLog.WriteEntry(strSource, strEntry,
| EventLogEntryType.Error, intEventID)
|
| The event viewer reports
|
| The description for Event ID ( 234 ) in Source ( Siclops_WS_Mobile )
cannot
| be found. The local computer may not have the necessary registry
information
| or message DLL files to display messages from a remote computer.
|
| I think I need to create a dll that returns error messages for event ID''s.
| Can this dll be written in VB.NET?
| Any pointers to documentation that tells me how to go about creating this
dll?
|
| Or am I missing something and have got it totally wrong?
|
| Thanks in advance.
| Chris.



这篇关于为EventViewer创建dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆