home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / fortran / mslang / avi / testavi.for < prev    next >
Encoding:
Text File  |  1994-04-12  |  5.3 KB  |  135 lines

  1. C     Totally FORTRAN implementation of EQUIPMENT_ENTRY
  2. C     by Barry W. McCleave, PhD, P.E. 601-634-2599
  3. C      FORM TEMPLATE
  4. c      itemtype()=I means integer*2             Int
  5. c      itemtype()=L (or l) means integer*4      Longint
  6. c      itemtype()=R (or r) means real*4         Real
  7. c      itemtype()=D (or d )means real*8         Double Precision
  8. c      itemtype()=C (or c) means string         Characters (termination \)
  9. c      itemtype()=S (or s) choice only          Selection
  10. c      itemtype()=T (or t) comment field        Text
  11. c      itemtype()=H (or h) form title           Heading
  12. c      itemchosen()= the list item selected (0 if edit entry)
  13. c      delimeter=^ after each selection list item; before first list item 
  14. c      delimeter=| at end of every form item
  15. c      delimeter=\ at end of every text line (\\ produces \ if c string)
  16. c      last item followed by 0 (\0 poduces 0 if c string)
  17.       include 'configur.fi'      
  18.       integer*4 function WinMain [stdcall,alias:'_WinMain@16'] 
  19.      1 (hInstance[VALUE], 
  20.      1 hPrevInstance[VALUE],lpszCmdLine[VALUE], nCmdShow[VALUE])      
  21.       include 'configur.fd'
  22.       logical*1 form
  23.       integer*4 hinstance,hprevinstance
  24.       integer*4 lpszcmdline
  25.       integer*4 ncmdshow
  26.       integer*4 initmain 
  27.       integer*4 hwnd 
  28.       Character*80 a
  29.       Character*42 Filein
  30.       Character*97 Exitform
  31.       CHARACTER*30 FILEEQUI,FILEN
  32.       LOGICAL*1 EXITFLAG           
  33.       INTEGER*4 INFILEPTR
  34.       real*8 infrows(1),exitrows(1)
  35.       integer*1 itemchin(1),itemchexit(1)
  36.       EQUIVALENCE (INFROWS(1),INFILEPTR)
  37.       DATA  ITEMCHIN/0/,ITEMCHEXIT/1/,EXITFLAG/.FALSE./
  38.       DATA FILEEQUI/'\0'C/,FILEN/'\0'C/,FILEO/'\0'C/
  39.       DATA FILEIN/'CAVI FILE NAME LESS EXTENSION^Quit NOW ^|\0'c/
  40.       DATA EXITFORM /'SNEXT ACTION     ^EXIT PROGRAM^BACKUP ONE FORM^RET
  41.      1URN TO CURRENT FORM^|hOOPS! Chose Next Action|\0'c/
  42.       winmain=0
  43.       if(initmain(hinstance,hprevinstance,ncmdshow,hwnd).ne.TRUE) Return
  44.       INFILEPTR=LOCFAR(FILEN)
  45. 9001  EXITFLAG=.FALSE.
  46.        IF(FORM(hinstance,hWnd,FILEIN,ITEMCHIN,INFROWS)) THEN
  47.           IF (ITEMCHIN(1).EQ.0) THEN
  48. C            READ IN FILE
  49.              fileo=filen
  50.              CALL GET_NAME_OF_FILE(FILEN,FILEEQUI,NUMCHAR)
  51.           ELSE    
  52.              ITEMCHEXIT(1)=1            
  53.              EXITFLAG=.TRUE.                
  54.              IF(FORM(hinstance,hWnd,EXITFORM,ITEMCHEXIT,exitrows)) THEN
  55.              endif
  56.           ENDIF  
  57.        ENDIF       
  58.        IF(EXITFLAG.AND.ITEMCHEXIT(1).EQ.1) GOTO 9999
  59.        IF(EXITFLAG.AND.ITEMCHEXIT(1).EQ.2) GOTO 9999
  60.        IF(EXITFLAG.AND.ITEMCHEXIT(1).EQ.3) GOTO 9001
  61.        write(a,23,err=9999) 'open ',fileequi(1:numchar+3),
  62.      1  ' alias test\0'c
  63.  23    format(a5,a30,a12)
  64.        ierr=mciSendString(locfar(a),NULL,0,NULL)
  65.        write(a,24,err=9999) 'window test handle',hwnd,'\0'c
  66.  24    format(a18,i12,a1)
  67.        ierr=mciSendString(locfar(a),NULL,0,NULL)
  68.        ierr=mciSendString(locfar('play test wait\0'c),Null,0,Null)
  69.        ierr=mciSendString(locfar('close test\0'c),Null,0,Null)
  70. 9999   WinMain=0
  71.       return
  72.       end
  73.  
  74.       SUBROUTINE GET_NAME_OF_FILE(BUF,FILEEQUIPMENT,NUMCHAR)
  75.       CHARACTER*30 FILEEQUIPMENT,BUF
  76.       character*1 term
  77.       PARAMETER (term=0)
  78.       NUMCHAR=1
  79.       DO WHILE (NUMCHAR.le.30.and.BUF(NUMCHAR:NUMCHAR).ne.term)
  80.             NUMCHAR=NUMCHAR+1
  81.       END DO
  82.       DO J=1,30
  83.          IF (J.LE.Numchar-1) THEN
  84.             FILEEQUIPMENT(J:J)=BUF(J:J)
  85.          ELSE
  86.             IF (J.EQ.Numchar) THEN
  87.                FILEEQUIPMENT(J:J)='.'
  88.             ELSE IF (J.EQ.Numchar+1) THEN
  89.                FILEEQUIPMENT(J:J)='A'
  90.             ELSE IF (J.EQ.Numchar+2) THEN
  91.                FILEEQUIPMENT(J:J)='V'
  92.             ELSE IF (J.EQ.Numchar+3) THEN
  93.                FILEEQUIPMENT(J:J)='I'
  94.             ELSE
  95.                FILEEQUIPMENT(J:J)=' '
  96.             ENDIF
  97.          ENDIF
  98.       END DO
  99.       RETURN
  100.       END
  101.       
  102.        integer*4 Function Initmain(
  103.      1 hInstance,hPrevInstance,ncmdshow,hwnd)
  104.        include 'testproc.fd'
  105.        external defwindowproc
  106.        integer*4 hInstance,hPrevInstance,nCmdShow
  107.        integer*4 createwindowex,loadcursor,registerclass
  108.       record /wndclass/ windowclass
  109.         integer*4   hWnd
  110. c       integer*4 idc_arrow
  111. c       data idc_arrow/32512/
  112.       Initmain = TRUE
  113. c     if no previous instance of the application fill in WNDCLASS
  114.       if (hPrevInstance.eq.false) then
  115.          WindowClass.lpszClassName = locfar('MainWin'C)
  116.          WindowClass.hInstance     = hInstance
  117.          WindowClass.lpfnWndProc   = locfar(Defwindowproc)
  118.          WindowClass.hCursor       = LoadCursor(null,idc_arrow)
  119.          WindowClass.hIcon         = NULL
  120.          WindowClass.lpszMenuName  = NULL
  121.          WindowClass.hbrBackground = COLOR_WINDOW + 1
  122.          WindowClass.style         = 0
  123.          WindowClass.cbClsExtra    = 0
  124.          WindowClass.cbWndExtra    = 0
  125.          if (RegisterClass (WindowClass).eq.false) Initmain = false
  126.       end if
  127. c     Register the class
  128.       hWnd = CreateWindowex(0,locfar('MainWin'C),locfar('MAIN'C),            
  129.      1 WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,0,CW_USEDEFAULT,0,NULL,               
  130.      1 NULL,hInstance,NULL)           
  131. c     show the window as it is not visible by default
  132.       call ShowWindow (hWnd,nCmdShow)
  133.       return 
  134.       end
  135.