Q40866: BC 6.00 Example of OS/2 API Calls DosGetPrty, DosSetPrty
Article: Q40866
Product(s): See article
Version(s): 6.00 6.00b 7.00
Operating System(s): OS/2
Keyword(s): ENDUSER | SR# S890125-56 | mspl13_basic
Last Modified: 1-FEB-1990
Below is a sample program that calls the MS OS/2 API functions
DosGetPrty and DosSetPrty. This program can be compiled in Microsoft
BASIC Compiler Versions 6.00 and 6.00b for MS OS/2 and Microsoft BASIC
Professional Development System (PDS) Version 7.00 for MS OS/2.
The following is the sample program:
REM $INCLUDE: 'BSEDOSPC.BI'
DEFINT a-z
DIM pids AS PidInfo
x%=DosGetPid(pids)
IF (x%) THEN
PRINT "An error occurred in DosGetPid: ";x%
END
ELSE
pid=pids.pid
scope = 0
x% = DosGetPrty(scope,priority,pid)
IF (x%) THEN
PRINT "An error occurred in DosGetPrty: ";x%
END
ELSE
PRINT
PRINT "Priority: "; Priority
PRINT
CALL SetPrty(pid)
PRINT
PRINT "Enter a Key to Verify Change..."
WHILE INKEY$="": WEND
scope=0
x%=DosGetPrty(scope,priority,pid)
IF (x%) THEN
PRINT "An error Occurred in DosGetPrty: ";x%
END
ELSE
PRINT
PRINT "Priority: "; Priority
END IF
END IF
END IF
END
SUB SetPrty(pid) STATIC
Print "Enter the SCOPE (0 - Process and all threads)"
PRINT " (1 - Process and all the descendants)"
PRINT " (2 - Thread calling the function)"
INPUT " OPTION: ";scope
PRINT
PRINT "Enter the CLASS (0 - No Change)"
PRINT " (1 - Idle-time)"
PRINT " (2 - Regular)"
PRINT " (3 - Time-Critical)"
INPUT " OPTION: ";class
PRINT
INPUT "Enter CHANGE (-31 to + 31) : "; change
x% = DosSetPrty%(scope,class,change,pid)
if (x%) then
PRINT "Error setting Priority - ";x%
else
PRINT "Priority Changed."
end if
END SUB
THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.
Copyright Microsoft Corporation 1986-2002.