Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dderequest and non S0-S9 vars.. Anyone get it to work?

Status
Not open for further replies.

EDHills

Programmer
Jan 24, 2007
35
US
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
;---------------------------------------------------------

 
Although the help file is not clear on it, my hunch is that Procomm is only able to return the value of predefined global variables (i0-i9, f0-f9, s0-s9, l0-l9) in response to a DDE request.

I also presume that this line in the child script:

if dderequest g_DDEInstance "s0" sQueriedString

had the s0 replaced by d0 when doing the testing (I see the d0 declaration commented out in the main script)?

 
>>(I see the d0 declaration commented out in the main script)?

The scripts included, compile and run using s0, and I had commented out the d0 declaration, in case anyone felt like playing with it. The d0 declaration was, in my understanding, the only line needed to be able to use/test the d0 case vs s0 for testing. I figure if I'm going to ask a question, make it as aasy as possible for someone to review and debug if they chose to do so. Thanks for your opinion though.
 
Sorry I wasn't clear, what I meant was did you try client.was with the line I pointed out changed to d0 instead of s0 as it is now? If you made the s0 -> d0 change in your main script, you would also need to make the change in client.was so that it would request the proper variable (d0 as opposed to s0).

 
I see what you're saying, yes, that was changed appropriately when I ran the tests.

It SO looks like it should work.. but just plain doesn't.. I was hoping someone was going to say DUH dude! you need to enable your HassenFeusen mode to get that to work ;)

No such luck I think..
 
OK, finally got a chance to play with this a bit more. My guess is that Procomm's DDE support is only coded to handle the 40 predefined global variables and can't handle an arbitrary variable request that is not one of those 40. Limited I know, but that's my assumption.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top