Does windows provide a different/better/newer way than the ddeexec registry key to open a file in an existing window? Is the accepted way to do this now to take your arguments on the command line to a new instance of your application, then find your own open application and tell it to open the file? I'm open to any suggestions of a better way to do this.
<br><br>(side note: DDE may be antiquated, but internet explorer and firefox under windows XP both use this method to open a URL in an existing window if you, for example, type the URL in the run box).<br><br>Here's an export from my registry. This example is not exactly as described above (it talks to the topic named "test", rather than the system topic)
<br><br>[HKEY_CLASSES_ROOT\ft000005]<br>"EditFlags"=dword:00000000<br>"BrowserFlags"=dword:00000008<br>@="filetest file"<br><br>[HKEY_CLASSES_ROOT\ft000005\shell]<br>@="open"<br><br>
[HKEY_CLASSES_ROOT\ft000005\shell\open]<br><br>[HKEY_CLASSES_ROOT\ft000005\shell\open\command]<br>@="\"e:\\python24\\python.exe\" \"e:\\development\\filetest\\filetest.py\""<br><br>[HKEY_CLASSES_ROOT\ft000005\shell\open\ddeexec]
<br>@="open(%1)"<br><br>[HKEY_CLASSES_ROOT\ft000005\shell\open\ddeexec\Application]<br>@="filetest"<br><br>[HKEY_CLASSES_ROOT\ft000005\shell\open\ddeexec\Topic]<br>@="test"<br><br><br><br>Sample code for
filetest.py:<br><br>import win32ui<br>import dde<br>from pywin.mfc import object<br><br>class DdeSystemTopic(object.Object):<br> def __init__(self):<br> object.Object.__init__(self, dde.CreateServerSystemTopic())
<br><br> def Exec(self, cmd):<br> print "Exec:", cmd<br><br>class DdeOtherTopic(object.Object):<br> def __init__(self, topicName):<br> object.Object.__init__(self, dde.CreateTopic(topicName))
<br><br> def Exec(self, cmd):<br> print "Exec:", cmd<br><br>server = dde.CreateServer()<br>server.AddTopic(DdeSystemTopic())<br>server.AddTopic(DdeOtherTopic('test'))<br>server.Create("filetest")
<br>while 1:<br> win32ui.PumpWaitingMessages(0, -1)<br><br>Thanks!<br><br><br><div class="gmail_quote">On Dec 6, 2007 12:41 PM, Tim Roberts <<a href="mailto:timr@probo.com">timr@probo.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">Matt Harriger wrote:<br>><br>> I have a question about using DDE to launch a file in an existing<br>> application when double-clicked from explorer. I'm trying to use the<br>
> built-in windows functionality for doing this by setting the<br>> application and topic keys in HKCR\my_file_type\shell\open<br>> \ddeexec. I also have HKCR\my_file_type\shell\open\command set up to<br>> launch my python script if windows can't find the application through
<br>> dde ( i.e. it's not currently running). The python script create a<br>> server and registers the system topic as the very first thing it does.<br>> When I double-click a file of this type in Explorer, I get an error
<br>> dialog saying that "windows cannot find ' filename.ext' Make sure you<br>> typed the name correctly...". Has anyone else been able to open a file<br>> in a running application this way?<br>
<br></div></div>Are you really using DDE? DDE is an antique protocol that is virtually<br>extinct today. It's interesting to see someone trying to find a modern<br>use for it.<br><br>Can you dump the whole HKCR\my_file_type registry key and show it to
<br>us? Mail it to me privately, if you want. I'll see if anything looks<br>unusual.<br><font color="#888888"><br>--<br>Tim Roberts, <a href="mailto:timr@probo.com">timr@probo.com</a><br>Providenza & Boekelheide, Inc.
<br><br>_______________________________________________<br>python-win32 mailing list<br><a href="mailto:python-win32@python.org">python-win32@python.org</a><br><a href="http://mail.python.org/mailman/listinfo/python-win32" target="_blank">
http://mail.python.org/mailman/listinfo/python-win32</a><br></font></blockquote></div><br>