Mnemonics "O"

From CometWiki

(Difference between revisions)
Jump to: navigation, search
((Open Clipboard))
m (Page was formatted horribly -- re did page layout)
Line 1: Line 1:
== (Open Clipboard)==
== (Open Clipboard)==
-
<pre>
+
<table cellpadding=5 cellspacing=2>
 +
<td>'''Mnemonic:'''</td><td>''' (OpenClipboard)'''</td>
 +
</tr>
 +
<tr>
 +
<td>
 +
'''Discussion:'''
 +
<td>This mnemonic was added (along with CloseClipboard) to solve the problem where the clipboard may be unavailable because it is in use by another program (the clipboard can be opened by only one program at a time). If the clipboard was already in use the other clipboard functions would fail. Using this mnemonic you can ensure that the clipboard is available and remains open while you complete your desired operation.
 +
</td>
 +
<tr>
 +
<td>
 +
'''Note:'''
 +
<td>(OpenClipboard) is currently supported only in Comet32 and only when using the "X00", system device for clipboard access as demonstrated below.
 +
</tr>
 +
<tr>
 +
<td>
 +
'''Example:'''
 +
<td>
 +
Length  254 & Local RESULT$      ! Define a variable
 +
Length 10.0 & Local ClipErr
-
Mnemonic: (OpenClipboard)
+
Open (1) "X00"                  ! Open system driver
-
Discussion:  This mnemonic was added (along with CloseClipboard) to solve the
+
TryClipboardOpen:
-
          problem where the clipboard may be unavailable because it is in
+
  Print (1) (OpenClipboard)     ! Copy data from clipboard
-
          use by another program (the clipboard can be opened by only one
+
  Input (1) Result$              ! to this variable
-
          program at a time). If the clipboard was already in use the other
+
-
          clipboard functions would fail. Using this mnemonic you can ensure
+
  ClipErr = IHexDec(Result$)
-
          that the clipboard is available and remains open while you complete
+
  If (ClipErr EQ 5) Goto TryClipboardOpen  ! This error indicates that the clipboard is in use
-
          your desired operation.
+
  If (ClipErr NE 0) Goto ErrExit
-
Note: (OpenClipboard) is currently supported only in Comet32 and only when using
+
!
-
      the "X00", system device for clipboard access as demonstrated below.
+
! Do other clipboard operations
 +
!
-
Example 1:  LENGTH 254 & LOCAL RESULT$      ! Define a variable
+
   Print (1) (CloseClipboard)        ! We're done - close the clipboard
-
Length 10.0 & Local ClipErr
+
  Close (1)                         ! Close system driver
-
.
+
  Goto Exit
-
.
+
-
.
+
ErrExit:
-
Open (1) "X00"                  ! Open system driver
+
  Print "Error opening clipboard: ";ClipErr
-
 
+
Exit:
-
TryClipboardOpen:
+
  Stop
-
   Print (1) (OpenClipboard)        ! Copy data from clipboard
+
</table>
-
  Input (1) Result$                ! to this variable
+
-
 
+
-
  ClipErr = IHexDec(Result$)
+
-
  If (ClipErr EQ 5) Goto TryClipboardOpen  ! This error indicates that the clipboard is in use
+
-
  If (ClipErr NE 0) Goto ErrExit
+
-
.
+
-
. Do other clipboard operations
+
-
.
+
-
  Print (1) (CloseClipboard)    ! We're done - close the clipboard
+
-
Close (1)                       ! Close system driver
+
-
Goto Exit
+
-
 
+
-
ErrExit:
+
-
  Print "Error opening clipboard: ";ClipErr
+
-
 
+
-
Exit:
+
-
  Stop
+
-
</pre>
+

Revision as of 16:36, 28 November 2010

(Open Clipboard)

Mnemonic: (OpenClipboard)

Discussion:

This mnemonic was added (along with CloseClipboard) to solve the problem where the clipboard may be unavailable because it is in use by another program (the clipboard can be opened by only one program at a time). If the clipboard was already in use the other clipboard functions would fail. Using this mnemonic you can ensure that the clipboard is available and remains open while you complete your desired operation.

Note:

(OpenClipboard) is currently supported only in Comet32 and only when using the "X00", system device for clipboard access as demonstrated below.

Example:

Length  254 & Local RESULT$      ! Define a variable
Length 10.0 & Local ClipErr
Open (1) "X00"                   ! Open system driver
TryClipboardOpen:
  Print (1) (OpenClipboard)      ! Copy data from clipboard
  Input (1) Result$              ! to this variable

  ClipErr = IHexDec(Result$)
  If (ClipErr EQ 5) Goto TryClipboardOpen   ! This error indicates that the clipboard is in use
  If (ClipErr NE 0) Goto ErrExit
!
! Do other clipboard operations
!
 Print (1) (CloseClipboard)        ! We're done - close the clipboard
 Close (1)                         ! Close system driver
 Goto Exit

ErrExit:
  Print "Error opening clipboard: ";ClipErr
Exit:
  Stop
Personal tools