Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

DDEPoke Structure

Posted on 1997-05-11
7
Medium Priority
?
346 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 300 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Loops Section Overview
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

772 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