home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pfowl108.zip / profowl.usr < prev    next >
Text File  |  1996-06-10  |  7KB  |  278 lines

  1. //
  2. // See Profowl.Inf Help file on how this file format is used.
  3. // Edit with care. This file must reside in the same HOME directory
  4. // as Profowl.Exe -- Also see File: PROFOWL.DAT
  5. // *** Do Not Edit PROFOWL.DAT ***
  6. //
  7.  
  8. [Comments]
  9. .Dash-20
  10. //------------------
  11. .END
  12.  
  13. .Dash-50
  14. //------------------------------------------------
  15. .END
  16.  
  17. .Dash-70
  18. //--------------------------------------------------------------------
  19. .END
  20.  
  21. .Dash-80
  22. //------------------------------------------------------------------------------
  23. .END
  24.  
  25.  
  26.  
  27. .Function Block1
  28. //***************************************************
  29. // Function:
  30. //
  31. // Input:
  32. //
  33. // Returns:
  34. //
  35. //***************************************************
  36. .End
  37.  
  38.  
  39. .Function Block2
  40. //--------------------------------------------------------------------
  41. // Function:
  42. //
  43. // Example:
  44. //
  45. // Input:
  46. //
  47. // Returns:
  48. //
  49. // Notes:
  50. //--------------------------------------------------------------------
  51. .End
  52.  
  53. .Function Block C Style
  54. /*--------------------------------------------------------------------
  55. * Function:
  56. *
  57. * Example:
  58. *
  59. * Input:
  60. *
  61. * Returns:
  62. *
  63. * Notes:
  64. --------------------------------------------------------------------*/
  65. .End
  66.  
  67. .Function Block PC-8
  68. //┌──────────────────────────────────────────────────────────────────┐
  69. //│ Function:                                                        │
  70. //│                                                                  │
  71. //│ Example:                                                         │
  72. //│                                                                  │
  73. //│ Input:                                                           │
  74. //│                                                                  │
  75. //│ Returns:                                                         │
  76. //│                                                                  │
  77. //│ Notes:                                                           │
  78. //└──────────────────────────────────────────────────────────────────┘
  79. .End
  80.  
  81. .Function Block PC-8
  82. //╔══════════════════════════════════════════════════════════════════╗
  83. //║ Function:                                                        ║
  84. //║                                                                  ║
  85. //║ Example:                                                         ║
  86. //║                                                                  ║
  87. //║ Input:                                                           ║
  88. //║                                                                  ║
  89. //║ Returns:                                                         ║
  90. //║                                                                  ║
  91. //║ Notes:                                                           ║
  92. //╚══════════════════════════════════════════════════════════════════╝
  93. .End
  94.  
  95.  
  96.  
  97. [File I/O]
  98. .Read File Loop
  99.     FILE *fp = fopen("FILE-NAME.EXT","rt");
  100.     while( !feof(fp) )
  101.     {
  102.         char str[MAX_BUFFER_SIZE];
  103.         fgets(str,sizeof(str),fp);
  104.         printf("String: %s",str);
  105.     }
  106. .END
  107.  
  108. .Get File Size
  109.     // Get File Length
  110.     stat statbuf;
  111.     long fs = fstat(&statbuf);
  112. .END
  113.  
  114. .DosFindFirst/Next Loop
  115. ///
  116. #define INCL_DOSFILEMGR
  117. #include <os2.h>
  118. ///
  119.     FILEFINDBUF3 FindBuf;
  120.     HDIR FindHandle = -1;
  121.     ULONG FindCount = 1;
  122.     int done = DosFindFirst("*",&FindHandle,
  123.         FILE_DIRECTORY,                     // Find Each Directory...
  124.         (PVOID)&FindBuf, sizeof(FindBuf),
  125.         &FindCount,
  126.         FIL_STANDARD);
  127.  
  128.     while(!done)
  129.     {
  130.         printf("Directory: %s\n",FindBuf.achName);  // Show Each Directory Found
  131.     }
  132.     done = DosFindNext(FindHandle,&FindBuf,sizeof(FindBuf),&FindCount);
  133.     }
  134.     DosFindClose(FindHandle);
  135. .END
  136.  
  137.  
  138. .Structure FILEFINDBUF3 members used in Find First/Next
  139. // 32-bit level 1 information (without EAs)
  140. struct _FILEFINDBUF3
  141. {
  142.  ULONG    uloNextEntryOffset;
  143.  FDATE    fdateCreation;
  144.  FTIME    ftimeCreation;
  145.  FDATE    fdateLastAccess;
  146.  FTIME    ftimeLastAccess;
  147.  FDATE    fdateLastWrite;
  148.  FTIME    ftimeLastWrite;
  149.  ULONG    ulcbFile;
  150.  ULONG    ulcbFileAlloc;
  151.  ULONG    ulattrFile;
  152.  UCHAR    uccchName;
  153.  CHAR     chachName[CCHMAXPATHCOMP];
  154. }
  155. .END
  156.  
  157.  
  158.  
  159.  
  160. .DosQueryCurrentDir
  161. // Return the full path name of the current directory
  162.  #define INCL_DOSFILEMGR
  163.  #include <os2.h>
  164. //
  165.  ULONG   ulDriveNumber;     // 0=A,1=B,2=C
  166.  BYTE    CurDir[256+1];  // Buffer
  167.  CurDie[0] = '\0';
  168.  APIRET  rc = DosQueryCurrentDir(ulDriveNumber,CurDir, sizoeof(CurDir) );
  169. //
  170. .END
  171.  
  172.  
  173.  
  174. [DosStartSession]
  175. .DosStartSession
  176.  
  177. ////////////////////////////////
  178. #define INCL_DOSSESMGR
  179. #define INCL_DOSPROCESS
  180. #define INCL_DOSQUEUES
  181. #include    <os2.h>
  182. ////////////////////////////////
  183.  
  184. ULONG DOS_START_SESSION(char *exe, char *parm)
  185. {
  186.     STARTDATA   StartData;
  187.     ULONG       SessID;
  188.     PID         pid,pid2;
  189.     APIRET      rc,rc2;
  190.     RESULTCODES ReturnCodes;
  191.     #define     QUE_NAME    "\\queues\\THE_NAME.que" // MUST BE UNQIUE NAME
  192.  
  193.     HQUEUE QueueHandle;
  194.  
  195.     StartData.Length = sizeof(STARTDATA);
  196.     StartData.Related = SSF_RELATED_CHILD;
  197.     StartData.FgBg = SSF_FGBG_BACK;
  198.     StartData.TraceOpt = SSF_TRACEOPT_NONE;
  199.     StartData.PgmTitle = "DosStartSession()";
  200.     StartData.PgmName = exe;
  201.     StartData.PgmInputs = parm;
  202.     StartData.Environment = 0;
  203.     StartData.TermQ = QUE_NAME;
  204.  
  205.     StartData.InheritOpt = SSF_INHERTOPT_PARENT;
  206.     StartData.SessionType = SSF_TYPE_DEFAULT;
  207.     //
  208.     StartData.IconFile = 0;
  209.     StartData.PgmHandle = 0;
  210.     StartData.Reserved = 0;
  211.     //
  212.     StartData.PgmControl = SSF_CONTROL_VISIBLE | SSF_CONTROL_SETPOS;
  213.     StartData.InitXPos = 30;
  214.     StartData.InitYPos = 40;
  215.     StartData.InitXSize = 200;
  216.     StartData.InitYSize = 140;
  217.     //
  218.     char s[128];
  219.     StartData.ObjectBuffer = s;
  220.     StartData.ObjectBuffLen = sizeof(s);
  221.  
  222.     rc = DosCreateQueue(&QueueHandle, QUE_FIFO, QUE_NAME);
  223.  
  224.     if(rc)
  225.     {
  226.         //# printf("Create Queue Failed - Error rc = %ld\n",rc);
  227.         return(0);
  228.     }
  229.  
  230.     rc = DosStartSession(&StartData, &SessID, &pid);
  231.     //# printf("Session Started!\n\a");
  232.  
  233.     if(rc)
  234.     {
  235.         //# printf("Start Session Failed %ld\n%s\n\n",rc,s);
  236.     }
  237.     else
  238.     {
  239.         rc2 = DosWaitChild(DCWA_PROCESS, DCWW_WAIT, &ReturnCodes, &pid2, pid);
  240.  
  241.         REQUESTDATA Request;
  242.         Request.pid = pid;
  243.         Request.ulData = 777;
  244.         //
  245.         ULONG ulDataLength = 0;
  246.         PVOID DataAddress = NULL;
  247.         BYTE ElemPriority = 0;
  248.         USHORT usElementCode = 0;
  249.         UCHAR ucNoWait = 0;
  250.         HEV   SemHandle = 0;
  251.  
  252.         rc = DosReadQueue(QueueHandle, &Request, &ulDataLength,
  253.                             &DataAddress, usElementCode, ucNoWait,
  254.                             &ElemPriority, SemHandle);
  255.  
  256.         //# printf("Read Queue Done\n\a");
  257.  
  258.         if(rc)
  259.         {
  260.             //# printf("dos read queue failed %ld\n",rc);
  261.         }
  262.  
  263.         rc = DosCloseQueue(QueueHandle);
  264.         if(rc)
  265.         {
  266.             //# printf("close queue failed %ld\n",rc);
  267.         }
  268.         //# printf("value of RequestData = %ld\n",Request.ulData);
  269.         return(Request.ulData);
  270.     }
  271.     return(0);
  272. }
  273. .END
  274.  
  275.  
  276.  
  277.  
  278.