Solved

DDEPoke Structure

Posted on 1997-05-11
7
333 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Working this component WebCopy with proxy, help 3 103
Create Database on Android via Delphi dbExpress 3 129
Intraweb download file link ? 1 168
Delphi selector screen 2 92
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 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