Jump to content

Eventadd() Udf (need Help & Info)


Recommended Posts

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...
DllClose($oAdvApi32)
Return $iRet
EndFunc

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

Edited by Pa Callender
[size="4"]YOU SHALL NOT PARSE!![/size]
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...