home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: WPS_PM / WPS_PM.zip / DESKEXT.ZIP / DPREXT.DOC < prev    next >
Text File  |  1990-05-09  |  4KB  |  89 lines

  1. Instructions for writing a Desktop Picture Reader Extension for DESKPIC.EXE
  2.  
  3.  
  4. Good for you! You've decided to write an Desktop Picture Reader Extension.
  5. What do you need to know to write an extension? Well, a pretty good working
  6. knowledge of Presentation Manager wouldn't hurt. These instructions will
  7. attempt to tell you how to write an extension, but they won't tell you how to
  8. program in PM. To help, an example extension is provided and is a good place
  9. to start. When I write a new extension, I usually use 'PATTERN' as a
  10. framework and go from there.
  11.  
  12. A Desktop Picture Reader Extension is a Dynamic Link Library that contains
  13. four functions and has the file extension of '.DPR' instead of '.DLL'.
  14. The four functions must be exported with the following ordinals:
  15.  
  16.    deskpicextension  @1
  17.    deskpicgetsize    @2
  18.    deskpicread       @3
  19.    deskpicinfo       @4
  20.  
  21.  
  22. The four functions are specified by the following function prototypes:
  23.  
  24.    char far * far pascal _loadds deskpicextension(HMODULE);
  25.    ULONG far pascal _loadds deskpicgetsize(HFILE);
  26.    BOOL far pascal _loadds deskpicread(HFILE, SEL, BITMAPINFO far *);
  27.    void far pascal _loadds deskpicinfo(char far *, HWND);
  28.  
  29.  
  30. deskpicextension
  31.  
  32. This function is called by DESKPIC to determine the file type that the
  33. Desktop Picture Reader Extension can read. DESKPIC passes the module handle
  34. of the Desktop Picture Reader Extension in case any local resources need to
  35. be accessed. The function should return a pointer to a zero terminated
  36. string that contains a file extension that specifies the type of files that
  37. the Desktop Picture Reader Extension can read. The string must begin with a
  38. period and be in upper case (Example: ".XYZ"). This function should not
  39. allocate any resources because DESKPIC may call it and then choose not to
  40. call the other three functions. Note that while DESKPIC will call this
  41. function before calling the other three, it may call this function multiple
  42. times.
  43.  
  44. deskpicgetsize
  45.  
  46. This function is called by DESKPIC to determine the size of the area needed
  47. to contain the bitmap image data. DESKPIC passes an open file handle of the
  48. file it chose to be the desktop picture, with the file pointer at the
  49. beginning of the file. The function should read whatever information it
  50. needs to determine the size of the bitmap image data, and return that size
  51. (in bytes) to DESKPIC. In case of an error, the function should return zero.
  52.  
  53. deskpicread
  54.  
  55. This function is called by DESKPIC to read the bitmap image data. DESKPIC
  56. passes the open file handle of the desktop picture file (with the file
  57. pointer positioned wherever 'deskpicgetsize' left it), a selector to the
  58. bitmap image data area, and a pointer to the BITMAPINFO structure. The
  59. function should fill in both the bitmap image data area and the BITMAPINFO
  60. structure with information read from the picture file. When the function is
  61. finished, the data should conform to the formats of 'pbData' and 'pbmiData'
  62. for the OS/2 function 'GpiCreateBitmap'. If the function is successful it
  63. should return FALSE, otherwise it should return TRUE in the case of an error.
  64. Since this function performs the bulk of the work of the Desktop Picture
  65. Reader Extension, it may use up to 16K of stack space. Note that the
  66. function should not close the file handle, as DESKPIC will do this itself.
  67.  
  68. deskpicinfo
  69.  
  70. DESKPIC calls this procedure when the user has clicked on the "info" button
  71. in the DESKPIC control dialog. Usually the procedure brings up a message box
  72. with credits and instructions, but a full fledged dialog box can be invoked
  73. if desired. DESKPIC passes a pointer to the pathname of the picture currently
  74. being displayed, and the handle of DESKPIC's control dialog window. Note that
  75. this procedure is optional: if the "deskpicinfo" ordinal is not exported, a
  76. default message box will be invoked.
  77.  
  78.  
  79.  
  80. That completes the explanation. Where the instructions are a little sketchy,
  81. use the example source code to see at least one way of doing it. Good luck,
  82. and may the bits be with you.
  83.  
  84.  
  85. John Ridges
  86.  
  87. Gilmore /108 or Compuserve 72000,2057 (checked weekly)
  88. May 9, 1990
  89.