prob. using DDE to open file in running app.

W

Wilfried Hennings

Hello all,

I'm having problems using DDE to open another .txt file in an already
running editor.
System is Windows XP Pro SP2 with all available updates.

On one PC, this works as expected:
in Windows explorer, the context menu for the filetype .txt
(right-click) has the entry "PFE" and clicking on this loads the
selected file into PFE.
If PFE is already running, the selected file is loaded in a new document
window of the same editor instance.

However on another PC, using the same setup for filetype .txt,
if the PFE editor is already running, selecting "PFE" from the context
menu makes the PFE editor window come to front but the selected file
isn't opened.
If the PFE editor is not running, selecting "PFE" from the context menu
does start PFE and opens the selected file.
On this PC, opening files via DDE in other applications works.

If I change
[HKEY_CLASSES_ROOT\txtfile\shell\pfe\ddeexec\Application]
@="PFE32"
to
[HKEY_CLASSES_ROOT\txtfile\shell\pfe\ddeexec\Application]
@="PFE"
I get an error message which I do not get @="PFE32", so I think that the
system does indeed send a DDE command to PFE32 but somehow this seems to
be not recognized or malformed.


Registry export of "txtfile" looks like follows:

[HKEY_CLASSES_ROOT\txtfile\shell]
@=""

[HKEY_CLASSES_ROOT\txtfile\shell\open]

[HKEY_CLASSES_ROOT\txtfile\shell\open\command]
@="%SystemRoot%\\system32\\NOTEPAD.EXE %1"
(this is what regedit displays, the export file contains it as hex data)

[HKEY_CLASSES_ROOT\txtfile\shell\pfe]
@="PFE"

[HKEY_CLASSES_ROOT\txtfile\shell\pfe\command]
@="C:\\Programme\\PFE\\PFE32.EXE \"%1\""

[HKEY_CLASSES_ROOT\txtfile\shell\pfe\ddeexec]
@="[FileOpen(\"%1\")]"

[HKEY_CLASSES_ROOT\txtfile\shell\pfe\ddeexec\Application]
@="PFE32"

[HKEY_CLASSES_ROOT\txtfile\shell\pfe\ddeexec\Topic]
@="Editor"


Any ideas?
 
W

Wilfried Hennings

Further investigation made the whole thing even more mysterious.
See below of cited first post.
I'm having problems using DDE to open another .txt file in an already
running editor.
System is Windows XP Pro SP2 with all available updates.

On one PC, this works as expected:
in Windows explorer, the context menu for the filetype .txt
(right-click) has the entry "PFE" and clicking on this loads the
selected file into PFE.
If PFE is already running, the selected file is loaded in a new document
window of the same editor instance.

However on another PC, using the same setup for filetype .txt,
if the PFE editor is already running, selecting "PFE" from the context
menu makes the PFE editor window come to front but the selected file
isn't opened.
If the PFE editor is not running, selecting "PFE" from the context menu
does start PFE and opens the selected file.
On this PC, opening files via DDE in other applications works.

If I change
[HKEY_CLASSES_ROOT\txtfile\shell\pfe\ddeexec\Application]
@="PFE32"
to
[HKEY_CLASSES_ROOT\txtfile\shell\pfe\ddeexec\Application]
@="PFE"
I get an error message which I do not get @="PFE32", so I think that the
system does indeed send a DDE command to PFE32 but somehow this seems to
be not recognized or malformed.


Registry export of "txtfile" looks like follows:

[HKEY_CLASSES_ROOT\txtfile\shell]
@=""

[HKEY_CLASSES_ROOT\txtfile\shell\open]

[HKEY_CLASSES_ROOT\txtfile\shell\open\command]
@="%SystemRoot%\\system32\\NOTEPAD.EXE %1"
(this is what regedit displays, the export file contains it as hex data)

[HKEY_CLASSES_ROOT\txtfile\shell\pfe]
@="PFE"

[HKEY_CLASSES_ROOT\txtfile\shell\pfe\command]
@="C:\\Programme\\PFE\\PFE32.EXE \"%1\""

[HKEY_CLASSES_ROOT\txtfile\shell\pfe\ddeexec]
@="[FileOpen(\"%1\")]"

[HKEY_CLASSES_ROOT\txtfile\shell\pfe\ddeexec\Application]
@="PFE32"

[HKEY_CLASSES_ROOT\txtfile\shell\pfe\ddeexec\Topic]
@="Editor"

On the PC showing the problem there is another file type (.tex) with
this association but ProgID "tex_auto_file".
THIS WORKS WITH DDE!

So I created a new ProgID "txt_auto_file" with the same settings as the
"tex_auto_file" and linked ".txt" to "txt_auto_file" instead of
"txtfile".
But also this DOESN'T WORK with DDE!

Why does tex_auto_file work with DDE but txt_auto_file NOT?
 
W

Wilfried Hennings

Hello,
I found why it sometimes works and sometimes not.
If the full file ID (path + file name) is longer than 50 characters,
it doesn't work.
If I change [FileOpen("%1")] to [FileOpen(%1)] (2 chars less), it works
up to a file ID length of 52 chars.

Is this a limitation of Windows or of the DDE server (PFE32)?

Further investigation made the whole thing even more mysterious.
See below of cited first post.
I'm having problems using DDE to open another .txt file in an already
running editor.
System is Windows XP Pro SP2 with all available updates.

On one PC, this works as expected:
in Windows explorer, the context menu for the filetype .txt
(right-click) has the entry "PFE" and clicking on this loads the
selected file into PFE.
If PFE is already running, the selected file is loaded in a new document
window of the same editor instance.

However on another PC, using the same setup for filetype .txt,
if the PFE editor is already running, selecting "PFE" from the context
menu makes the PFE editor window come to front but the selected file
isn't opened.
If the PFE editor is not running, selecting "PFE" from the context menu
does start PFE and opens the selected file.
On this PC, opening files via DDE in other applications works.

If I change
[HKEY_CLASSES_ROOT\txtfile\shell\pfe\ddeexec\Application]
@="PFE32"
to
[HKEY_CLASSES_ROOT\txtfile\shell\pfe\ddeexec\Application]
@="PFE"
I get an error message which I do not get @="PFE32", so I think that the
system does indeed send a DDE command to PFE32 but somehow this seems to
be not recognized or malformed.


Registry export of "txtfile" looks like follows:

[HKEY_CLASSES_ROOT\txtfile\shell]
@=""

[HKEY_CLASSES_ROOT\txtfile\shell\open]

[HKEY_CLASSES_ROOT\txtfile\shell\open\command]
@="%SystemRoot%\\system32\\NOTEPAD.EXE %1"
(this is what regedit displays, the export file contains it as hex data)

[HKEY_CLASSES_ROOT\txtfile\shell\pfe]
@="PFE"

[HKEY_CLASSES_ROOT\txtfile\shell\pfe\command]
@="C:\\Programme\\PFE\\PFE32.EXE \"%1\""

[HKEY_CLASSES_ROOT\txtfile\shell\pfe\ddeexec]
@="[FileOpen(\"%1\")]"

[HKEY_CLASSES_ROOT\txtfile\shell\pfe\ddeexec\Application]
@="PFE32"

[HKEY_CLASSES_ROOT\txtfile\shell\pfe\ddeexec\Topic]
@="Editor"

On the PC showing the problem there is another file type (.tex) with
this association but ProgID "tex_auto_file".
THIS WORKS WITH DDE!

So I created a new ProgID "txt_auto_file" with the same settings as the
"tex_auto_file" and linked ".txt" to "txt_auto_file" instead of
"txtfile".
But also this DOESN'T WORK with DDE!

Why does tex_auto_file work with DDE but txt_auto_file NOT?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top