- Larry Peters
- PowerBuilder
- Monday, 13 May 2024 10:45 AM UTC
A year ago I raised this issue but never did get any resolution. I'd like to test the community's patience by revisiting it.
Simply put, ReportEvent crashes when built in 64bit but works fine when built in 32bit. My sample code demonstrates this.
Any feedback is welcome as I can find nothing to help me past this impasse.
forward
global type w_eventlog from window
end type
type cb_1 from commandbutton within w_eventlog
end type
end forward
global type w_eventlog from window
integer width = 658
integer height = 348
boolean titlebar = true
string title = "Test Event Log"
boolean controlmenu = true
boolean minbox = true
boolean maxbox = true
boolean resizable = true
long backcolor = 67108864
string icon = "AppIcon!"
boolean center = true
cb_1 cb_1
end type
global w_eventlog w_eventlog
type prototypes
FUNCTION longptr RegisterEventSource (longptr lpUNCServerName, string lpSourceName) Library "advapi32.dll" Alias For "RegisterEventSourceW"
FUNCTION boolean ReportEvent (longptr hEventLog, uint wType, uint wCategory, ulong dwEventID, ulong lpUserSid, uint wNumStrings, ulong dwDataSize, string lpStrings[], ulong lpRawData) Library "advapi32.dll" Alias For "ReportEventW"
FUNCTION boolean DeregisterEventSource (ref longptr hEventLog) Library "advapi32.dll"
end prototypes
on w_eventlog.create
this.cb_1=create cb_1
this.Control[]={this.cb_1}
end on
on w_eventlog.destroy
destroy(this.cb_1)
end on
type cb_1 from commandbutton within w_eventlog
integer x = 96
integer y = 60
integer width = 402
integer height = 112
integer taborder = 10
integer textsize = -10
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
string text = "Log Event"
end type
event clicked;integer li_type, li_category, li_NumStrings
string ls_event = "Test Log"
string ls_array[]
ulong lul_binsz, lul_bindata, lul_identifier, lul_SecId
longptr lptr_handle
li_NumStrings = 1
ls_array[1] = "Event Log Entry for : " + ls_event
lptr_handle = RegisterEventSource(0, ls_event)
IF IsNull(lptr_handle) THEN lptr_handle = -1
IF lptr_handle > 0 THEN
ReportEvent(lptr_handle, li_type, li_category, lul_identifier, &
lul_SecId, li_NumStrings, lul_binsz, ls_array, lul_bindata)
DeregisterEventSource(lptr_handle)
END IF
end event
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.