Jump to content
Sign in to follow this  
Pa Callender

Eventadd() Udf (need Help & Info)

Recommended Posts

Pa Callender

I intend to write a UDF that does not do anything dangerous/worrying (like using KERNEL32 to Allocate Memory - that's not my territory, I just script... and script... and eat... etc.). From other threads in this subforum, I have gathered that you need something like this...

$iRet = EventAdd("Information","Request Help",$sUserName&" on "&$sComputerName&" at "&$sLocation&" has requested help for the following reason: "&$sReason,"Application")

Func EventAdd($sType,$sPurpose,$sDetails,$sAs)
Dim $iRet, $oAdvApi32, $hAs
$oAdvApi32 = DllOpen("AdvApi32.dll")
;; Etc... Dllcall to set $hAs to the handle to the event log
;; PS. I have seen "int" as the return type in other examples,
;; and also require info on ????? sections. Please correct if wrong...
$iRet = DllCall($oAdvApi32,"int","ReportEvent","long",$hAs,"int",Eval($sType),"int",0,"long",1001,"long",0,"int",1,"long",StringLen($sDetails),"long",?????,"long",?????)
;; Etc... DllCall to destroy $hAs...
Return $iRet

Edit: Changed [ code name="EventAdd() UDF" ] to [ code ]

Edited by Pa Callender

[size="4"]YOU SHALL NOT PARSE!![/size]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this