Solved

DDEPoke Structure

Posted on 1997-05-11
7
330 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi cmd execution 6 56
Open a URL with Internet Explorer in a new tab (not a new window) 1 74
select query - oracle 16 95
Delphi inherited method 6 63
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…
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

863 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

24 Experts available now in Live!

Get 1:1 Help Now