Handling the DM_DROP Message

#define XFERMEM "\\SHAREMEM\\DragXfer.mem"      /* Shared mem obj name   */

PVOID     pCust;                                /* Customer record ptr   */

PDRAGITEM pDItem;                               /* DRAGITEM struct ptr   */
PDRAGINFO pDInfo;                               /* DRAGINFO struct ptr   */
  :
case DM_DROP:
     pDInfo = (PDRAGINFO)mp1;                   /* Get DRAGINFO pointer  */
     DrgAccessDraginfo(pDInfo);                 /* Access DRAGINFO       */
     pDItem = DrgQueryDragitemPtr(pdinfo,       /* Access DRAGITEM       */
                                  0);           /* Index to DRAGITEM     */

     DosAllocSharedMem(&pCust,                  /* Allocate shared mem   */
                       XFERMEM,                 /* Named memory object   */
                       sizeof(CUSTOMER),        /* Size of memory object */
                       PAG_COMMIT |             /* Commit storage now    */
                       PAG_WRITE  |             /* Allow write access    */
                       PAG_READ);               /* Allow read access     */

     pdxfer = DrgAllocDragtransfer(1);          /* Allocate DRAGTRANSFER */
     pdxfer->cb = sizeof(DRAGTRANSFER);         /* Init DRAGTRANSFER     */
     pdxfer->hwndClient = hWnd;
     pdxfer->pditem = pDItem;
     pdxfer->hstrSelectedRMF =
             DrgAddStrHandle("<DRM_CUSTOMER,DRF_TEXT>");
     pdxfer->hstrRenderToName =
             DrgAddStrHandle(XFERMEM);
     pdxfer->ulTargetInfo = 0;
     pdxfer->usOperation = DO_COPY;

     rc=DrgSendTransferMsg(pDInfo->hwndSource,  /* Send msg to source    */
                           DM_RENDER,           /* DM_RENDER message     */
                           (MPARAM)pdxfer,      /* DRAGTRANSFER pointer  */
                           NULL);
     if (rc == TRUE)                            /* If rendered okay      */
        {
        strcpy(msgtext, "Dialling number");     /* Build message text    */
        strncat(msgtext,
                pxfercust->phone,
                30);
        WinMessageBox(HWND_DESKTOP,             /* Display message box   */
                      hWnd,                     /* Curr window is owner  */
                      msgtext,                  /* Message text          */
                      "Telephone Dialler",      /* Message title         */
                      0,                        /* No identifier         */
                      MB_OK);                   /* Include okay button   */

        PhoneDial(pxfercust->phone);            /* Dial number           */
        }

     DrgFreeDragInfo(pdinfo);                   /* Release all data      */
     DrgFreeDragtransfer(pdxfer);               /* structures            */
     DosFreeMem((PVOID)pxfercust);
     break;


[Back: Handling the DM_DRAGOVER Message]
[Next: Handling the DM_RENDER Message]