Topic: BC++3.0/OWL DDEACK structure from WM_DDE_EXECUTE


Author: peterj@PROBLEM_WITH_INEWS_GATEWAY_FILE (Peter Westley)
Date: Tue, 26 Jan 1993 01:47:14 GMT
Raw View
[ Article crossposted from comp.os.ms-windows.programmer.misc ]
[ Author was Peter Westley ]
[ Posted on Tue, 26 Jan 1993 01:33:13 GMT ]

Is the DDEACK structure which comes pointed to in LOWORD of lParam when
WM_DDE_ACK is in response to a WM_DDE_EXECUTE message, valid?

Let me explain:

I have a method called when I receive a WM_DDE_ACK message:
(Using OWL dynamic dispatching it's easy) It get's called after sending a
WM_DDE_XXX message to the DDE serveer, when the server replies with an
WM_DDE_ACK message.

class DDEClass
{
    //...
    WMDDEAck(TMessage & Msg)
 =[WM_FIRST + WM_DDE_ACK];
    WORD PendingMessage;
}

void DDEClass::WMDDEAck(TMessage& Msg)
{
    switch (PendingMessage)//pending message is the message which was just sent
      //to the DDE server - i.e. it's what this WM_DDE_ACK
      //is in reply to.
    {
 case WM_DDE_INITIATE:
     //stuff
     break;
        case WM_DDE_REQUEST:
 //I put this and the next case in blocks so that the DdeAck is only
 //created if it's needed (i.e. a local copy only)
     {   //Get the pointer to the DDEACK
  DDEACK *DdeAck = (DDEACK *)Msg.LP.Lo;
  if(DdeAck->fAck)               //\
      //stuff if ack is valid;   // \
                else                           //  |- these are different to the
      //other stuff if it isn't; // /   DDE_EXECUTE commands
     }                                  ///
     break;
 case WM_DDE_EXECUTE:
     {   //Get the pointer to the DDEACK
  DDEACK *DdeAck = (DDEACK *)Msg.LP.Lo;
  if(DdeAck->fAck)
      //stuff if ack is valid;
                else
      //other stuff if it isn't;
     }
     break;
    }
}

The problem is that when I get the response from the WM_DDE_REQUEST message,
everything is fine (same for the WM_DDE_INITIATE but I don't use the DDEACK
structure there)  When it enters the case WM_DDE_EXECUTE case section,
I get a GP fault on access to the DdeAck->fAck location.  The code generated
by the compiler is the same for both parts of the case statements (though
I haven't been able to check the code which sets up the DDEACK struct).

SO, does anyone know if there is a problem in the windows code (3.1) which
might be broken here such that it doesn't allocate the DDEACK structure
properly?  Is the DDEACK struct supposed to be valid when it's in response
to a WM_DDE_EXECUTE message?

Please help!

Thank in anticipation,

Peter Westley    .-_!\  Hewlett Packard
Phone: +61 3 (T)272 2440        /     \  Australian Support Centre
Fax: +61 3 890 0326       \_.-.b/<--------31-41 Joseph St.
E-mail: peterj@hparc0.aus.hp.com     v          Blackburn, Victoria 3130
//
// The views, opinions, information or other data here is solely from the
// mind of myself.  It is not the official word from my employer.  While I
// endeavour to provide accurate information, no responsibility is taken
// for errors or omissions.