Announcement

Collapse
No announcement yet.

clipboard

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • clipboard

    Is it possible when running a PowerBasic DOS program under
    Windows to get an entire file into the clipboard? I'd like
    to use my PB DOS word processor, then cut an entire file
    into the clipboard so I can paste it into email. In other
    words, I'd like a Select All capability. All I can do now is
    cut one screen.

  • #2
    I suppose you are storing data as text (clipboard data format 1) on the clipboard. You should first test if there is enough memory available to hold your data:
    Code:
    FUNCTION ClipboardFree(BYVAL Bytes AS DWORD) AS DWORD
        DIM HBytes AS WORD
        DIM LBytes AS WORD
        HBytes = Bytes \ 65536  'cut dword in 2 words
        LBytes = Bytes - (HBytes * 65536)
        ! push  ds
        ! mov   ax, &H1709      ;compact clipboard
        ! mov   si, HBytes
        ! mov   cx, LBytes
        ! int   &H2F
        ! mov   HBytes, dx
        ! mov   LBytes, ax
        ! pop   ds
        FUNCTION = HBytes * 65536 + LBytes
    END FUNCTION
    The function has the amount of needed memory as input, and the available amount as output (the input value is used to re-arrange memory blocks).
    If you store text on the clipboard, be sure there are no CHR$(0) characters in it, since that will signal the end of data. I don't see another reason why only 'one page' can be cut to the clipboard.

    ------------------
    Sebastian Groeneveld
    mailto:[email protected][email protected]</A>
    Sebastian Groeneveld
    mailto:[email protected][email protected]</A>

    Comment


    • #3
      Jim, I assume you mean that you are using the Windows "copy" function on the visible DOS window? (ie, mouse-click|drag|enter)

      If you want to do it programmatically, check out some of the code posted to the ABC site, for example:
      http://www.basicguru.com/files/abc/abc9703/pbwinclp.bas


      ------------------
      Lance
      PowerBASIC Support
      mailto:[email protected][email protected]</A>
      Lance
      mailto:[email protected]

      Comment


      • #4
        Thanks for the reply.
        I just want to cut a few screens of text into the clipboard.
        There is plenty of memory. But how do I do it?
        DOS programs under Win98 only allow me to mark one page.
        Is there a PB function that will select and copy a file
        or an array to the clipboard? Thanks, Jim



        ------------------

        Comment


        • #5
          Not from within the IDE, sorry.

          ------------------
          Lance
          PowerBASIC Support
          mailto:[email protected][email protected]</A>
          Lance
          mailto:[email protected]

          Comment


          • #6
            Check out Boxer for DOS. I use it to make and compile my programs. It's clipboard is the same as windows. So when you copy stuff in BOXER it is also in the winodows clipboard at the same time.

            You can get Boxer at download.com.

            ------------------

            Comment

            Working...
            X