home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / edos / v86api / testpri.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-07  |  1.4 KB  |  80 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include <dos.h>
  5. #include <errno.h>
  6.  
  7. #define EDOS_ID 0x2925
  8.  
  9. //EDOSMsg    db    'Enhanced DOS for Windows(EDOS)','$'
  10. unsigned long vxd_api;
  11.  
  12. void fail_err(char *);
  13.  
  14.  
  15. typedef unsigned int BOOL;
  16.  
  17. unsigned int fgr, bck, flags, perc;
  18.  
  19. main( int argc, char **argv)
  20. {
  21. int result, i, len, ifile;
  22.  
  23.     _asm {
  24.  
  25.     push es
  26.     mov di,0
  27.     mov es,di
  28.     mov ax,0x1684
  29.     mov bx,EDOS_ID           //    ; edos
  30.  
  31.     int 2fh
  32.     mov word ptr [vxd_api+2],es
  33.     mov word ptr [vxd_api],di
  34.     mov ax,es
  35.     or ax,di
  36.     pop es
  37.     mov al,10
  38.     jz noesdi
  39.  
  40.     mov  ax,8           //    ; get/set pri
  41.     mov  bx,1        // priority background
  42.     mov  di,0        // get Settings, di=1 means set, 0=get
  43. //    mov  dx,100        // dx = priority setting
  44.  
  45.     call vxd_api
  46.     jc err
  47.     // carry set if error
  48.     // if error ax=-1
  49.  
  50.     // cx = foreground
  51.     // dx = background
  52.     // bx:ax = flags
  53.     // si = cpu percentage
  54.         mov fgr, cx
  55.         mov bck, dx
  56.         mov flags,ax
  57.         mov perc,si
  58.    }
  59.  
  60.  goto ok;
  61. noesdi:
  62.     fputs("TESTPRI error: Can't run without EDOS & Windows\n", stdout);
  63.     return 1;
  64.  
  65. err:
  66.  
  67.     printf("%s \n", "TestPri failed, error #");
  68.     getch();
  69.     return 1;
  70. ok:
  71.     printf("%s %d, %s %d, %s %d, %s %d%%\n",
  72.  "forground=", fgr, "background", bck, "flags", flags, "Percentage",perc);
  73.     if(flags & 2) fputs("Background = ON\n", stdout);
  74.     if(flags & 1) fputs("Exclusive = ON\n", stdout);
  75.  
  76.  
  77. return result;
  78. }
  79.  
  80.