Board index » delphi » DDE SetLink doesn't seem to like full paths

DDE SetLink doesn't seem to like full paths

I am attempting to set up a DDE link and everything is fine if both
client and server app are in the same directory. However, when I
place the server app in another directory (not mentioned in path) and
try to use a full path in the DDEService and DDETopic arguments
of Setlink, I always get a false return value. I don't want to assume the
user has a path set to the server app.  The server app is started if not
currently running but no conversation can take place.

var
  ddepath: String;

    with DDEClientConv1 do
    begin

        { Get full path... }
      if OpenDialog2.Execute then
        ddepath := ExtractFilePath(OpenDialog2.FileName);

      DDEService := ddepath+'server';
      DDETopic := ddepath+'Test Server';

      ServiceApplication := ddepath+'Server';
      if SetLink(DDEService,DDETopic) then   <------this is always false.

Note: if ddepath = '' (ie,null, in current directory) there is no problem.

Thanks in advance for your assistance.

Brian t...@ltol.com

 

Re:DDE SetLink doesn't seem to like full paths


Here is a snippet of code from a working test DDE Client that I wrote
that manually calls a DDE Server:

      ddeCliConv.CloseLink;
      ddeCliConv.ConnectMode := ddeManual;
      ddeCliConv.ServiceApplication :=
'\\barney\drive_d\pub\steve\pas\ddesvr2\ddesvr2';
      ddeCliConv.SetLink('ddesvr2', 'ddesvrConv');
      if not(ddeCliConv.OpenLink) then
         raise Exception.Create('Unable to connect to Server');
      if not(ddeCliConv.ExecuteMacro('From DDESvr', false)) then
         raise Exception.Create('Unable to execute macro');

Note that I am using a UNC path for the DDE Server, though a drive
letter has worked for me in the past. Of course, you can't have a file
extension in the filename. Note also that I don't test SetLink, but test
OpenLink. I can't remember why I did it this way, but it works.

My condolences and best wishes for whatever you're trying to do with
DDE. :)

Good luck,

Steve

Quote
BHaulman wrote:
> I am attempting to set up a DDE link and everything is fine if both
> client and server app are in the same directory. However, when I
> place the server app in another directory (not mentioned in path) and
> try to use a full path in the DDEService and DDETopic arguments
> of Setlink, I always get a false return value. I don't want to assume
> the
> user has a path set to the server app.  The server app is started if
> not
> currently running but no conversation can take place.

> var
>   ddepath: String;

>     with DDEClientConv1 do
>     begin

>         { Get full path... }
>       if OpenDialog2.Execute then
>         ddepath := ExtractFilePath(OpenDialog2.FileName);

>       DDEService := ddepath+'server';
>       DDETopic := ddepath+'Test Server';

>       ServiceApplication := ddepath+'Server';
>       if SetLink(DDEService,DDETopic) then   <------this is always
> false.

> Note: if ddepath = '' (ie,null, in current directory) there is no
> problem.

> Thanks in advance for your assistance.

> Brian t...@ltol.com

Other Threads