home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / mswindo / programm / misc / 4291 < prev    next >
Encoding:
Internet Message Format  |  1992-12-16  |  3.2 KB

  1. Path: sparky!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!cleveland.Freenet.Edu!bu254
  2. From: bu254@cleveland.Freenet.Edu (Stephen Groundwater)
  3. Newsgroups: comp.os.ms-windows.programmer.misc
  4. Subject: Re: drag & drop server
  5. Date: 17 Dec 1992 01:06:38 GMT
  6. Organization: Case Western Reserve University, Cleveland, OH (USA)
  7. Lines: 73
  8. Message-ID: <1gojquINNqbv@usenet.INS.CWRU.Edu>
  9. References: <1992Dec13.3151.2724@dosgate>
  10. Reply-To: bu254@cleveland.Freenet.Edu (Stephen Groundwater)
  11. NNTP-Posting-Host: hela.ins.cwru.edu
  12.  
  13.  
  14. In a previous article, chris.snell@canrem.com ("chris snell") says:
  15.  
  16. >Can anyone tell me how to implement a drag & drop SERVER for Win3.1?
  17. >
  18. >What I have so far:
  19. >1/ capture mouse
  20. >2/ get point where user released button
  21. >3/ get parent window with WindowFromPoint(drop_point)
  22. >4/ test ws_ex_AccetpFiles style for dest window, if set then proceed
  23. >5/ ??? get a handle to the ??? dropped filenames structure ???
  24. >6/ post the wm_DropFiles message to the destination window
  25. >
  26. >My problem is step 5. How do I get a handle to the drop point & drop file 
  27. >list that is passed in the wm_DropFiles message? Both the DragQueryPoint 
  28. >and DragQueryFiles functions use this handle. If it is just a handle to a 
  29. >shareable memory block then what is the record structure of that block?
  30. >
  31. >I program in Turbo Pascal For Windows, but I can likely understand 
  32. >examples in C if you must (been a coupla years since I wrote C, but I 
  33. >can still puzzle it out).
  34. >
  35. >My email address I believe is chris.snell@canrem.com. I will compile and 
  36. >post a result back to this conference.
  37. >
  38. >Thanks in advance. Chris.
  39. >
  40. This is the result of my dumping the hDrop memory that
  41. comes on the WM_DROPFILES message, and my understanding of it.
  42.  
  43. The hDrop memory is a global memory object.
  44. The drag-drop memory object consists of two parts, a header, and
  45. a trailing bit.
  46. The header is 8 bytes long in windows 3.1.
  47. The trailer is however long it needs to be.
  48.  
  49. The header:
  50.  
  51. typedef struct tagDragHeader {
  52.     UNIT wStructSize; /* Size of struct (8 bytes in this ver) */
  53.     UINT x; /* x co-ord on window that is dropped on. (Client DC) */
  54.     UINT y; /* y co-ord on window that is dropped on. (Client DC) */
  55.     WORD wReserved; /* no known purpose, should be 0 */
  56.     } DragHeader;
  57.  
  58. This is what I think the header structure is, the first three
  59. fields I am more or less sure of, the fourth field is a mystery
  60. to me, but in every drop I've seen it's been 0.
  61.  
  62. The trailer:
  63.  
  64. The trailer is a series of null-terminated strings that contain
  65. the strings that DragQueryFile() will return. The number of the
  66. strings is not in any structure, so you don't need to worry about
  67. that.
  68.  
  69. Example hDrop.
  70.  
  71. 08 00 14 00 13 00 00 00 43 3a 5c 44 4f 53 00 43     ........C:\DOS.C
  72. 3a 5c 57 49 4e 44 4f 57 53 00 43 3a 5c 41 55 54     :\WINDOWS.C:\AUT
  73. 4f 45 58 45 43 2e 42 41 54 00 00            OEXEC.BAT..
  74.  
  75. I don't know how many trailing NULLs to put on as GlobalSize return's
  76. a value that is always mod 32, so I put on 2, in file manager, the rest
  77. of the block is filled with NULLs up to its mod 32 size.
  78.  
  79. This is a drop at 20,19 of the directories C:\DOS and C:\WINDOWS, and the
  80. file AUTOEXEC.BAT .
  81.  
  82. You should GlobalAlloc a block big enough for the header, and following
  83. file names, and use the flag GMEM_DDESHARE when allocating.
  84.  
  85.  
  86.