home *** CD-ROM | disk | FTP | other *** search
- unit WinAware;
-
- interface
-
- Function RunningWin386(var Major, Minor : byte) : boolean;
- { Detects if Windows is running in 386 mode and returns major and minor
- revision numbers.
-
- Major - Major revision number
- Minor - Minor revision number
- Returns true if in Windows 386 enhanced mode.
- }
-
- Procedure ReleaseWinTimeSlice;
- { Releases the time slice for use in other tasks. }
-
- Procedure PreventWinTaskSwitch;
- { Disables ability to switch between tasks. }
-
- Procedure AllowWinTaskSwitch;
- { Restores ability to switch between tasks. }
-
- Function OpenWinClip : word;
- { Opens the clipboard
-
- Returns 0 if error
- }
-
- Function GetWinClipSize( FmtType : word ) : Longint;
- { Gets the size of data on the clipboard
-
- FmtType is one of : 1 : ASCII text
- 2 : BitMap
- 3 : MetaPictFile
- 4 : SYLK
- 5 : DIF
- 6 : TIFF
-
- Returns size of data on clipboard
- }
-
- Function GetWinClipData( Buffer : pointer; FmtType : word) : word;
- { Puts the data on the clipboard where Buffer points
-
- Buffer - points to a place to put the data
- FmtType - code for type of data to get
- Returns 0 if error
- }
-
- Function PutWinClipData( Buffer : pointer;
- FmtType : word;
- Length : Longint) : word;
- { Puts the data where Buffer is pointing on the clipboard
-
- Buffer - points to the place where the data should come from
- FmtType - code for type of data to get
- Length - how many bytes to get
- Returns 0 if error
-
- Make sure the data ends with a nul.
- }
-
- Function ClearWinClip : word;
- { Clears contents of the clipboard
-
- Returns 0 if error
- }
-
- Function CloseWinClip : word;
- { Closes the clipboard
-
- Returns 0 if error
- }
-
- { NOTE: When you use the windows clipboard, use the following general
- procedure:
-
- 1. Open the clipboard
- 2. Get the clipboard data size
- 3. Create a large enough buffer
- 4. Call the GetWinClipData function
- 5. Close the Clipboard
-
- Don't leave the clipboard open for any longer than it takes to get
- some data or to put some data because no other application can use
- the clipboard until you close it.
- }
-
- implementation
-
- Function RunningWin386(var Major, Minor : byte) : boolean;
- var
- Mjr, Mnr : byte;
- Begin
- asm
- MOV AX, 01600H
- INT 02FH
- MOV Mjr, AL
- MOV Mnr, AH
- end;
- case Mjr of
- $00, $80 : begin
- RunningWin386 := false;
- asm
- MOV AX, 04680H
- INT 02FH
- MOV Mjr, AL
- MOV Mnr, AH
- end;
- if (Mjr = 0) and (Mnr = 0) then { Win 3.0 in real or std mode }
- begin
- Major := 3;
- Minor := 0;
- end;
- end;
- $01, $FF : begin
- RunningWin386 := true;
- Major := 2;
- Minor := Mnr;
- end;
- else
- begin
- RunningWin386 := true;
- Major := Mjr;
- Minor := Mnr;
- end;
- end;
- End;
-
- Procedure ReleaseWinTimeSlice;
- Begin
- asm
- MOV AX, 01680H
- INT 02FH
- end;
- End;
-
- Procedure PreventWinTaskSwitch;
- Begin
- asm
- MOV AX, 01681H
- INT 02FH
- end;
- End;
-
- Procedure AllowWinTaskSwitch;
- Begin
- asm
- MOV AX, 01682H
- INT 02FH
- end;
- End;
-
- Function OpenWinClip : word; assembler;
- asm
- MOV AX, 01701H
- INT 02FH
- end;
-
- Function GetWinClipSize( FmtType : word ) : Longint; assembler;
- asm
- MOV AX, 01704H
- MOV DX, FmtType
- INT 02FH
- end;
-
- Function GetWinClipData( Buffer : pointer; FmtType : word) : word; assembler;
- asm
- MOV DX, FmtType
- MOV AX, [BP + 10]
- MOV ES, AX
- MOV BX, [BP + 8]
- MOV AX, 01705H
- INT 02FH
- end;
-
- Function PutWinClipData( Buffer : pointer;
- FmtType : word;
- Length : Longint) : word; assembler;
- asm
- MOV DX, FmtType
- MOV AX, [BP + 14]
- MOV ES, AX
- MOV BX, [BP + 12]
- MOV SI, WORD PTR [BP + 8]
- MOV CX, WORD PTR [BP + 6]
- MOV AX, 01703H
- INT 02FH
- end;
-
- Function ClearWinClip : word; assembler;
- asm
- MOV AX, 01702H
- INT 02FH
- end;
-
- Function CloseWinClip : word; assembler;
- asm
- MOV AX, 01708H
- INT 02FH
- end;
-
- END.