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

stay on top command

Expand Messages
  • ray10125
    I have a small program in liberty basic 3 and at times a side bar covers it. Is there a command, stay on top , in liberty basics. Thanks Ray
    Message 1 of 28 , Aug 1 9:37 AM
      I have a small program in liberty basic 3 and at times a side bar
      covers it. Is there a command, "stay on top", in liberty basics.
      Thanks Ray
    • rod_bird001
      ... Stylebits is what you probably need. This link discusses it but there are many good tutorials about stylebits. http://libertybasic.conforums.com/index.cgi?
      Message 2 of 28 , Aug 2 9:57 AM
        --- In libertybasic@yahoogroups.com, "ray10125" <ray10125@...> wrote:
        >
        > I have a small program in liberty basic 3 and at times a side bar
        > covers it. Is there a command, "stay on top", in liberty basics.
        > Thanks Ray
        >

        Stylebits is what you probably need. This link discusses it but there
        are many good tutorials about stylebits.

        http://libertybasic.conforums.com/index.cgi?
        board=api&action=display&num=1202025606&start=
      • David Speck
        I know that LB has a limit of about 70 meg total RAM to allocate between program code and variables. Is there an API call or DLL invocation that will indicate
        Message 3 of 28 , Aug 2 11:34 AM
          I know that LB has a limit of about 70 meg total RAM to allocate between
          program code and variables.

          Is there an API call or DLL invocation that will indicate either how
          much RAM is still available, or how much has been consumed?

          I'm writing a program that has several large graphics windows and lots
          of big arrays, and I'd like to know if I'm anywhere close to the limits.
          I started in the days when 64K was a lot of RAM, and every byte had to
          count.

          Thanks in advance,

          Dave
        • Lorne Russell
          To get window #main to stay on top (I copied this from somewhere a long time ago) handle=hwnd(#main) calldll #user32, GetParent ,_ handle as long,_ parent as
          Message 4 of 28 , Aug 2 11:37 AM
            To get window #main to stay on top (I copied this from somewhere a long time ago)

            handle=hwnd(#main)
            calldll #user32, "GetParent",_
            handle as long,_
            parent as long

            flags= _SWP_NOMOVE or _SWP_NOSIZE : ToTop= (-1 or 0)
            calldll #user32, "SetWindowPos",_
            parent as long,_ 'window handle
            ToTop as long,_ 'flag for desired position
            0 as long,_ 'new x location
            0 as long, _ 'new y location
            0 as long,_ 'new width
            0 as long,_ 'new height
            flags as long,_ 'SetWindowPosition attributes
            result as void 'no return


            Lorne




            ----- Original Message -----
            From: rod_bird001
            To: libertybasic@yahoogroups.com
            Sent: Saturday, August 02, 2008 9:57 AM
            Subject: [libertybasic] Re: stay on top command


            --- In libertybasic@yahoogroups.com, "ray10125" <ray10125@...> wrote:
            >
            > I have a small program in liberty basic 3 and at times a side bar
            > covers it. Is there a command, "stay on top", in liberty basics.
            > Thanks Ray
            >

            Stylebits is what you probably need. This link discusses it but there
            are many good tutorials about stylebits.

            http://libertybasic.conforums.com/index.cgi?
            board=api&action=display&num=1202025606&start=





            [Non-text portions of this message have been removed]
          • rod_bird001
            ... between ... how ... lots ... limits. ... had to ... The problem with an API call is that it will tell you how much memory is available to Liberty. That
            Message 5 of 28 , Aug 3 1:51 AM
              --- In libertybasic@yahoogroups.com, David Speck
              <MedelecInstruments@...> wrote:
              >
              > I know that LB has a limit of about 70 meg total RAM to allocate
              between
              > program code and variables.
              >
              > Is there an API call or DLL invocation that will indicate either
              how
              > much RAM is still available, or how much has been consumed?
              >
              > I'm writing a program that has several large graphics windows and
              lots
              > of big arrays, and I'd like to know if I'm anywhere close to the
              limits.
              > I started in the days when 64K was a lot of RAM, and every byte
              had to
              > count.
              >
              > Thanks in advance,
              >
              > Dave
              >


              The problem with an API call is that it will tell you how much memory
              is available to Liberty. That will usually be more than Liberty can
              handle. I have 2gb of ram and Windows always ensures there is at
              least half of the available memory available to Liberty, if you see
              what I mean. If it is just for your own use while developing the
              software perhaps the easiest way to see where you are is to use
              CtrlAltDel to start the task manager and then look under processes
              for Liberty.exe and read of the memory use.
            • Ray Williams
              My thanks to Lorne and Rod I have used both suggestions. I applied the code that Lorne sent and it worked perfectly Thanks again, Ray [Non-text portions of
              Message 6 of 28 , Aug 3 7:47 AM
                My thanks to Lorne and Rod I have used both suggestions.

                I applied the code that Lorne sent and it worked perfectly
                Thanks again,
                Ray

                [Non-text portions of this message have been removed]
              • laurie camion
                Can anyone point me to some code examples for serial communication? All I need is to read a line of data from a device that sends it at preset intervals (no
                Message 7 of 28 , Aug 4 5:09 PM
                  Can anyone point me to some code examples for serial communication? All I need is to read a line of data from a device that sends it at preset intervals (no handshake) and add it to a file (eventually into MySQL but that's phade II).
                   
                  TIA
















                  [Non-text portions of this message have been removed]
                • djmeyer55
                  This is a good one. http://greta.dhs.org/UBW/LB/UBW_Play/UBW_Play.html ... All I need is to read a line of data from a device that sends it at preset intervals
                  Message 8 of 28 , Aug 5 5:17 PM
                    This is a good one.

                    http://greta.dhs.org/UBW/LB/UBW_Play/UBW_Play.html


                    --- In libertybasic@yahoogroups.com, laurie camion
                    <lauriecam2006@...> wrote:
                    >
                    > Can anyone point me to some code examples for serial communication?
                    All I need is to read a line of data from a device that sends it at
                    preset intervals (no handshake) and add it to a file (eventually into
                    MySQL but that's phade II).
                    >  
                    > TIA
                    >
                    >
                    >
                    >
                    >
                    >
                    >
                    >
                    >
                    >
                    >
                    >
                    >
                    >
                    >
                    >
                    > [Non-text portions of this message have been removed]
                    >
                  • rod_bird001
                    ... Again with much more specific information you would get a much more specific answer. What does the message look like , is it fixed format or variable
                    Message 9 of 28 , Aug 6 12:38 AM
                      --- In libertybasic@yahoogroups.com, "djmeyer55" <djmeyer@...> wrote:
                      >
                      > This is a good one.
                      >
                      > http://greta.dhs.org/UBW/LB/UBW_Play/UBW_Play.html
                      >
                      >
                      > --- In libertybasic@yahoogroups.com, laurie camion
                      > <lauriecam2006@> wrote:
                      > >
                      > > Can anyone point me to some code examples for serial communication?
                      > All I need is to read a line of data from a device that sends it at
                      > preset intervals (no handshake) and add it to a file (eventually into
                      > MySQL but that's phade II).
                      > >  
                      > > TIA


                      Again with much more specific information you would get a much more
                      specific answer. What does the message look like , is it fixed format
                      or variable length, how often is it sent, does it have delimiters is it
                      truncated with crlf?

                      A simple start.

                      'open your com port, set "com2" to whatever you are using
                      open "com2:19200,n,8,1,ds0,cs0,rs" for random as #comm

                      'set a timer event to read the buffer every 100ms


                      timer 100,[getsample]
                      wait

                      [getsample]
                      t$ = input$(#comm, lof(#comm)) 'Get com port data
                      if t$ <> "" then print t$;" ";time$()
                      wait
                    • Gordon Sweet
                      Rod I have always wanted to send a file this way rather than a simple ASCII file or text from the keyboard. Gordon S. [Non-text portions of this message have
                      Message 10 of 28 , Aug 6 6:19 AM
                        Rod

                        I have always wanted to send a file this way rather than a simple ASCII file or text from the keyboard.

                        Gordon S.

                        [Non-text portions of this message have been removed]
                      • laurie camion
                        Thanks, I just needed some clues, which I now have. - On Wed, 8/6/08, rod_bird001 wrote: From: rod_bird001 Subject:
                        Message 11 of 28 , Aug 6 6:41 AM
                          Thanks, I just needed some clues, which I now have.

                          - On Wed, 8/6/08, rod_bird001 <rodbird@...> wrote:

                          From: rod_bird001 <rodbird@...>
                          Subject: [libertybasic] Re: Serial Comm Examples
                          To: libertybasic@yahoogroups.com
                          Date: Wednesday, August 6, 2008, 12:38 AM






                          --- In libertybasic@ yahoogroups. com, "djmeyer55" <djmeyer@... > wrote:
                          >
                          > This is a good one.
                          >
                          > http://greta. dhs.org/UBW/ LB/UBW_Play/ UBW_Play. html
                          >
                          >
                          > --- In libertybasic@ yahoogroups. com, laurie camion
                          > <lauriecam2006@ > wrote:
                          > >
                          > > Can anyone point me to some code examples for serial communication?
                          > All I need is to read a line of data from a device that sends it at
                          > preset intervals (no handshake) and add it to a file (eventually into
                          > MySQL but that's phade II).
                          > >  
                          > > TIA

                          Again with much more specific information you would get a much more
                          specific answer. What does the message look like , is it fixed format
                          or variable length, how often is it sent, does it have delimiters is it
                          truncated with crlf?

                          A simple start.

                          'open your com port, set "com2" to whatever you are using
                          open "com2:19200, n,8,1,ds0, cs0,rs" for random as #comm

                          'set a timer event to read the buffer every 100ms

                          timer 100,[getsample]
                          wait

                          [getsample]
                          t$ = input$(#comm, lof(#comm)) 'Get com port data
                          if t$ <> "" then print t$;" ";time$()
                          wait


















                          [Non-text portions of this message have been removed]
                        • laurie camion
                          OK, progress, modifying Rod s code below I can see the data :)   Next question. The device is sending a delimited, variable length, string terminated with a
                          Message 12 of 28 , Aug 7 9:17 AM
                            OK, progress, modifying Rod's code below I can see the data :)
                             
                            Next question. The device is sending a delimited, variable length, string terminated with a CRLF, at intervals of a few seconds to a few minutes. Can I get some suggestions of the best way to grab or accumulate whole data strings?
                             
                            TIA
                            --- On Wed, 8/6/08, rod_bird001 <rodbird@...> wrote:

                            From: rod_bird001 <rodbird@...>
                            Subject: [libertybasic] Re: Serial Comm Examples
                            To: libertybasic@yahoogroups.com
                            Date: Wednesday, August 6, 2008, 12:38 AM






                            --- In libertybasic@ yahoogroups. com, "djmeyer55" <djmeyer@... > wrote:
                            >
                            > This is a good one.
                            >
                            > http://greta. dhs.org/UBW/ LB/UBW_Play/ UBW_Play. html
                            >
                            >
                            > --- In libertybasic@ yahoogroups. com, laurie camion
                            > <lauriecam2006@ > wrote:
                            > >
                            > > Can anyone point me to some code examples for serial communication?
                            > All I need is to read a line of data from a device that sends it at
                            > preset intervals (no handshake) and add it to a file (eventually into
                            > MySQL but that's phade II).
                            > >  
                            > > TIA

                            Again with much more specific information you would get a much more
                            specific answer. What does the message look like , is it fixed format
                            or variable length, how often is it sent, does it have delimiters is it
                            truncated with crlf?

                            A simple start.

                            'open your com port, set "com2" to whatever you are using
                            open "com2:19200, n,8,1,ds0, cs0,rs" for random as #comm

                            'set a timer event to read the buffer every 100ms

                            timer 100,[getsample]
                            wait

                            [getsample]
                            t$ = input$(#comm, lof(#comm)) 'Get com port data
                            if t$ <> "" then print t$;" ";time$()
                            wait


















                            [Non-text portions of this message have been removed]
                          • laurie camion
                            Hmmm, my little compiled LB serial program works great on XP but gives a non continuable protection violation error on Server 2003 :-( [Non-text portions of
                            Message 13 of 28 , Aug 7 10:48 AM
                              Hmmm, my little compiled LB serial program works great on XP but gives a "non continuable protection violation" error on Server 2003 :-(
















                              [Non-text portions of this message have been removed]
                            • rod_bird001
                              ... gives a non continuable protection violation error on Server 2003 :-( I m tired, it s late I think you have been asked to post your code about twenty
                              Message 14 of 28 , Aug 7 2:29 PM
                                --- In libertybasic@yahoogroups.com, laurie camion <lauriecam2006@...>
                                wrote:
                                >
                                > Hmmm, my little compiled LB serial program works great on XP but
                                gives a "non continuable protection violation" error on Server 2003 :-(

                                I'm tired, it's late I think you have been asked to post your code
                                about twenty times. I can describe how long a piece of string is but it
                                gets boring. Post an example of your message and the code you are
                                trying to use to capture it.
                              • Joshua Walsh
                                I have no idea why you may get this message but how did you compile it? Could you please compile the following: [start] Subtotal=0 i=0 Print
                                Message 15 of 28 , Aug 7 9:23 PM
                                  I have no idea why you may get this message but how did you compile it?
                                  Could you please compile the following:

                                  [start]
                                  Subtotal=0
                                  i=0
                                  Print "************************Sales Log************************"
                                  print
                                  print "**********************Customer info**********************"
                                  LPrint "************************Sales Log************************"
                                  Lprint
                                  Lprint "**********************Customer info**********************"
                                  'Most of program created with the help of Freeform 3 v03-27-03
                                  'Generated on Apr 28, 2007 at 18:13:41

                                  [setup.name.Window]
                                  '-----Begin code for #name
                                  WindowWidth = 230
                                  WindowHeight = 150
                                  UpperLeftX=int((DisplayWidth-WindowWidth)/2)
                                  UpperLeftY=int((DisplayHeight-WindowHeight)/2)

                                  '-----Begin GUI objects code
                                  TextboxColor$ = "white"
                                  textbox #window.textbox1, 5, 22, 215, 25
                                  statictext #window.statictext2, "First name", 75, 2, 65, 20
                                  statictext #window.statictext3, "Last name", 75, 47, 62, 20
                                  textbox #window.textbox4, 5, 67, 215, 25
                                  button #window.button5,"Ok ",[ok2], UL, 5, 92, 215, 25
                                  '-----End GUI objects code
                                  open "Customers name" for window as #window
                                  print #window, "font ms_sans_serif 10"
                                  wait
                                  [ok2]
                                  print #window.textbox1, "!contents? cusname1$";
                                  print #window.textbox4, "!contents? cusname2$";
                                  close #window
                                  print "**********************Products info**********************"
                                  Again$ = "Y"
                                  While (Again$ = "Y")
                                  i = i + 1
                                  '-----Begin code for #main
                                  WindowWidth = 310
                                  WindowHeight = 190
                                  UpperLeftX=int((DisplayWidth-WindowWidth)/2)
                                  UpperLeftY=int((DisplayHeight-WindowHeight)/2)

                                  '-----Begin GUI objects code
                                  button #main.button1,"Ok ",[ok], UL, 0, 132, 300, 25
                                  statictext #main.statictext2, "Product name", 100, 2, 83, 20
                                  TextboxColor$ = "white"
                                  textbox #main.textbox3, 5, 17, 295, 25
                                  statictext #main.statictext4, "Price (In Australian dollars)", 65, 42,
                                  160, 20
                                  textbox #main.textbox5, 5, 57, 295, 25
                                  statictext #main.statictext6, "Amount bought", 95, 82, 108, 20
                                  textbox #main.textbox7, 5, 102, 295, 25
                                  '-----End GUI objects code
                                  open "Product "; i ; "'s info" for window as #main
                                  print #main, "font ms_sans_serif 10"
                                  wait

                                  [ok]
                                  cls
                                  print #main.textbox3, "!contents? Proname$";
                                  Proname$(i) = Proname$
                                  print #main.textbox5, "!contents? Procost";
                                  Procost(i) = Procost
                                  print #main.textbox7, "!contents? Proamount";
                                  Proamount(i) = Proamount
                                  close #main
                                  Button #Window.yes, "Yes", [Yes], UL, 25, 25
                                  Button #Window.no, "no", [No], UL, 70, 25
                                  StaticText #Window.text, "Were there more products bought?", 1, 1, 250, 20
                                  Open "Were there more products bought?" for graphics as #Window
                                  If Proamount=0 Then
                                  i=i-1
                                  notice "This product has been removed from the list as none were bought."
                                  End If
                                  wait
                                  [Yes]
                                  Again$ = "Y"
                                  CLOSE #Window
                                  Wend
                                  [No]
                                  Again$ = "N"
                                  CLOSE #Window

                                  PRINT "****************Sales made by "; cusname1$ ; " "; cusname2$ ;
                                  "****************"
                                  Lprint "Sales made by "; cusname1$ ; " "; cusname2$
                                  for i = 1 to i
                                  If Proamount(i) > 1 Then
                                  s$ = "s"
                                  Else
                                  s$=""
                                  End If
                                  print cusname1$ ; " bought " ; Proamount(i) ; " " ; Proname$(i) ;s$; "
                                  at $" ; Procost(i) ; " each."
                                  prototal = Procost(i) * Proamount(i)
                                  print "Total price for " ; Proname$(i) ; " is: AUS $" ; prototal
                                  Subtotal = Subtotal + prototal
                                  Print
                                  Print
                                  Print
                                  Print
                                  next i
                                  for i = 1 to i
                                  Lprint cusname1$ ; " bought " ; Proamount(i) ; " " ; Proname$(i) ;"(s)
                                  at $" ; Procost(i) ; " each."
                                  prototal = Procost(i) * Proamount(i)
                                  Lprint "Total price for " ; Proname$(i) ; " is: AUS $" ; prototal
                                  Lprint ""
                                  Lprint ""
                                  next i
                                  Print "***********************Total Prices***********************"
                                  print "Subtotal:$" ; Subtotal
                                  GST = Subtotal/10
                                  Print "GST:$" ; GST
                                  Total = Subtotal + GST
                                  PRINT "Total:AUS $" ; Total
                                  Lprint "***********************Total Prices***********************"
                                  Lprint "Subtotal:$" ; Subtotal
                                  GST = Subtotal/10
                                  Lprint "GST:$" ; GST
                                  Total = Subtotal + GST
                                  Lprint "Total:AUS $" ; Total

                                  Print
                                  print
                                  print
                                  Input "Press enter to continue."; null
                                  Button #Window2.yes, "Yes", [Yes2], UL, 25, 25
                                  Button #Window2.no, "no", [No2], UL, 70, 25
                                  StaticText #Window2.text, "Were there more customers?", 1, 1, 250, 20
                                  Open "Were there more customers?" for graphics as #Window2
                                  wait
                                  [No2]
                                  close #Window2
                                  Print
                                  print
                                  print
                                  Input "Press enter to close" ; null
                                  Dump
                                  Cls
                                  End
                                  End

                                  [Yes2]
                                  CLOSE #Window2
                                  Print
                                  Print
                                  Print
                                  Print
                                  Print
                                  Print
                                  Print
                                  Print
                                  Goto [start]




                                  On Fri, Aug 8, 2008 at 3:48 AM, laurie camion <lauriecam2006@...>wrote:

                                  > Hmmm, my little compiled LB serial program works great on XP but gives a
                                  > "non continuable protection violation" error on Server 2003 :-(
                                  >
                                  > [Non-text portions of this message have been removed]
                                  >
                                  >
                                  >


                                  [Non-text portions of this message have been removed]
                                • laurie camion
                                  I made a lot of progress, but I m sure you can tell me how to improve it:   open com1:4800, n,8,1,ds0, cs0,rs for random as #comm [starthere] timer
                                  Message 16 of 28 , Aug 8 9:59 AM
                                    I made a lot of progress, but I'm sure you can tell me how to improve it:
                                     
                                    open "com1:4800, n,8,1,ds0, cs0,rs" for random as #comm
                                    [starthere]
                                    timer 100,[syncup]
                                    wait

                                    'loop looking for LF
                                    [syncup]
                                    t$ = input$(#comm, 1) 'Get com port data
                                    'start collecting data when LF detected
                                    if t$ = chr$(10) then [datastart]
                                    wait
                                     
                                    'collect the data
                                    [datastart]
                                    dd$ = ""
                                    timer 100,[getdata]
                                    wait
                                    [getdata]
                                    t$ = input$(#comm, 1) 'Get com port data
                                    'print data when CR detected
                                    if t$ = chr$(13) then [printit]
                                    dd$ = dd$ + t$
                                    wait
                                     
                                    'print the complete dataset
                                    [printit]
                                    t$ = time$()
                                    d$ = date$("mm/dd/yyyy")
                                    print mid$(d$,4,2);"/";left$(d$,2);right$(d$,5);",";left$(t$,5);",";dd$
                                    goto [starthere]


                                    --- On Thu, 8/7/08, rod_bird001 <rodbird@...> wrote:

                                    From: rod_bird001 <rodbird@...>
                                    Subject: [libertybasic] Re: non continuable protection violation ??
                                    To: libertybasic@yahoogroups.com
                                    Date: Thursday, August 7, 2008, 2:29 PM






                                    --- In libertybasic@ yahoogroups. com, laurie camion <lauriecam2006@ ...>
                                    wrote:
                                    >
                                    > Hmmm, my little compiled LB serial program works great on XP but
                                    gives a "non continuable protection violation" error on Server 2003 :-(

                                    I'm tired, it's late I think you have been asked to post your code
                                    about twenty times. I can describe how long a piece of string is but it
                                    gets boring. Post an example of your message and the code you are
                                    trying to use to capture it.


















                                    [Non-text portions of this message have been removed]
                                  • zoomkat
                                    You probably should reset the timer back to 0 each time you use it, otherwise it runs in the background and will fire every 100ms even if you are in the middle
                                    Message 17 of 28 , Aug 8 11:22 AM
                                      You probably should reset the timer back to 0 each time you use it,
                                      otherwise it runs in the background and will fire every 100ms even if
                                      you are in the middle of collecting a string of data from the serial
                                      port.

                                      --- In libertybasic@yahoogroups.com, laurie camion
                                      <lauriecam2006@...> wrote:
                                      >
                                      > I made a lot of progress, but I'm sure you can tell me how to
                                      improve it:
                                      >  
                                      > open "com1:4800, n,8,1,ds0, cs0,rs" for random as #comm
                                      > [starthere]
                                      > timer 100,[syncup]
                                      > wait
                                      >
                                      > 'loop looking for LF
                                      > [syncup]
                                      > t$ = input$(#comm, 1) 'Get com port data
                                      > 'start collecting data when LF detected
                                      > if t$ = chr$(10) then [datastart]
                                      > wait
                                      >  
                                      > 'collect the data
                                      > [datastart]
                                      > dd$ = ""
                                      > timer 100,[getdata]
                                      > wait
                                      > [getdata]
                                      > t$ = input$(#comm, 1) 'Get com port data
                                      > 'print data when CR detected
                                      > if t$ = chr$(13) then [printit]
                                      > dd$ = dd$ + t$
                                      > wait
                                      >  
                                      > 'print the complete dataset
                                      > [printit]
                                      > t$ = time$()
                                      > d$ = date$("mm/dd/yyyy")
                                      > print
                                      mid$(d$,4,2);"/";left$(d$,2);right$(d$,5);",";left$(t$,5);",";dd$
                                      > goto [starthere]
                                      >
                                      >
                                      > --- On Thu, 8/7/08, rod_bird001 <rodbird@...> wrote:
                                      >
                                      > From: rod_bird001 <rodbird@...>
                                      > Subject: [libertybasic] Re: non continuable protection violation ??
                                      > To: libertybasic@yahoogroups.com
                                      > Date: Thursday, August 7, 2008, 2:29 PM
                                      >
                                      >
                                      >
                                      >
                                      >
                                      >
                                      > --- In libertybasic@ yahoogroups. com, laurie camion
                                      <lauriecam2006@ ...>
                                      > wrote:
                                      > >
                                      > > Hmmm, my little compiled LB serial program works great on XP but
                                      > gives a "non continuable protection violation" error on Server
                                      2003 :-(
                                      >
                                      > I'm tired, it's late I think you have been asked to post your code
                                      > about twenty times. I can describe how long a piece of string is
                                      but it
                                      > gets boring. Post an example of your message and the code you are
                                      > trying to use to capture it.
                                      >
                                      >
                                      >
                                      >
                                      >
                                      >
                                      >
                                      >
                                      >
                                      >
                                      >
                                      >
                                      >
                                      >
                                      >
                                      >
                                      >
                                      >
                                      > [Non-text portions of this message have been removed]
                                      >
                                    • laurie camion
                                      Thanks for the tip. I am somewhat confused about the timer, I ll work on it. I tried using the pause code in the help instead but that burns CPU. ... From:
                                      Message 18 of 28 , Aug 8 4:42 PM
                                        Thanks for the tip. I am somewhat confused about the timer, I'll work on it. I tried using the pause code in the help instead but that burns CPU.

                                        --- On Fri, 8/8/08, zoomkat <Zoomkat@...> wrote:

                                        From: zoomkat <Zoomkat@...>
                                        Subject: [libertybasic] Re: non continuable protection violation ??
                                        To: libertybasic@yahoogroups.com
                                        Date: Friday, August 8, 2008, 11:22 AM






                                        You probably should reset the timer back to 0 each time you use it,
                                        otherwise it runs in the background and will fire every 100ms even if
                                        you are in the middle of collecting a string of data from the serial
                                        port.

                                        --- In libertybasic@ yahoogroups. com, laurie camion
                                        <lauriecam2006@ ...> wrote:
                                        >
                                        > I made a lot of progress, but I'm sure you can tell me how to
                                        improve it:
                                        >  
                                        > open "com1:4800, n,8,1,ds0, cs0,rs" for random as #comm
                                        > [starthere]
                                        > timer 100,[syncup]
                                        > wait
                                        >
                                        > 'loop looking for LF
                                        > [syncup]
                                        > t$ = input$(#comm, 1) 'Get com port data
                                        > 'start collecting data when LF detected
                                        > if t$ = chr$(10) then [datastart]
                                        > wait
                                        >  
                                        > 'collect the data
                                        > [datastart]
                                        > dd$ = ""
                                        > timer 100,[getdata]
                                        > wait
                                        > [getdata]
                                        > t$ = input$(#comm, 1) 'Get com port data
                                        > 'print data when CR detected
                                        > if t$ = chr$(13) then [printit]
                                        > dd$ = dd$ + t$
                                        > wait
                                        >  
                                        > 'print the complete dataset
                                        > [printit]
                                        > t$ = time$()
                                        > d$ = date$("mm/dd/ yyyy")
                                        > print
                                        mid$(d$,4,2) ;"/";left$ (d$,2);right$ (d$,5);", ";left$(t$ ,5);",";dd$
                                        > goto [starthere]
                                        >
                                        >
                                        > --- On Thu, 8/7/08, rod_bird001 <rodbird@... > wrote:
                                        >
                                        > From: rod_bird001 <rodbird@... >
                                        > Subject: [libertybasic] Re: non continuable protection violation ??
                                        > To: libertybasic@ yahoogroups. com
                                        > Date: Thursday, August 7, 2008, 2:29 PM
                                        >
                                        >
                                        >
                                        >
                                        >
                                        >
                                        > --- In libertybasic@ yahoogroups. com, laurie camion
                                        <lauriecam2006@ ...>
                                        > wrote:
                                        > >
                                        > > Hmmm, my little compiled LB serial program works great on XP but
                                        > gives a "non continuable protection violation" error on Server
                                        2003 :-(
                                        >
                                        > I'm tired, it's late I think you have been asked to post your code
                                        > about twenty times. I can describe how long a piece of string is
                                        but it
                                        > gets boring. Post an example of your message and the code you are
                                        > trying to use to capture it.
                                        >
                                        >
                                        >
                                        >
                                        >
                                        >
                                        >
                                        >
                                        >
                                        >
                                        >
                                        >
                                        >
                                        >
                                        >
                                        >
                                        >
                                        >
                                        > [Non-text portions of this message have been removed]
                                        >


















                                        [Non-text portions of this message have been removed]
                                      • rod_bird001
                                        Two approaches, one checks very 100ms the other more lazily checks every second. In both cases you will need to think about how you stop or leave the process.
                                        Message 19 of 28 , Aug 10 9:29 AM
                                          Two approaches, one checks very 100ms the other more lazily checks
                                          every second. In both cases you will need to think about how you stop
                                          or leave the process. When you do remember to switch the timer off. I
                                          suspect that was all that was wrong with your first code though you
                                          were reading the buffer even if it was empty.

                                          open "com1:4800, n,8,1,ds0, cs0,rs" for random as #comm
                                          [starthere]
                                          timer 100,[syncup]
                                          wait

                                          'loop looking for LF
                                          [syncup]
                                          if lof(#comm)>0 then t$ = input$(#comm, 1) 'Get com port data
                                          'start collecting data when LF detected
                                          if t$ = chr$(10) then [datastart]
                                          wait

                                          'collect the data
                                          [datastart]
                                          dd$ = ""
                                          timer 100,[getdata]
                                          wait
                                          [getdata]
                                          if lof(#comm)>0 then t$ = input$(#comm, 1) 'Get com port data
                                          'print data when CR detected
                                          if t$ = chr$(13) then [printit]
                                          dd$ = dd$ + t$
                                          wait

                                          'print the complete dataset
                                          [printit]
                                          timer 0
                                          t$ = time$()
                                          d$ = date$("mm/dd/yyyy")
                                          print
                                          mid$(d$,4,2);"/";left$(d$,2);right$(d$,5);",";left$(t$,5);",";dd$
                                          'start the syncup timer again
                                          timer 100,[syncup]
                                          wait








                                          open "com1:4800, n,8,1,ds0, cs0,rs" for random as #comm
                                          delimit$=chr$(10)+chr$(13)
                                          [starthere]
                                          timer 1000,[getbuffercontents]
                                          wait

                                          'if there is something in the buffer add it to temp$
                                          [getbuffercontents]
                                          if lof(#comm)>0 then
                                          temp$=temp$+input$(#comm, lof(#comm))
                                          end if

                                          'now parse the temp$ string and split it if lfcr found
                                          [parseit]
                                          delimitpos=instr(temp$,delimit$,0)
                                          if delimitpos>0 then
                                          dd$=left$(temp$,delimitpos)
                                          temp$=right$(temp$,len(temp$)-delimitpos)

                                          'print the complete message
                                          [printit]
                                          t$ = time$()
                                          d$ = date$("mm/dd/yyyy")
                                          print
                                          mid$(d$,4,2);"/";left$(d$,2);right$(d$,5);",";left$(t$,5);",";dd$
                                          end if

                                          'now sit and wait for the next timer call to [getbuffercontents]
                                          wait
                                        • laurie camion
                                          Great, thanks for that, very helpful. Mine did actually work but I can see how your changes clean up/improve it :)   The second version would need some extra
                                          Message 20 of 28 , Aug 10 3:22 PM
                                            Great, thanks for that, very helpful. Mine did actually work but I can see how your changes clean up/improve it :)
                                             
                                            The second version would need some extra work. There's no sync between the unit and the PC so it's possible to open the port in the middle of a data record, or get multiple records in the buffer. I tried something like that initially but went with the single character read instead.
                                             
                                            Cool. Onward to a simple gui now...

                                            --- On Sun, 8/10/08, rod_bird001 <rodbird@...> wrote:

                                            From: rod_bird001 <rodbird@...>
                                            Subject: [libertybasic] Re: non continuable protection violation ??
                                            To: libertybasic@yahoogroups.com
                                            Date: Sunday, August 10, 2008, 9:29 AM






                                            Two approaches, one checks very 100ms the other more lazily checks
                                            every second. In both cases you will need to think about how you stop
                                            or leave the process. When you do remember to switch the timer off. I
                                            suspect that was all that was wrong with your first code though you
                                            were reading the buffer even if it was empty.

                                            open "com1:4800, n,8,1,ds0, cs0,rs" for random as #comm
                                            [starthere]
                                            timer 100,[syncup]
                                            wait

                                            'loop looking for LF
                                            [syncup]
                                            if lof(#comm)>0 then t$ = input$(#comm, 1) 'Get com port data
                                            'start collecting data when LF detected
                                            if t$ = chr$(10) then [datastart]
                                            wait

                                            'collect the data
                                            [datastart]
                                            dd$ = ""
                                            timer 100,[getdata]
                                            wait
                                            [getdata]
                                            if lof(#comm)>0 then t$ = input$(#comm, 1) 'Get com port data
                                            'print data when CR detected
                                            if t$ = chr$(13) then [printit]
                                            dd$ = dd$ + t$
                                            wait

                                            'print the complete dataset
                                            [printit]
                                            timer 0
                                            t$ = time$()
                                            d$ = date$("mm/dd/ yyyy")
                                            print
                                            mid$(d$,4,2) ;"/";left$ (d$,2);right$ (d$,5);", ";left$(t$ ,5);",";dd$
                                            'start the syncup timer again
                                            timer 100,[syncup]
                                            wait

                                            open "com1:4800, n,8,1,ds0, cs0,rs" for random as #comm
                                            delimit$=chr$ (10)+chr$ (13)
                                            [starthere]
                                            timer 1000,[getbuffercont ents]
                                            wait

                                            'if there is something in the buffer add it to temp$
                                            [getbuffercontents]
                                            if lof(#comm)>0 then
                                            temp$=temp$+ input$(#comm, lof(#comm))
                                            end if

                                            'now parse the temp$ string and split it if lfcr found
                                            [parseit]
                                            delimitpos=instr( temp$,delimit$ ,0)
                                            if delimitpos>0 then
                                            dd$=left$(temp$ ,delimitpos)
                                            temp$=right$ (temp$,len( temp$)-delimitpo s)

                                            'print the complete message
                                            [printit]
                                            t$ = time$()
                                            d$ = date$("mm/dd/ yyyy")
                                            print
                                            mid$(d$,4,2) ;"/";left$ (d$,2);right$ (d$,5);", ";left$(t$ ,5);",";dd$
                                            end if

                                            'now sit and wait for the next timer call to [getbuffercontents]
                                            wait


















                                            [Non-text portions of this message have been removed]
                                          • Ron Spruell
                                            Gordon, are you getting double posts? I have been and I think I asked one time if anyone else was but don t remember if I got a reply. Don t think I did but I
                                            Message 21 of 28 , Aug 10 5:03 PM
                                              Gordon, are you getting double posts? I have been and I think I asked one
                                              time if anyone else was but don't remember if I got a reply. Don't think I
                                              did but I am subscribed to two different Liberty Basic forums so if they
                                              were combined, that's the problem. Just wondering because I try and save
                                              really good tips and I have to weed thru to delete the double post. Would be
                                              easier if I could get the double postings stopped.<BG>



                                              Ron Spruell Sr.



                                              From: libertybasic@yahoogroups.com [mailto:libertybasic@yahoogroups.com] On
                                              Behalf Of Gordon Sweet
                                              Sent: Wednesday, August 06, 2008 8:19 AM
                                              To: libertybasic@yahoogroups.com
                                              Subject: [libertybasic] Re: Serial Comm Examples



                                              Rod

                                              I have always wanted to send a file this way rather than a simple ASCII file
                                              or text from the keyboard.

                                              Gordon S.

                                              [Non-text portions of this message have been removed]





                                              [Non-text portions of this message have been removed]
                                            • Stefan Pendl
                                              ... You can use TXCOUNT(#ComPort) to receive the number of bytes in the buffer, if the buffer is empty, wait for a second and check again. You need to read the
                                              Message 22 of 28 , Aug 13 1:46 AM
                                                >
                                                > OK, progress, modifying Rod's code below I can see the data :)
                                                >  
                                                > Next question. The device is sending a delimited, variable
                                                > length, string terminated with a CRLF, at intervals of a few
                                                > seconds to a few minutes. Can I get some suggestions of the
                                                > best way to grab or accumulate whole data strings?
                                                >  

                                                You can use TXCOUNT(#ComPort) to receive the number of bytes in the buffer, if the buffer is empty, wait for a second and check
                                                again.
                                                You need to read the buffer and append the content to a variable until CRLF [chr$(13)+chr$(10)] is encountered.

                                                '---code start (watch for line wraps)
                                                CRLF$ = chr$(13) + chr$(10)

                                                open "COM1:..." for random as #comport

                                                [CheckBuffer]
                                                timer 0

                                                if txcount(#comport) > 0 then
                                                content$ = content$ + input$(#comport, lof(#comport))

                                                if instr(content$, CRLF$) > 0 then
                                                'get data stream till first CRLF
                                                datastream$ = word$(content$, 1, CRLF$)

                                                'save remaining data to be processed the next time
                                                content$ = mid$(content$, instr(content$, CRLF$) + len(CRLF$))

                                                'process the data
                                                end if
                                                end if

                                                timer 1000, [CheckBuffer]
                                                wait
                                                '---code end

                                                ---
                                                Stefan Pendl
                                              • Stefan Pendl
                                                ... See the following demo for getting the current memory usage of the current process. For an explanation read the links include in the demo. ---code start
                                                Message 23 of 28 , Aug 13 4:58 AM
                                                  >
                                                  > I know that LB has a limit of about 70 meg total RAM to
                                                  > allocate between
                                                  > program code and variables.
                                                  >
                                                  > Is there an API call or DLL invocation that will indicate either how
                                                  > much RAM is still available, or how much has been consumed?
                                                  >

                                                  See the following demo for getting the current memory usage of the current process.
                                                  For an explanation read the links include in the demo.

                                                  '---code start (watch for line wraps)
                                                  'get process memory size
                                                  '
                                                  'http://msdn.microsoft.com/en-us/library/ms684895(VS.85).aspx
                                                  'http://msdn.microsoft.com/en-us/library/ms683219(VS.85).aspx
                                                  'http://msdn.microsoft.com/en-us/library/ms684877(VS.85).aspx
                                                  'http://msdn.microsoft.com/en-us/library/ms683179(VS.85).aspx

                                                  struct ProcessMemoryCounters, _
                                                  cb as ulong,_
                                                  PageFaultCount as ulong,_
                                                  PeakWorkingSetSize as ulong,_
                                                  WorkingSetSize as ulong,_
                                                  QuotaPeakPagedPoolUsage as ulong,_
                                                  QuotaPagedPoolUsage as ulong,_
                                                  QuotaPeakNonPagedPoolUsage as ulong,_
                                                  QuotaNonPagedPoolUsage as ulong,_
                                                  PagefileUsage as ulong,_
                                                  PeakPagefileUsage as ulong

                                                  ProcessMemoryCounters.cb.struct = len(ProcessMemoryCounters.struct)

                                                  open "psapi.dll" for dll as #psapi

                                                  calldll #kernel32, "GetCurrentProcess",_
                                                  hProcess as ulong

                                                  cb = len(ProcessMemoryCounters.struct)

                                                  calldll #psapi, "GetProcessMemoryInfo",_
                                                  hProcess as ulong,_
                                                  ProcessMemoryCounters as struct,_
                                                  cb as ulong,_
                                                  result as long

                                                  if result then
                                                  print "PageFaultCount ............... "; _
                                                  using("###########", ProcessMemoryCounters.PageFaultCount.struct)
                                                  print "PeakWorkingSetSize ........... "; _
                                                  using("###########", ProcessMemoryCounters.PeakWorkingSetSize.struct); " bytes"
                                                  print "WorkingSetSize ............... "; _
                                                  using("###########", ProcessMemoryCounters.WorkingSetSize.struct); " bytes"
                                                  print "QuotaPeakPagedPoolUsage ...... "; _
                                                  using("###########", ProcessMemoryCounters.QuotaPeakPagedPoolUsage.struct); " bytes"
                                                  print "QuotaPagedPoolUsage .......... "; _
                                                  using("###########", ProcessMemoryCounters.QuotaPagedPoolUsage.struct); " bytes"
                                                  print "QuotaPeakNonPagedPoolUsage ... "; _
                                                  using("###########", ProcessMemoryCounters.QuotaPeakNonPagedPoolUsage.struct); " bytes"
                                                  print "QuotaNonPagedPoolUsage ....... "; _
                                                  using("###########", ProcessMemoryCounters.QuotaNonPagedPoolUsage.struct); " bytes"
                                                  print "PagefileUsage ................ "; _
                                                  using("###########", ProcessMemoryCounters.PagefileUsage.struct); " bytes"
                                                  print "PeakPagefileUsage ............ "; _
                                                  using("###########", ProcessMemoryCounters.PeakPagefileUsage.struct); " bytes"
                                                  else
                                                  call DisplayError
                                                  end if

                                                  close #psapi
                                                  end

                                                  sub DisplayError
                                                  calldll #kernel32, "GetLastError", _
                                                  ErrorCode as ulong

                                                  dwFlags = _FORMAT_MESSAGE_FROM_SYSTEM
                                                  nSize = 1024
                                                  lpBuffer$ = space$(nSize); chr$(0)
                                                  dwMessageID = ErrorCode

                                                  calldll #kernel32, "FormatMessageA", _
                                                  dwFlags as ulong, _
                                                  lpSource as ulong, _
                                                  dwMessageID as ulong, _
                                                  dwLanguageID as ulong, _
                                                  lpBuffer$ as ptr, _
                                                  nSize as ulong, _
                                                  Arguments as ulong, _
                                                  result as ulong

                                                  print "Error "; ErrorCode; ": "; left$(lpBuffer$, result)
                                                  end sub
                                                  '---code end

                                                  ---
                                                  Stefan Pendl
                                                • Richard Russell
                                                  ... I thought TXCOUNT was about transmitting, not receiving. Are you sure you didn t mean LOF(#ComPort) ? Richard.
                                                  Message 24 of 28 , Aug 13 7:49 AM
                                                    --- In libertybasic@yahoogroups.com, "Stefan Pendl" wrote:
                                                    > You can use TXCOUNT(#ComPort) to receive the number of bytes in
                                                    > the buffer

                                                    I thought TXCOUNT was about transmitting, not receiving. Are you sure
                                                    you didn't mean LOF(#ComPort) ?

                                                    Richard.
                                                  • Stefan Pendl
                                                    ... Seems vacation washed away my last brain cells :-( Sure TXCOUNT() returns the number of bytes in the transmit queue. LOF() is the one that is needed. ...
                                                    Message 25 of 28 , Aug 13 8:13 AM
                                                      >
                                                      > --- In libertybasic@yahoogroups.com, "Stefan Pendl" wrote:
                                                      > > You can use TXCOUNT(#ComPort) to receive the number of bytes in
                                                      > > the buffer
                                                      >
                                                      > I thought TXCOUNT was about transmitting, not receiving. Are
                                                      > you sure you didn't mean LOF(#ComPort) ?
                                                      >

                                                      Seems vacation washed away my last brain cells :-(

                                                      Sure TXCOUNT() returns the number of bytes in the transmit queue.

                                                      LOF() is the one that is needed.

                                                      ---
                                                      Stefan Pendl
                                                    • rod_bird001
                                                      I m just amazed at how you pull these little gems out of the hat Stefan. Excellent.
                                                      Message 26 of 28 , Aug 13 1:32 PM
                                                        I'm just amazed at how you pull these little gems out of the hat
                                                        Stefan. Excellent.
                                                      • David Speck
                                                        Excellent, Stephan, Thank you very much. Just what I needed! Dave
                                                        Message 27 of 28 , Aug 13 1:42 PM
                                                          Excellent, Stephan,

                                                          Thank you very much. Just what I needed!

                                                          Dave

                                                          > See the following demo for getting the current memory usage of the current process.
                                                          > For an explanation read the links include in the demo.
                                                          >
                                                          >
                                                        • Stefan Pendl
                                                          ... It was more out of MSDN Library ;-) I knew that you can check the memory usage of a process, I just had to check MSDN Library for the API functions,
                                                          Message 28 of 28 , Aug 14 4:53 AM
                                                            >
                                                            > I'm just amazed at how you pull these little gems out of the hat
                                                            > Stefan. Excellent.
                                                            >

                                                            It was more "out of MSDN Library" ;-)

                                                            I knew that you can check the memory usage of a process, I just had to check MSDN Library for the API functions, that's all.

                                                            ---
                                                            Stefan Pendl
                                                          Your message has been successfully submitted and would be delivered to recipients shortly.