Loading ...
Sorry, an error occurred while loading the content.

SV: [libertybasic] Re: Clipboard again

Expand Messages
  • Johan Arvidsson
    Thank you Mike This really helps :) ... From: Mike To: libertybasic@yahoogroups.com Sent: Wednesday, August 01, 2001 10:30 PM Subject: [libertybasic] Re:
    Message 1 of 1 , Jul 2, 2001
    • 0 Attachment
      Thank you Mike
      This really helps :)
      ----- Original Message -----
      From: Mike
      Sent: Wednesday, August 01, 2001 10:30 PM
      Subject: [libertybasic] Re: Clipboard again

      --- In libertybasic@y..., "Johan Arvidsson" <johan.p.arvidsson@h...>
      wrote:
      > Is there away to check when new items pops into the clipboard?
      >
      > Thanks

      Hi Johan,

      Checking for change of clipboard data and print new data to textbox
      This is how I implemented the requirement using LB commands, maybe
      there is an API to do this, I don't know.

      Regards, Mike

      nomainwin

      WindowWidth = 350 : WindowHeight = 150
      UpperLeftX=(dw-WindowWidth)/2: UpperLeftY=30

      Texteditor #w.pas, 1,1,0,0 ' hidden control for paste from clipboard
      textbox #w.tb1, 10,10,300,20
      statictext #w, "Copy something to the clipboard,",10,40,200,20
      statictext #w, "it will be pasted into the text box
      above.",10,60,200,20

      open "AutoPaste   Today's date:  "+date$() for window_nf as #w
      hndlwin=hwnd(#w)
      print  #w, "trapclose [quit]"

         ' window always on top
          toTop = (-1 or 0)      'OR the negative to call it in an API
          flags = _SWP_NOMOVE or _SWP_NOSIZE
          open "user" for dll as #user
          calldll #user, "SetWindowPos", _
              hndlwin as ushort, _
              toTop as short, _
              0 as short, _
              0 as short, _
              0 as short, _
              0 as short, _
              flags as ushort, _
              result as void
          close #user


      [AutoPaste]
      auto=1
      while auto=1
      print #w.pas, "!cls";   'clear hidden window
      print #w.pas, "!copy";  'clear clipboard
      'make sel$ equal to contents of #w.pas
      print #w.pas, "!contents? sel$"; 
      oldstrg$=sel$
      while sel$=oldstrg$ and auto=1
      timer 100, [L1]
      wait
      [L1]
          print #w.pas, "!paste";      'paste clipboard to hidden window
          print #w.pas, "!contents? sel$";    'set sel$
      wend  'keep checking clipboard at timer interval
            'till contents have changed

      timer 0            'stop timer whilst next command executes
          if sel$<>chr$(13)+chr$(10) then
                     print #w.tb1, sel$
          end if
      wend
      wait

      [quit]
      close #w
      end



      To unsubscribe from this group, send an email to:
      libertybasic-unsubscribe@egroups.com



      Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
    Your message has been successfully submitted and would be delivered to recipients shortly.