This topic is READ ONLY
import-bot (20211) [Avatar] Offline
#1
[Originally posted by rkates]

While working through Chapter 5, I decided to add code to the connectionbegin
and connectionend events that would refresh the log dw on w_listen.

I added the following code to the end of both events:

w_listen.dw_log.event trigger ue_refresh()

When I test the code I get the following error messages:

1) I get a PB Runtime error (R0002) message box with the message "Null object
reference at line 11 in function +connectionbegin of object
application_server".

Line 11 is the line of code that I added to perform the refresh.

2) After clicking OK on the msgbox I get the error msg, "Error: Runtime error
calling ConnectionBegin for method 'df_get_client_list' in object 'uo_demodb'"
in my browser.

I have the exact same code in the application idle event and it works.

Why will this code not work in the Connectionbegin / Connectionend events?

I am using PB 6.5 with WebSite and IE4.

Thanks for the help,

Patrick
import-bot (20211) [Avatar] Offline
#2
Re: application connectionbegin / connectionend events
[Originally posted by ezad1]

w_listen is a window of the application server. Connectionbegin/end events do
not fire in the application server, they fire in the process that the app
server spawns to service the ConnectToServer request when Web.PB connects to
your app server. This process doesn't create a w_listen window because it
doesn't fire the open event. Since w_listen.dw_log is an object running in
another process, the only way you could do this is to use the window API's to
send it a message. But first you'd have to get a handle to the app server
(GetModule() is it?) then try to get a handle to w_listen.dw_log and then use
SendMessage to fire the event.

Anyway, it'd be much easier to set a window timer to call
w_listen.dw_log.event trigger ue_refresh() every so often. the code for the
event checks a "dirtybit" of the log shared object so this shouldn't incur
much overhead.