related to thread448-768095
I've included a simplistic client and a master which the client reads from the master's S0 successfully using dderequest.
If I change the S0 to D0 and create a global in the main, dderequest fails. Ideally, I'm looking to have 24 clients but right now, am limited to 10 (s0-s9)
PS I created 4 different clients and had them all access the master without a problem, so it looks like the tech bulletin that 2 clients are the DDE limit is incorrect
;---------------------------------------------------------
;- start of client.was
;---------------------------------------------------------
#define WINDOW_HANDLE_FILE "C:\WH.TXT"
long g_DDEInstance = 0
integer g_nMainPWWin = 0
;---------------------------------------------------------
proc main
string s_DDEInstance = ""
string sQueriedString = ""
set modem connection "direct connect-None" ;; point to a non real modem to eliminate
g_nMainPWWin = GetMainHwnd( WINDOW_HANDLE_FILE )
while 1
if ddeinit g_DDEInstance "PW5" "System" g_nMainPWWin
if dderequest g_DDEInstance "s0" sQueriedString
println( "Queried -> " )
println( sQueriedString )
else
println( " FAILED-> dderequest g_DDEInstance s0 sQueriedString " )
endif
else
println( " FAILED-> ddeinit g_DDEInstance PW5 System g_nMainPWWin" )
endif
pause 5
endwhile
endproc
;---------------------------------------------------------
func GetMainHwnd : integer
param string sWindowHandleFile
string LineBuffer = ""
integer nMainPWWin = 0
long DDEInstance = 0
if fopen 11 sWindowHandleFile READ TEXT
fgets 11 LineBuffer
atoi LineBuffer nMainPWWin
fclose 11
else
println( "In GetMainHWND() fopen failed-- severe error" )
endif
return nMainPWWin
endfunc
;---------------------------------------------------------
proc println
param string sInputString
string sToPrint
sToPrint = sInputString
strcat sToPrint "`r`n"
termmsg sToPrint
endproc
;---------------------------------------------------------
;- end of client.was
;---------------------------------------------------------
;---------------------------------------------------------
;- start of master.was
;---------------------------------------------------------
#define WINDOW_HANDLE_FILE "C:\WH.TXT"
; GLOBAL
;;string d0 = "initial value"
;---------------------------------------------------------
proc main
set modem connection "direct connect-None"
WriteHwndToFile()
while 1
s0 = TimeProc()
println( s0 )
pause 3
yield
endwhile
endproc
;---------------------------------------------------------
proc WriteHwndToFile ; for the client to read
string LineBuffer = ""
integer MainPWWin = $PWMAINWIN
if fopen 10 WINDOW_HANDLE_FILE CREATE TEXT
strfmt LineBuffer "%d" MainPWWin
fputs 10 LineBuffer
fclose 10
endif
endproc
;---------------------------------------------------------
func TimeProc : string
integer Month = 0
integer Day = 0
integer Year = 0
integer Hour = 0
integer Min = 0
integer Sec = 0
string sTemp = ""
ltimeints $LTIME Year Month Day Hour Min Sec
numtostr Year sTemp
strfmt sTemp "%d-%d-%d--%d.%d.%d" Month Day Year Hour Min Sec
return sTemp
endfunc
;---------------------------------------------------------
proc println
param string sInputString
string sToPrint
sToPrint = sInputString
strcat sToPrint "`r`n"
termmsg sToPrint
endproc
;---------------------------------------------------------
;- end of master.was
;---------------------------------------------------------
I've included a simplistic client and a master which the client reads from the master's S0 successfully using dderequest.
If I change the S0 to D0 and create a global in the main, dderequest fails. Ideally, I'm looking to have 24 clients but right now, am limited to 10 (s0-s9)
PS I created 4 different clients and had them all access the master without a problem, so it looks like the tech bulletin that 2 clients are the DDE limit is incorrect
;---------------------------------------------------------
;- start of client.was
;---------------------------------------------------------
#define WINDOW_HANDLE_FILE "C:\WH.TXT"
long g_DDEInstance = 0
integer g_nMainPWWin = 0
;---------------------------------------------------------
proc main
string s_DDEInstance = ""
string sQueriedString = ""
set modem connection "direct connect-None" ;; point to a non real modem to eliminate
g_nMainPWWin = GetMainHwnd( WINDOW_HANDLE_FILE )
while 1
if ddeinit g_DDEInstance "PW5" "System" g_nMainPWWin
if dderequest g_DDEInstance "s0" sQueriedString
println( "Queried -> " )
println( sQueriedString )
else
println( " FAILED-> dderequest g_DDEInstance s0 sQueriedString " )
endif
else
println( " FAILED-> ddeinit g_DDEInstance PW5 System g_nMainPWWin" )
endif
pause 5
endwhile
endproc
;---------------------------------------------------------
func GetMainHwnd : integer
param string sWindowHandleFile
string LineBuffer = ""
integer nMainPWWin = 0
long DDEInstance = 0
if fopen 11 sWindowHandleFile READ TEXT
fgets 11 LineBuffer
atoi LineBuffer nMainPWWin
fclose 11
else
println( "In GetMainHWND() fopen failed-- severe error" )
endif
return nMainPWWin
endfunc
;---------------------------------------------------------
proc println
param string sInputString
string sToPrint
sToPrint = sInputString
strcat sToPrint "`r`n"
termmsg sToPrint
endproc
;---------------------------------------------------------
;- end of client.was
;---------------------------------------------------------
;---------------------------------------------------------
;- start of master.was
;---------------------------------------------------------
#define WINDOW_HANDLE_FILE "C:\WH.TXT"
; GLOBAL
;;string d0 = "initial value"
;---------------------------------------------------------
proc main
set modem connection "direct connect-None"
WriteHwndToFile()
while 1
s0 = TimeProc()
println( s0 )
pause 3
yield
endwhile
endproc
;---------------------------------------------------------
proc WriteHwndToFile ; for the client to read
string LineBuffer = ""
integer MainPWWin = $PWMAINWIN
if fopen 10 WINDOW_HANDLE_FILE CREATE TEXT
strfmt LineBuffer "%d" MainPWWin
fputs 10 LineBuffer
fclose 10
endif
endproc
;---------------------------------------------------------
func TimeProc : string
integer Month = 0
integer Day = 0
integer Year = 0
integer Hour = 0
integer Min = 0
integer Sec = 0
string sTemp = ""
ltimeints $LTIME Year Month Day Hour Min Sec
numtostr Year sTemp
strfmt sTemp "%d-%d-%d--%d.%d.%d" Month Day Year Hour Min Sec
return sTemp
endfunc
;---------------------------------------------------------
proc println
param string sInputString
string sToPrint
sToPrint = sInputString
strcat sToPrint "`r`n"
termmsg sToPrint
endproc
;---------------------------------------------------------
;- end of master.was
;---------------------------------------------------------