WWW_URLEcho with dde

Mike Clarkson support at internetdiscovery.com
Thu Dec 21 20:17:27 CET 2000


On Sun, 10 Dec 2000 13:36:24 GMT, Roger Abbott <rogerha at aol.com>
wrote:

>In article <3a32b7e6.8685100 at 24.0.228.33>,
>  support @ internetdiscovery.com (Mike Clarkson) wrote:
>> Has anyone used the dde module in Python to register a URLEcho from
>> netscape or Internet Explorer? Looking at the source code to dde I see
>> comments about Netscape's use of poke, which indicates the author
>> may have been playing with URLEcho.
>>
>> I'd like to start a dde server and register it with netscape to send
>> me an echo when it loads a web page. Has anyone done this?
>
>Yes, in VB. The web site below has a free WebSpy program which does it.
>It comes with source code, I am sure you can figure out how it works.

Thanks, but I was looking for a solution in Python with dde.py.

Here is what I tried: I can see the messages coming back from
Netscape, so the Echo has been registered, but Python takes no action.

Mike.

import win32ui
from pywin.mfc import object
import dde

class MySystemTopic(object.Object):
	def __init__(self):
		object.Object.__init__(self,
dde.CreateServerSystemTopic())
	def Exec(self, cmd):
		print "System Topic asked to exec", cmd

class MyPokeTopic(object.Object):
	def __init__(self, topicName):
		object.Object.__init__(self,
dde.CreateTopic(topicName))
	def Poke(self, cmd):
		print "Other Topic asked to poke ", cmd

class MyRequestTopic(object.Object):
	def __init__(self, topicName):
		object.Object.__init__(self,
dde.CreateTopic(topicName))
	def Request(self, cmd):
		print "Other Topic asked to poke ", cmd

server = dde.CreateServer()
server.AddTopic(MySystemTopic())
server.AddTopic(MyPokeTopic("WWW_URLEcho"))
server.AddTopic(MyRequestTopic("WWW_URLEcho"))
server.Create('MyApp')
print 'created myapp'

conversation = dde.CreateConversation(server)

conversation.ConnectTo("Netscape", "WWW_RegisterURLEcho")

s = '"MyApp"'
sl = conversation.Poke(s)
print 'Retval is "%s"'% s

del conversation

while 1:
	win32ui.PumpWaitingMessages(0, -1)




More information about the Python-list mailing list