Solved

DDEPoke Structure

Posted on 1997-05-11
7
329 Views
Last Modified: 2010-04-06
Has anyone got any information/examples regarding the DDEPoke
facility.  As I'm sending data to a 3rd party application that wants
the data in it's own format, I can't use the DDE components that came
with Delphi, so I have to use the Win API ones.  I've managed to
receive data but I've got a problem when it comes to sending data.

I've got something like this so far, but it keeps crashing the 3rd
party application.

var
  ItemAtom : TAtom;
  hData : THandle;
  poke : ^TDDEPoke;
  gc   : TMyData;
begin
   hData:=GlobalAlloc(GHND or GMEM_DDESHARE ,
sizeof(TDDEPOKE)+sizeof(TMyData));

   poke:=GlobalLock(hData);
   if poke=NIL then
      exit;
   poke^.cfformat:=cfGrail;   { Already registered with the clipboard
}
   poke^.flags:=0;

   move(gc,poke^.value,sizeof(gc));

   GlobalUnlock(hData);
   itematom := GlobalAddAtom('CONFERENCE');
   if PostMessage(hWndGrail,wm_DDE_POKE,
Handle,MAKELPARAM(hData,itematom)) then

etc. etc.

Anyone done anything like this and can shed any light onto the matter
?

Regards
Darren
0
Comment
Question by:Dazza051197
  • 4
  • 3
7 Comments
 
LVL 3

Expert Comment

by:sperling
ID: 1336119
When do you dispose the memory block?

Erik.
0
 
LVL 1

Author Comment

by:Dazza051197
ID: 1336120
Memory block disposed of when I receive a DDEAck from the other application.  But I never get that far because the other app GPF's.  If I mess around with the GMEM_xxxx options then I sometimes get the other app not to GPF but it doesnt get the actual data I'm sending, it gets some garbage.
0
 
LVL 3

Expert Comment

by:sperling
ID: 1336121
Is this 16 or 32-bit?

Erik.

0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 1

Author Comment

by:Dazza051197
ID: 1336122
I'm writing it in 32 bit Delphi 2, but the database application I'm talking to is only 16 bit, but does work ok on Win 95 and NT.
0
 
LVL 3

Accepted Solution

by:
sperling earned 100 total points
ID: 1336123
I'm not entirely sure this will help, but according to my docs you should not use MAKELONG in win32, as the global memory handle is a long.

Look up PackDDElParam in API help, and use this instead. This works well for 32-bit to 32-bit DDE, but I haven't had the chance to test against a 16-bit DDE server.

Regards,

Erik.
0
 
LVL 1

Author Comment

by:Dazza051197
ID: 1336124
Apologies for my late reply.  You pointed me in the right direction, the problem was with the 32 bit handle being a long and the 16 bit application I'm talking to didn't like it.  I needed to be able to make a long up from my 2 integers so 32 bit Delphi is out of the question, I've now compiled my program successfully in 16 bit Delphi (thank goodness they put that on the CD with Delphi 2).  Any one know how to get a 16 bit handle to a global memory location so I dont need 2 applications.
0
 
LVL 3

Expert Comment

by:sperling
ID: 1336125
Hummm... A possibility would be writing the DDE part in a 16-bit DLL and then thunk down calling it from your app.

Regards,

Erik.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now