Announcement

Collapse
No announcement yet.

PowerBasic is Great!!!!!!!

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

  • Gösta H. Lovgren-2
    replied
    Code for PBWin

    Peter, you are phenomenal. I've updated your nifty code to work on PBWin:

    '
    Code:
           
    'PBWin 8.04  XP Pro(SP3)
    'http://www.powerbasic.com/support/pbforums/showthread.php?t=6468&highlight=modem+detection
    'by Peter Lameijn      'Changes by GHL
    '==================================================================================================
    ' Modem detection example. PST_xxx equates are in Winbase.h
    '==================================================================================================
    '==================================================================================================
    #Include "win32api.inc"
    Function PBMain () As Long
    Local lCnt&, lRet&, lComm&, lCommProp As CommProp, lCommName As Asciiz * 128,lVal As Long
    Local Ports_Found$
    '  Color 15,0
      For lCnt = 1 To 8
       lCommName = "COM" + Trim$(Str$(lCnt))
       lComm& = CreateFile (lCommName, _
                            %GENERIC_READ Or %GENERIC_WRITE, _
                            0, _
                            ByVal %Null, _
                            %OPEN_EXISTING, _
                            0, _
                            ByVal %Null)
        Reset lval '<<< necessary
        If (lComm& <> %INVALID_HANDLE_VALUE) Then
          lRet = GetCommModemStatus (lComm&,lVal)
          If lVal Then 
              Ports_Found$ =  Ports_Found$ & lCommName & $CrLf 
             CloseHandle lComm
          End If   
         Else
    '      Print lCommName + " - No such port"
          ? "%INVALID_HANDLE_VALUE",,"Bummer"
          Exit Function
        End If
      Next
      If Ports_Found$ > "" Then
         ? Ports_Found$,, "Modems Found" 
        Else
         ? "",, "No Modems Found"
      End If
    End Function
    '
    =============================================
    "Sex is not the answer. Sex is the question."
    "Yes" is the answer.
    Swami X
    =============================================
    Last edited by Gösta H. Lovgren-2; 11 Aug 2008, 10:03 PM.

    Leave a comment:


  • Lloyd Snyder
    replied
    In at least four of those post, I received no responses or
    only one. I eventually spent days writing code and testing
    it and answered my own question. (But very time consuming.)
    That's the fun of programming if you ask me...

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

    Leave a comment:


  • Lance Edmonds
    replied
    Unfortunately no.

    For a winmodem, you need to use the higher-level API's such as MAPI, TAPI, or RAS.

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

    Leave a comment:


  • Martin Francom
    replied
    Peter,
    I need to open a PCI (Win-Modem) and dial a phone number then
    after connecting transmit some data in a slave/master routine.
    Also, I need to set the modems speed to 2400 baud, with data
    compression and error correction turned off. Can you give me any
    suggestion or sample code that may help me accomplish this task?
    ...Marty

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

    Leave a comment:


  • Charles Dietz
    replied
    Peter,

    I still cannot get your code to detect my modem on commPort 4.
    The parameter lVal is zero for that port. I would like to get
    your code to work if possible.

    My code takes longer, but does detect my modem on port 4. I have
    a cheap, internal ISA modem installed on an ASUS motherboard with
    an AMD Athlon running at 550 mhz. I use Windows 98, 2nd ed. My
    modem has been a very reliable device and I would have thought that
    it should be easy to detect.



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

    Leave a comment:


  • Phil Tippit
    replied
    Peter,

    Great work, it found my modem on Com 3, Wow!!, what I have
    been looking for.

    Can you respond on the operating system you are on, I am
    running WIN95 on my test machine. Do it in the PBCC forum.

    We need to determine if it work on 98, NT and 2000.

    I'm going to move your reply to PBCC under the new thread.

    Thanks again,

    Phil




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

    Leave a comment:


  • Peter Lameijn
    replied
    It's strange but true. Sometimes my routine doesn't detect an ISA or PC-Card modem (although it should according to the API bible...) It worked for me with PCI modems. I've found another method that worked for me on all modems I could find.
    Strange enough not as it should (GetCommModemStatus should return non-zero on detection, but it doesn't always)
    But testing lVal works. It tests the presence of the Modem's registers, and returns non-zero if found. (value depends on the modem's state)
    Code:
    '==================================================================================================
    #Include "win32api.inc"
    Function PbMain () As Long
    Local lCnt&, lRet&, lComm&, lCommProp As CommProp, lCommName As Asciiz * 128,lVal As Long
      Color 15,0
      For lCnt = 1 To 8
       lCommName = "COM" + Trim$(Str$(lCnt))
       lComm& = CreateFile (lCommName, _
                            %GENERIC_READ Or %GENERIC_WRITE, _
                            0, _
                            ByVal %Null, _
                            %OPEN_EXISTING, _
                            0, _
                            ByVal %NULL)
        If (lComm& <> %INVALID_HANDLE_VALUE) Then
          lRet = GetCommModemStatus (lComm&,lVal)
          If lVal Then Print lCommName + " - Modem present" Else Print lCommName + " - Port"
          CloseHandle lComm
        Else
          Print lCommName + " - No such port"
        End If
      Next
      Print
      Print "Press any key..."
      WaitKey$
    End Function
    ------------------
    Kind regards,
    Peter.

    Leave a comment:


  • Phil Tippit
    replied
    Thanks Charles,

    I copied and pasted your code sample. I also have not been
    able to get Peter's code to work, but it looks like he taking
    the right avenue.

    My thoughts on this matter are somewhat similiar to your
    approach. Open each CommPort and initializing with ATZ and
    looking for the return answer of "OK".

    The three of us need to work on this problem, I think a standard
    function to find the Modem CommPort could be used by a lot of
    members.

    I will continue to play with Peter's code and also test yours
    to see what the results are.

    I am going to start a new thread on the subject, maybe we can
    get some more input on this matter. I'm going to put the
    subject in the PBCC forum.

    Thanks Again,

    Phil

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

    Leave a comment:


  • Charles Dietz
    replied
    Phil, regarding the detection of the modem commPort,

    I have included the following code which demonstrates the algorithm that I use.
    I haven't been able to get Peter's algorithm to work. It seems like it should
    work, and it is more elegant than mine. I would like to make his work.

    Code:
    #COMPILE EXE
    #DIM ALL
    #INCLUDE "win32api.inc"
    GLOBAL hWin AS LONG
    DECLARE CALLBACK FUNCTION winProc
    
    FUNCTION PBMAIN()AS LONG
       DIALOG NEW 0,"",,,120,90,%WS_SYSMENU TO hWin
       CONTROL ADD BUTTON, hWin, 100, "&Auto detect modem", 10, 10, 80, 20
       CONTROL ADD LABEL, hWin, 101, "", 10, 40, 90, 10
       DIALOG SHOW MODAL hWin&, CALL winProc
    END FUNCTION
    
    CALLBACK FUNCTION winProc
       LOCAL portNo AS INTEGER, i AS INTEGER
       LOCAL hComm AS LONG, commPort AS STRING
       LOCAL start AS SINGLE, n AS LONG, s AS STRING
       LOCAL fromModem AS STRING
       SELECT CASE CBMSG
          CASE %WM_COMMAND
             IF CBCTL = 100 THEN
                portNo = 0
                FOR i = 1 TO 4
                   hComm = FREEFILE
                   commPort = "COM" + TRIM$(STR$(i))
                   COMM OPEN commPort AS #hComm
                   IF ERRCLEAR THEN ITERATE FOR
                   COMM SET #hComm, BAUD = 9600
                   COMM SET #hComm, BYTE = 8
                   COMM SET #hComm, PARITY = 0
                   COMM SET #hComm, STOP = 0
                   COMM SET #hComm, RXBUFFER = 1024
                   COMM PRINT #hComm, "ATZ" + $CR
                   start = TIMER
                   DO
                      n = COMM(#hComm, RXQUE)
                      COMM RECV #hComm, n, fromModem
                      s = s + LCASE$(fromModem)
                      IF INSTR(s, "ok") THEN portNo = i: EXIT FOR
                      IF TIMER - start > 2 THEN ITERATE FOR
                   LOOP
                NEXT i
                IF portNo = 0 THEN
                   MSGBOX "Could not detect modem", %MB_ICONWARNING, "Modem Detection"
                ELSE
                   s = "Modem on Comm port" + STR$(portNo)
                   CONTROL SET TEXT hWin, 101, s
                END IF
                COMM CLOSE #hComm
             END IF
       END SELECT
    END FUNCTION

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

    Leave a comment:


  • Phil Tippit
    replied
    Peter,

    Thank you, for responding with the code. I copied and pasted
    it immediately to a file on my system. I have not had the time
    to test it yet, but it's looks like what I have wanted.
    If all is well, I can continue with the development of
    additional features to my current programs.

    As for other replies this thread has received, if I was rude to
    Stephane, I apologize. I just feel that he has posted enough
    wish lists about the same thing. Give Powerbasic a chance to
    work on it, they will come up with the answers, and they
    will be great as they always have been.

    If any of the members have questions about any of the
    following items, I will be more than happy to give my input:

    Julian Date,Time, and String Functions, or File Locking and
    Unlocking. All written in ASM and PowerBasic PBDLL60 and in a
    DLL. As for file locks and unlocks, I was writing code
    (when I was 38 years old) for this problem in 1980 in ASM 6502,
    on one of the first multi-user micro's on the market,
    OSI (Ohio Scientific,Inc.). By the way, OSI's basic language was
    Microsoft Basic written by Bill Gates prior to it's use by IBM.
    OSI paid him less than two thousand dollars for his code which
    they made modifications too. How that two thousand has grown!!!!!

    Again, thanks for your help, Peter.

    Again, I apologize to Stephane.

    Phil



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

    Leave a comment:


  • Peter Lameijn
    replied
    One way to detect a modem:
    Code:
    '==================================================================================================
    ' Modem detection example. PST_xxx equates are in Winbase.h
    '==================================================================================================
    #INCLUDE "win32api.inc"
    %PST_MODEM = &h00000006&
    FUNCTION PBMAIN () AS LONG
    LOCAL lRet&,lComm&,lCommProp AS CommProp
      COLOR 15,0
      lComm& = CreateFile("COM1",%GENERIC_READ OR %GENERIC_WRITE,0,BYVAL %Null,%OPEN_EXISTING,%FILE_FLAG_OVERLAPPED,BYVAL %NULL)
      IF lRet = %INVALID_HANDLE_VALUE THEN EXIT FUNCTION
      lRet = GetCommProperties(lComm&,lCommProp)
      IF lCommProp.dwProvSubType = %PST_MODEM THEN PRINT "Modem on Com 1"
      CloseHandle lComm&
      lComm& = CreateFile("COM2",%GENERIC_READ OR %GENERIC_WRITE,0,BYVAL %Null,%OPEN_EXISTING,%FILE_FLAG_OVERLAPPED,BYVAL %NULL)
      IF lRet = %INVALID_HANDLE_VALUE THEN EXIT FUNCTION
      lRet = GetCommProperties(lComm&,lCommProp)
      IF lCommProp.dwProvSubType = %PST_MODEM THEN PRINT "Modem on Com 2"
      CloseHandle lComm&
      lComm& = CreateFile("COM3",%GENERIC_READ OR %GENERIC_WRITE,0,BYVAL %Null,%OPEN_EXISTING,%FILE_FLAG_OVERLAPPED,BYVAL %NULL)
      IF lRet = %INVALID_HANDLE_VALUE THEN EXIT FUNCTION
      lRet = GetCommProperties(lComm&,lCommProp)
      IF lCommProp.dwProvSubType = %PST_MODEM THEN PRINT "Modem on Com 3"
      CloseHandle lComm&
      lComm& = CreateFile("COM4",%GENERIC_READ OR %GENERIC_WRITE,0,BYVAL %Null,%OPEN_EXISTING,%FILE_FLAG_OVERLAPPED,BYVAL %NULL)
      IF lRet = %INVALID_HANDLE_VALUE THEN EXIT FUNCTION
      lRet = GetCommProperties(lComm&,lCommProp)
      IF lCommProp.dwProvSubType = %PST_MODEM THEN PRINT "Modem on Com 4"
      CloseHandle lComm&
      WAITKEY$
    END FUNCTION
    ------------------
    Kind regards,
    Peter.

    Leave a comment:


  • Gregery D Engle
    replied
    Phil,

    I find this message board a huge value of resources, and not all of my questions have been answered but I come to this message board 10 or 20 times a day atleast, just to read the topics that are being discussed.

    I think everyone has his/her own opinion and I think respecting them is the first step to becoming a solid figure in the workforce. I know how it feels to have your feelings not respected because I work with someone that does that on a daily basis.

    Everyone has opinions, you don't have to like them, just respect them. As far as wishlists are concern, PowerBasic won't add EVERY SINGLE Wish that consumers have, but 3rd party companies will! Look at Chris Boss's product, do you think he would of made that product if nobody wanted it? He got feedback on these fourms. Eric's Product as well, because people want this stuff, obviouslly Powerbasic doesn't have the time to make all the requests people ask for, but thats fine because I would like to make a few bucks

    ------------------
    -Greg

    Leave a comment:


  • K Peel
    Guest replied
    Phil,
    I have not been around this forum lately (i'm very busy) but judging by your comments I think that you may not appreciate it as much as you should, I don't really care about random 'wants' by some people, such as Stephane, because the bulk of the information on this forum is genuinely useful. Almost, if not everything is covered, just imagine if there wasn't a forum here!

    Correct me if i'm wrong, but people like Lance and Tom (and many others) don't have to and aren't paid to answer posts but do so by their own free will.

    Actually I think this thread should be entitled 'PowerBasic are great!' to congratulate Bob Zale and the team for creating such a mean compiler and nice neat forum.

    Regards,


    ------------------
    Kev G Peel
    KGP Software
    Bridgwater, UK.
    mailto:[email protected][email protected]</A>

    [This message has been edited by K Peel (edited May 23, 2000).]

    Leave a comment:


  • Chris Boss
    replied
    Phil;

    I can understand your feelings about your own posts and not getting answers. This could be discouraging.

    Likely many see me post a great deal about subjects I have a passion for (Visual Development and stuff), but I (like many others) try to post answers to questions others have and even some times spend time trying debug others code to help find solutions to their problems. The problem is that I (like others) don't know everything, so likely I will only post an answer to a question that I am very sure about and have experience with.

    Likely others who post answers do the same (we don't want to give erroneous answers). It is possible you simply asked questions that others weren't comfortable answering (it does happen). If your level of skill is high, then it is possible you pose questions others just don't know the answer to (or it just isn't their area of expertese).

    Some members have developed a reputation for areas of expertese. Names like:

    Hutch - Expert with assembler
    Patrice - Expert with a lot of graphic oriented stuff (see WinLift)
    Semen - posts some very good API code

    and others.

    I am sure if the questions you post can be answered, someone will likely speak up. Also if we treat one another nicely, then we are likely to get more help.



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

    Leave a comment:


  • Eric Pearson
    replied
    Hi Phil --

    These are, after all, the "PowerBASIC Peer Support Forums". Those are the biggest words on the page!

    There's a group of people that visit here from time to time and answer the questions we can. And we also comment on messages when we feel like it. Nobody pays us, or tells us how often we have to read new messages, or how many answers we must post.

    If nobody responded to your question(s) then it's a good bet that...

    1) Nobody knew the answer, or

    2) Somebody knew the answer but did not take the time to respond.

    If you don't get a free answer here -- or in other web resorces like newsgroups -- about your only option is to hire a consultant. You can hire PowerBASIC support if you want to, for a fee. (To be clear, they frequently volunteer "free" answers here, but if they don't know and you really need an answer, they will research it for you, for a fee.)

    And IMO, the use of this BBS for things other than "current product questions" encourages a sense of community that actually increases peoples' willingness to volunteer their help.

    > Now back to the question,

    Your best bet is to start a new thread that isn't titled "PowerBASIC is Great!", since not everybody reads every message. For the record, I don't know the answer to your question.

    -- Eric

    ------------------
    Perfect Sync: Perfect Sync Development Tools
    Email: mailto:[email protected][email protected]</A>

    Leave a comment:


  • Phil Tippit
    replied
    OK Fellow Programmers,

    Here is my point again.

    Over the last year, I may have posted 10 questions to the
    PBDLL and PBCC forums total. They were questions that I
    had hoped someone could help me with. None were off base
    with the current products, that I needed a little help with.

    In at least four of those post, I received no responses or
    only one. I eventually spent days writing code and testing
    it and answered my own question. (But very time consuming.)

    I posted a question sometime ago, with regards to how to determine
    the com port that the modem was actually on. One response from
    Lance about some topics at Borland, which didn't answer my
    question. No other replies. I still have not found out the
    answer.

    Now, Stephane has posted 14 items to this forum and many others
    to PBCC forum about the same thing several times. Almost all
    of these have had multiple replies, some have as many as 4 pages.

    It seems that everytime someone posts a wishlist,
    it gets beat to death. There is a current thread on this forum
    about a wishlist that currently has 45 replies.

    ---------------------------------------------------------------
    My question about current product needs; still has not had a
    satifactory answer from anyone from Powerbasic or any of the
    members. But hundreds of replies have been made on these wish
    list post.
    ---------------------------------------------------------------

    I think we should let the people at Powerbasic spend their
    time answering questions about current products, And let
    R&D do what they need to do to enhance the current products.
    Wish List are great, but don't beat it to death!!! over and
    over again with the same stuff, I think Powerbasic by now
    has read these post, they certainly had posted enough replies
    to them.

    Other comments from Administrators and Members.

    Adam Ritchie: 3/4/2000
    -----------------------------------------------------------
    Not to sound rude, but I looked in almost all the forums
    and I think you have made your point. I think support is
    already aware of this and the subject has already been
    hashed and bashed about. There is a place on the website
    for submitting wishlists to the company.
    -----------------------------------------------------------

    Lance Edwards: 3/12/2000
    ----------------------------------------------------------
    According to his email, Stephane wants us to implement
    a form of static-libraries. Oh yes... and OOP.
    ----------------------------------------------------------

    Eric Pearson: 3/12/2000
    ----------------------------------------------------------
    Really? Are you sure? I don't know how you could have
    gotten that impression...
    ----------------------------------------------------------

    Dave Navarro: 3/13/2000
    -----------------------------------------------------------
    Hi Stephanel,

    Thanks I'll pass your request along.
    I have a request for you. Please post all of your "requests"
    in a single message in *ONE* forum on the BBS so that I don't
    have to keep sending individual emails to the development team.
    And PLEASE stop sending the same request over and over and over
    and over again. We heard you the first time.
    ------------------------------------------------------------
    Dave Navarro: on the PBCC forum
    -------------------------------------------------------------
    Stephane,
    As I have told you countless times on the phone and
    in email messages, we do plan to support OOP in a future
    version of PowerBASIC. Send us the same requests hundreds
    of times by email, posting them over and over again on our
    web site and calling us every other week is not going to get
    you anything any faster.
    Think about it.
    --------------------------------------------------------------

    ***************************************************************
    Now back to the question, can anyone help with how to
    determine what com port a modem is actually on?????????
    ***************************************************************
    Phil

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




    [This message has been edited by Phil Tippit (edited May 23, 2000).]

    Leave a comment:


  • Thierry Vanmarcke
    Guest replied
    ----------------------------------------------------------------
    We absolutely encourage our customers (and potential customers) to tell us what they like and dislike, what they want added or removed. Such posts are welcome to be posted her or can be sent directly to [email protected] .
    ----------------------------------------------------------------

    Maybe it would be interresting if someone from PB put an 'index' of everything people are asking for onto the forum. So then we can give each item a score. It would be easier to see for the people at pb what we really want (need) and what would be nice to add (if time permits)...

    Just a suggestion

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

    Leave a comment:


  • Borje Hagsten
    replied
    > Finally, I have to say that we have some exciting products
    > on the horizon!

    Aha..? Sounds promising, Lance. Maybe should dig up that PB
    job-offer from Bob and have another look at it after all..


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

    Leave a comment:


  • Lance Edmonds
    replied
    Folks, suggestions are _always_ welcome here. They open up disussion, and great ideas are often hatched. Remember, R&D do lurk on this BBS too, plus BBS administrators pass on these suggestions to R&D. R&D take all suggestions very seriously, and each one gets thoroughly debated before a decision is made. There is one critical question that is asked of every single feature request though: "Will people pay to have that feature?". Even if the answer is no, the suggestion is often put back into the "wish list" file, so it can have another chance of being implemented at a later date.

    That said, repeatedly asking for the same feature just wastes time and bandwidth. To date, requests for features such as OOP have been repeatedly posted on this BBS, through [email protected], direct email to PowerBASIC staff, and by telephone. We've got OOP on the list now, thanks!

    Other people may certainly ask for a "tick" to be added to features that have already been requested... The more ticks, the more likely the feature will be implemented as the "demand" can be considered statistically higher.

    As I stated earlier tonight in the DOS forum, each person is permitted one "vote" per suggestion. Otherwise it would not be fair to our customers if just one person voted 10,000 times for one particular feature - if R&D was to implement new features based on this type of voting, we'd end up with products that were not ideally suited to the widest range of programmers.

    We (PowerBASIC) absolutely respond to customers requests - that's the reason we continue to grow and why we continue to produce world-class compilers.

    We absolutely encourage our customers (and potential customers) to tell us what they like and dislike, what they want added or removed. Such posts are welcome to be posted her or can be sent directly to mailto:[email protected][email protected]</A> .

    I understand the concerns that members of this BBS have made regarding certain individuals posting habits, but we will not permit flaming or other behaviour that we consider counter-productive. PowerBASIC also reserves the right to edit and delete posts we deem inappropriate or blantantly break the rules of this BBS.

    Please folks, lets work together rather than against each other. Stephane is welcome to post his personal "wish list" here... we welcome it, but it should not duplicate suggestions he has already made on this BBS.

    Finally, I have to say that we have some exciting products on the horizon! The ideas behind these products stems directly from the feedback and suggestions we have received. Lets keep the ball rolling!

    Thank you.


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

    Leave a comment:


  • Steve Hutchesson
    replied
    Phil,

    Number one, I am very pleased to hear that you have had very good results
    with your rewrite of programs in the PowerBASIC compilers. I think you have
    joined many including myself who have found the advantages of using well
    written software.

    I am a little surprised at the comments about another member, if there is
    one thing I have enjoyed with this forum is the general level of experience
    and maturity of its members. Where you have programmers working on
    different problems on different types of software, you are bound to get
    differences of opinion from time to time.

    Now I join the other members who are willing to tolerate the odd message
    that annoys me because I see that a forum of this type needs to be open and
    friendly as it usually is. Perhaps you need to look at other systems on the
    Internet to see that it is reasonably unique and this is because the
    members have made it that way.

    The other part of the equation is that Bob Zale and his staff have both
    made this forum available and contributed to it in a manner that is unusual
    in the software industry. I cannot think of any other place where the
    person who writes the compiler also answers questions and has a staff of
    well experienced people to assist members.

    ========================================================================
    "I would hope that this forum could be used only for current product
    questions in the future."
    ========================================================================

    This would be a very substantial loss to the value of an open forum of this
    type where different contributors share their experiences and assist other
    programmers on the basis of the things they have already done. Losing this
    to make the forum a narrow product area would destroy it.

    I think I get the swing of your parting coments and I commend a person for
    being proud of their country but I suggest that you need to be a little
    tolerant of the differences with people from other countries as they have a
    different cultural and social background.

    For those of us who grew up in the land of OZ on a diet of Rock 'n Roll,
    (yours, ours and everyone elses), migrated to heavy metal and gave up in
    disgust when disco hit the scene, choice of music is a matter of personal
    taste and while your choice may work for you, its very difficult to
    translate that to people who are from another country.

    Regards and I hope you keep writing successful software.

    [email protected]

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

    Leave a comment:

Working...
X