|
Mastering PowerBuilder Saving and Loading Server OptionsNow, let us write script to display server options—transport object properties—to the user using dw_options DataWindow. Let us write the script for this purpose in a function. Declare of_GetServerOptions() function at the w_pms_server window.
// Function: of_GetServerOptions()
// Access: Private
// Return Value: Integer
// Arguments: None
String ls_temp
RegistryGet(IS_REGKEY,"Driver", ls_temp)
dw_options.object.driver[1] = ls_temp
RegistryGet(IS_REGKEY,"Application", ls_temp)
dw_options.object.application[1] = ls_temp
RegistryGet(IS_REGKEY,"Location", ls_temp)
dw_options.object.location[1] = ls_temp
RegistryGet(IS_REGKEY_OPTIONS,"BufSize", ls_temp)
dw_options.object.opt_bufsize[1] = Integer(ls_temp)
RegistryGet(IS_REGKEY_OPTIONS,"MaxListeningThreads", ls_temp)
dw_options.object.opt_MaxListeningThreads[1] = Integer(ls_temp)
RegistryGet(IS_REGKEY_OPTIONS,"NoDelay", ls_temp)
dw_options.object.opt_nodelay[1] = Integer(ls_temp)
RegistryGet(IS_REGKEY_OPTIONS,"RawData", ls_temp)
dw_options.object.opt_rawdata[1] = Integer(ls_temp)
RegistryGet(IS_REGKEY_OPTIONS,"ThreadPooling", ls_temp)
dw_options.object.opt_ThreadPooling[1] = Integer(ls_temp)
RegistryGet(IS_REGKEY_TRACE,"Console", ls_temp)
dw_options.object.trace_console[1] = Integer( ls_temp )
RegistryGet(IS_REGKEY_TRACE,"ObjectCalls", ls_temp)
dw_options.object.trace_objectcalls[1] = Integer(ls_temp)
RegistryGet(IS_REGKEY_TRACE,"ObjectLife", ls_temp)
dw_options.object.trace_objectlife[1] = Integer(ls_temp)
RegistryGet(IS_REGKEY_TRACE,"DumpArgs", ls_temp)
dw_options.object.trace_dumpargs[1] = Integer(ls_temp)
RegistryGet(IS_REGKEY_TRACE,"All", ls_temp)
dw_options.object.trace_all[1] = Integer(ls_temp)
RegistryGet(IS_REGKEY_TRACE,"Level", ls_temp)
dw_options.object.trace_level[1] = Integer(ls_temp)
RegistryGet(IS_REGKEY_TRACE,"Log", ls_temp)
dw_options.object.trace_log[1] = ls_temp
Return 0 |
All we are doing here is reading registry entries and populating the DataWindow after converting into appropriate datatype. The following function of_SaveServerOptions() saves transport object values into the registry. This is also a window level function.
// Function: of_SaveServerOptions()
// Access: Private
// Return Value: Integer
// Arguments: None.
dw_options.AcceptText()
RegistrySet(IS_REGKEY, "Driver", &
dw_options.object.driver[1] )
RegistrySet(IS_REGKEY, "Application",&
dw_options.object.application[1] )
RegistrySet(IS_REGKEY, "Location", &
dw_options.object.location[1] )
RegistrySet(IS_REGKEY_OPTIONS, "BufSize",&
String(dw_options.object.opt_bufsize[1]) )
RegistrySet(IS_REGKEY_OPTIONS, "MaxListeningThreads",&
String(dw_options.object.opt_maxListeningThreads[1]) )
RegistrySet(IS_REGKEY_OPTIONS, "NoDelay",&
String(dw_options.object.opt_NoDelay[1]) )
RegistrySet(IS_REGKEY_OPTIONS,"RawData",&
String(dw_options.object.opt_RawData[1]) )
RegistrySet(IS_REGKEY_OPTIONS,"ThreadPooling",&
String(dw_options.object.opt_ThreadPooling[1]) )
RegistrySet(IS_REGKEY_TRACE,"ObjectCalls",&
String(dw_options.object.trace_objectcalls[1] ))
RegistrySet(IS_REGKEY_TRACE,"ObjectLife",&
String(dw_options.object.trace_objectlife[1] ))
RegistrySet(IS_REGKEY_TRACE,"DumpArgs",&
String(dw_options.object.trace_dumpargs[1] ))
RegistrySet(IS_REGKEY_TRACE,"Level",&
String(dw_options.object.trace_level[1] ))
RegistrySet(IS_REGKEY_TRACE,"All",&
String(dw_options.object.trace_all[1] ))
RegistrySet(IS_REGKEY_TRACE,"Console",&
String(dw_options.object.trace_console[1] ))
RegistrySet(IS_REGKEY_TRACE,"Log",&
String(dw_options.object.trace_log[1] ))
Return 0 |
Populate the transport object with server startup values. The following script reads values from the registry (PowerBuilder distributed server can work only on 32-bit platform anyway) and populates the transport object.
|