473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Any DDE server success stories?

Hi.

A recent thread at dotnet.general brought me back to DDE(Dynamic Data
Exchange) Interfaces.

I was trying to use the DDE API functions defined in user32.dll
to connect to and to control a DDE server(in this case, the server was
Acrobat).

I manage to initialize DDE using DdeInitializeA
and i also manage to connect to the DDE server using DdeConnect.

Then, after creating a DDE command(which i know is correct),
and creating a data handle for that command(DdeCreateStringHandleA,
DdeCreateDataHandle),
i try to use DdeClientTransaction to execute the command.

I get no error messages whatsoever, however, nothing happens!
The commands i have fed to the DDE server was obviously not executed.

Has anyone successfully connected to and controlled a DDE server
using C# and the Windows API?

Please share your experience.

You might ask yourself why on earth i want to use DDE in 2004,
but there is no other way(COM way) to do what i want to do, and i think
it is somewhat funny for a change as well.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
Nov 16 '05 #1
5 8379
Dennis,

You do not create a data handle when sending a DDE command. Instead,
just convert the string containing the command you want to send into a
byte array and pass that into the DdeClientTransaction API. Here is an
example.

[DllImport(
"user32.dll",
EntryPoint="DdeClientTransaction",
CharSet=CharSet.Ansi)]
public static extern IntPtr DdeClientTransaction(
byte[] pData,
uint cbData,
IntPtr hConv,
IntPtr hszItem,
uint wFmt,
uint wType,
uint dwTimeout,
ref uint pdwResult);

public void Execute(string command) {

// Call DdeInitialize and DdeConnect before executing
// the following code.

byte[] data = Encoding.ASCII.GetBytes(command + "\x00");

uint timeout = 60000; // 60 seconds
uint returnFlags = 0;
IntPtr result = DdeClientTransaction(
data,
(uint)data.Length,
conversationHandle,
IntPtr.Zero,
CF_TEXT,
XTYP_EXECUTE,
timeout,
ref returnFlags);

if (result == IntPtr.Zero)
{
// There was a failure sending the command.
}
}

Dennis Myrén wrote:
Hi.

A recent thread at dotnet.general brought me back to DDE(Dynamic Data Exchange) Interfaces.

I was trying to use the DDE API functions defined in user32.dll
to connect to and to control a DDE server(in this case, the server was Acrobat).

I manage to initialize DDE using DdeInitializeA
and i also manage to connect to the DDE server using DdeConnect.

Then, after creating a DDE command(which i know is correct),
and creating a data handle for that command(DdeCreateStringHandleA,
DdeCreateDataHandle),
i try to use DdeClientTransaction to execute the command.

I get no error messages whatsoever, however, nothing happens!
The commands i have fed to the DDE server was obviously not executed.

Has anyone successfully connected to and controlled a DDE server
using C# and the Windows API?

Please share your experience.

You might ask yourself why on earth i want to use DDE in 2004,
but there is no other way(COM way) to do what i want to do, and i think it is somewhat funny for a change as well.



--
Regards,
Dennis JD Myrén
Oslo Kodebureau


Nov 16 '05 #2
Dennis,

You do not create a data handle when sending a DDE command. Instead,
just convert the string containing the command you want to send into a
byte array and pass that into the DdeClientTransaction API. Here is an
example.

[DllImport(
"user32.dll",
EntryPoint="DdeClientTransaction",
CharSet=CharSet.Ansi)]
public static extern IntPtr DdeClientTransaction(
byte[] pData,
uint cbData,
IntPtr hConv,
IntPtr hszItem,
uint wFmt,
uint wType,
uint dwTimeout,
ref uint pdwResult);

public void Execute(string command) {

// Call DdeInitialize and DdeConnect before executing
// the following code.

byte[] data = Encoding.ASCII.GetBytes(command + "\x00");

uint timeout = 60000; // 60 seconds
uint returnFlags = 0;
IntPtr result = DdeClientTransaction(
data,
(uint)data.Length,
conversationHandle,
IntPtr.Zero,
CF_TEXT,
XTYP_EXECUTE,
timeout,
ref returnFlags);

if (result == IntPtr.Zero)
{
// There was a failure sending the command.
}
}

Dennis Myrén wrote:
Hi.

A recent thread at dotnet.general brought me back to DDE(Dynamic Data Exchange) Interfaces.

I was trying to use the DDE API functions defined in user32.dll
to connect to and to control a DDE server(in this case, the server was Acrobat).

I manage to initialize DDE using DdeInitializeA
and i also manage to connect to the DDE server using DdeConnect.

Then, after creating a DDE command(which i know is correct),
and creating a data handle for that command(DdeCreateStringHandleA,
DdeCreateDataHandle),
i try to use DdeClientTransaction to execute the command.

I get no error messages whatsoever, however, nothing happens!
The commands i have fed to the DDE server was obviously not executed.

Has anyone successfully connected to and controlled a DDE server
using C# and the Windows API?

Please share your experience.

You might ask yourself why on earth i want to use DDE in 2004,
but there is no other way(COM way) to do what i want to do, and i think it is somewhat funny for a change as well.



--
Regards,
Dennis JD Myrén
Oslo Kodebureau


Nov 16 '05 #3
Thank you, Brian!

I will give it a shot.
If you do have C# example codes interacting with a DDE server, i am also
interested
in that.

DDE, long time ago!
--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Brian Gideon" <br*********@yahoo.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
Dennis,

You do not create a data handle when sending a DDE command. Instead,
just convert the string containing the command you want to send into a
byte array and pass that into the DdeClientTransaction API. Here is an
example.

[DllImport(
"user32.dll",
EntryPoint="DdeClientTransaction",
CharSet=CharSet.Ansi)]
public static extern IntPtr DdeClientTransaction(
byte[] pData,
uint cbData,
IntPtr hConv,
IntPtr hszItem,
uint wFmt,
uint wType,
uint dwTimeout,
ref uint pdwResult);

public void Execute(string command) {

// Call DdeInitialize and DdeConnect before executing
// the following code.

byte[] data = Encoding.ASCII.GetBytes(command + "\x00");

uint timeout = 60000; // 60 seconds
uint returnFlags = 0;
IntPtr result = DdeClientTransaction(
data,
(uint)data.Length,
conversationHandle,
IntPtr.Zero,
CF_TEXT,
XTYP_EXECUTE,
timeout,
ref returnFlags);

if (result == IntPtr.Zero)
{
// There was a failure sending the command.
}
}

Dennis Myrén wrote:
Hi.

A recent thread at dotnet.general brought me back to DDE(Dynamic Data Exchange) Interfaces.

I was trying to use the DDE API functions defined in user32.dll
to connect to and to control a DDE server(in this case, the server was Acrobat).

I manage to initialize DDE using DdeInitializeA
and i also manage to connect to the DDE server using DdeConnect.

Then, after creating a DDE command(which i know is correct),
and creating a data handle for that command(DdeCreateStringHandleA,
DdeCreateDataHandle),
i try to use DdeClientTransaction to execute the command.

I get no error messages whatsoever, however, nothing happens!
The commands i have fed to the DDE server was obviously not executed.

Has anyone successfully connected to and controlled a DDE server
using C# and the Windows API?

Please share your experience.

You might ask yourself why on earth i want to use DDE in 2004,
but there is no other way(COM way) to do what i want to do, and i think it is somewhat funny for a change as well.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau

Nov 16 '05 #4
Dennis,

I have a example on http://www.gotdotnet.com in the user samples
section. Just search for DDE and you should find it. It's actually a
library that wraps the DDEML. I included examples of how to write your
own DDE client and servers using the library as well.

Brian

Dennis Myrén wrote:
Thank you, Brian!

I will give it a shot.
If you do have C# example codes interacting with a DDE server, i am also interested
in that.

DDE, long time ago!


--
Regards,
Dennis JD Myrén
Oslo Kodebureau


Nov 16 '05 #5
Thanks, Brian.
You have been a great help.
To be honest, i did not think anyone would answer this thread.

I am going to look at your example on gotdotnet.

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Brian Gideon" <br*********@yahoo.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Dennis,

I have a example on http://www.gotdotnet.com in the user samples
section. Just search for DDE and you should find it. It's actually a
library that wraps the DDEML. I included examples of how to write your
own DDE client and servers using the library as well.

Brian

Dennis Myrén wrote:
Thank you, Brian!

I will give it a shot.
If you do have C# example codes interacting with a DDE server, i am also interested
in that.

DDE, long time ago!
--
Regards,
Dennis JD Myrén
Oslo Kodebureau

Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Alexander DEJANOVSKI | last post by:
I've released a new version of Retic with new components : - Pipes : XPathPipe and FlatToXMLPipe - Source : SQLTreeSource (permits to build complex XML documents from several SQL requests). ...
0
by: Stephan Deibel | last post by:
Hi, O'Reilly Associates has agreed to print a second volume of Python Success Stories and I am looking for contributors of new stories. This booklet will showcase Python in the context of a...
0
by: Stephan Deibel | last post by:
Hi, I just wanted to let y'all know that the Python Success Stories collection has nine new additions: http://www.pythonology.com/success These 28 stories include significant testimonials...
0
by: Stephan Deibel | last post by:
Hi, O'Reilly Associates is going to be printing volume III of the Python Success Stories series in June and I'm looking for submissions of new stories. The stories have been quite valuable...
3
by: Ron Sanderson | last post by:
I am currently evaluating Quest (Foglight & Spotlight) vs. BMC (Patrol & DBXray) and I am soliciting feedback from the community on these two products or any others that I should check out. Any...
0
by: Petrone | last post by:
And so are the success stories. Munich, Germany's recently disclosed plans to move off Windows to Linux on the desktop is the most high profile large-scale migration, but there are many...
1
by: srihari | last post by:
Hai, I am trying to install IBM DB2 8.1 on Red Hat linux 8.0. My machine is Intel XEON 64bit. The installation went well except for the creation of tools catalog. When I tried to install the tools...
1
by: krishnakant Mane | last post by:
hello all. actually I have been recently appointed as a technology consulltent at a huge company. and I have couple more such projects in the pypeline. unfortunately the officials out here are...
45
by: azrael | last post by:
Hy guys, A friend of mine i a proud PERL developer which always keeps making jokes on python's cost. Please give me any arguments to cut him down about his commnets like :"keep programing i...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.