home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c031 / 4.ddi / SAMPLES / PWBEXTEN / SKEL.C$ / SKEL
Encoding:
Text File  |  1992-01-15  |  3.4 KB  |  125 lines

  1. /* SKEL.C - Skeleton for PWB extension
  2.  *
  3.  * Purpose: Commented outline for a PWB extension
  4.  *
  5.  * Switches: none
  6.  *
  7.  * Functions:
  8.  *
  9.  *  Func        - does nothing
  10.  *
  11.  *
  12.  */
  13.  
  14. //  Turn off common warnings for benign extension constructs
  15. //
  16. #pragma warning( disable:4001 )  //Allow single-line comments
  17. #pragma warning( disable:4100 )  //Allow unused arguments
  18.  
  19. #include "ext.h"
  20.  
  21. void _cdecl EXTERNAL WhenLoaded( void );
  22.  
  23. PWBFUNC Func( unsigned argData, ARG far *pArg, flagType fMeta );
  24.  
  25. // Func - Sample extension function
  26. //
  27. // Purpose:
  28. //  Sample extension function entry point.
  29. //
  30. // Input:
  31. //  argData = Keystroke used to invoke the function. This argument is not
  32. //            used in extensions.
  33. //
  34. //  pArg    = Far pointer to a structure which defines the argument for the
  35. //            function.
  36. //
  37. //  fMeta   = Boolean indicating whether the Meta modifier was turned on at
  38. //            the time the function was executed.
  39. //
  40. // Output:
  41. //  Extension functions are expected to return a Boolean value indicating
  42. //  success or failure. Typically, TRUE is returned in the normal case.
  43. //  These values can be tested inside of macros.
  44. //
  45.  
  46. PWBFUNC Func( unsigned argData, ARG far *pArg, flagType fMeta )
  47. {
  48.     return TRUE;
  49. }
  50.  
  51. //-----------------< Standard Extension Information >----------------//
  52.  
  53. // WhenLoaded - Extension initialization (required)
  54. //
  55. // Purpose:
  56. //  This function is called when the extension is loaded.
  57. //  Extension initialization may occur here. This function must be defined
  58. //  even if the extension does not require initialization code.
  59. //
  60. // Input: none
  61. // Output:none
  62. //
  63.  
  64. void _cdecl EXTERNAL WhenLoaded( void )
  65. {
  66.     DoStatusBox( "Banner", NULL );//Display extension banner
  67.  
  68.     //Initialize extension
  69.     //
  70.     SetKey( "Func", "Shift+Ctrl+F" );
  71.  
  72.     DoStatusBox( NULL, NULL );    //Close status box
  73. }
  74.  
  75. //
  76. // Command description table.
  77. //
  78. //  This is an array of command descriptions that contain the text name of
  79. //  the function (for key assignment and use in macros), a pointer to the
  80. //  function to be called, and a set of flags that describe the types of
  81. //  arguments that the function accepts.
  82. //
  83. //  This table is required, even if no functions are defined. In this case,
  84. //  the table consists of the terminating empty structure.
  85. //
  86.  
  87. struct cmdDesc cmdTable[] =
  88. {
  89.     //name,   func, 0, argType
  90.  
  91.     { "Func", Func, 0, NOARG },
  92.     { NULL,   NULL, 0, 0     }   //end-of-table
  93. };
  94.  
  95. //
  96. // Switch description table.
  97. //
  98. //  This is an array of switch descriptions that contain the text name of
  99. //  the switch (for assignment), a pointer to the switch variable for
  100. //  numeric and Boolean switches or a function for text switches, and a set
  101. //  of flags that describe the type of switch.
  102. //
  103. //  This table is required, even if no switches are defined. In this case,
  104. //  the table consists of the terminating empty structure.
  105. //
  106. //  The switch types are:
  107. //
  108. //      SWI_BOOLEAN             Boolean
  109. //      SWI_NUMERIC | RADIX10   Decimal numeric
  110. //      SWI_NUMERIC | RADIX16   Hexadecimal numeric
  111. //      SWI_EXTTEXT:            Text (act is a function to get/set value)
  112. //
  113. //  Use toPIF(act) to suppress compiler warnings for Boolean and numeric
  114. //  switches. For example:
  115. //
  116. //      { "Switchname", toPIF(switchvar), SWI_BOOLEAN },
  117. //
  118.  
  119. struct swiDesc swiTable[] =
  120. {
  121.     //name, act,  type
  122.  
  123.     { NULL, NULL, 0 }   //end-of-table
  124. };
  125.