Announcement

Collapse
No announcement yet.

DOS to Windows

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

  • DOS to Windows

    Greetings:

    I'm a new registrant, so hopefully I have an age-old question...

    Is there any way that a compiled PB3.5 DOS app will run in a Windows 95 DOS window? My app uses a com port to dial clients and, when running in a full DOS window, does not "find" the com port. Beyond that, the app suspends executing completely while the DOS window is minimized, and then continues again when the DOS window is maximized.

    Obviously, I do not want to re-write my app in VB. Seems like someone should have figured out a solution to this type of problem already, since it would be a huge bridge between DOS and Windows.

    Any advice would be appreciated.

    Wayne

  • #2
    Hi Wayne,
    I have written PB 3.5 Serial Apps too that also do not work propperly under windows. The best solution that I can think of is to port your code over to PB's Console Compiler. This is a pretty easy port in most cases.


    ------------------
    Scott Slater
    Summit Computer Networks, Inc.
    www.summitcn.com

    Comment


    • #3
      Really, you've got two problems here. The easy one first. To allow your DOS program to run in the background, you can create a shortcut on the Windows Desktop and configure it properly. Create the shortcut, right-click it, and select Properties. Go to the Misc tab and make sure there is no checkmark in Always Suspend under Background. Your program should now run when minimized. (There are a few exceptions that will prevent the program from running when minimized; I recommend you get a good reference on running Windows 95/98 for more information).

      DOS serial communication programs sometimes have a hard time running under Windows. Specifically, if another program is using the serial port, Windows will prevent your program from detecting and using the serial port. Also, DOS programs can never use WinModems (sometimes called software modems). I have run lots of DOS communications software under Windows (including some written with PowerBASIC), and it works just fine.

      Alan

      ------------------
      Alan C. Earnshaw
      Information Management Systems, Inc.
      http://www.infoms.com
      Alan C. Earnshaw
      Information Management Systems, Inc.
      http://www.infoms.com

      Comment


      • #4
        I too have written DOS COMM's applications that run fine under Windows, but there are a few tricks and snags to be aware of.

        1. Windows often corrupts the flow of XON/XOFF software flow control data... always use CTS/RTS (hardware flow control) where possible.

        2. Hogging the com port... edit SYSTEM.INI and in the [enh386] section, add the following line: COMxAutoAssign=2 where x is the com port number. This is necessary in Win 3.x and Win95. (I'm not sure about it's effect in 98/ME in this respect).

        3. In timing-critical applications, you can tell windows that your task is a "critical section" (CS) and this halts Windows for the duration of the CS (note: this type of CS is different to a CS that a Windows programmer will come across).
        PBFax is a prime example of the need for a CS during the fax session - if Windows takes away too many CPU cycles, then it can destroy the fairly critical timing of the data flow.

        Here is an example of how to do it... (note that you do not want to use a CS for long periods of time or Windows may 'object')
        Code:
        IF BIT(pbvHost,8) THEN ' Signal Windows that this is a "Critical Section"
          ASM MOV AX,&H1681
          ASM INT &H2F
        END IF
         
        CALL PBFax(Fax)        ' Now fax the converted document.
        
        IF BIT(pbvHost,8) THEN ' Signal Windows to end the "Critical Section"
          ASM MOV AX,&H1682
          ASM INT &H2F
        END IF

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

        Comment


        • #5
          You may try Shirlun's method, use a dos/windows bridge to do
          communication tasks. you can get some information at this link:
          "www.freedomized.com/idoor/product/iserver/iserver.htm"

          yang.


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

          Comment


          • #6
            Just want to clarify someones post that DOS can NEVER use
            WinModems.... Dynalink 56k "winmodems" come with VIP software
            (installs as part of the modem driver)that maps com ports and
            irqs' with the windows driver thus enabling DOS programmes to
            use "winmodems". You can also download the software as a
            separate package (about $29US I think), I cant remember the
            address off the top of my head but its not hard to find!

            Comment


            • #7
              Does that price include royalty-free distribution rights? In other words, does the software need to be purchased separately for each installation or can I buy it and distribute it with my DOS applications. Also, does it work with other brands of WinModem's? I'd bet this emulation software does not provide Class 2 or Class 2.0 fax services either.

              IMHO, Winmodems are simply a false-economy for "real" data transfer work or faxing. There are plenty of "real" modems available and cost is not much more than a winmodem (at least that is how it is in New Zealand).



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

              Comment


              • #8
                Lance,

                Please define "long periods of time" in your post above. Milliseconds, minutes??
                Do you use it for the whole Faxing time, or break it up, so that WIN can have the control it so desperately needs!

                Does the CS notification work in Win9X?

                Thanks in advance.

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

                Comment


                • #9
                  I use it for the whole duration of the fax including dialing, and it seems to work fine under all versions of Win3x and Win9x. I've done preliminary testing under Win2K and it seems to work of there.

                  My tests were for single or two page faxes only, so at the most I've used a CS for around 2 minutes without any problems. I would not recommend doing that on a server though!

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

                  Comment


                  • #10
                    Originally posted by Scott Slater:
                    Hi Wayne,
                    I have written PB 3.5 Serial Apps too that also do not work propperly under windows. The best solution that I can think of is to port your code over to PB's Console Compiler. This is a pretty easy port in most cases.


                    Hello Mr. Slater,

                    Thank you for your reply to my posted question. I'm very interested in your solution where I can port my code over to PB's Console Compiler. I'm afraid I know nothing about this, so would you please let me know where I can get this?... Or simply having someone try porting it to test the results first? I'm very interested in getting my app to work in a DOS window without rewriting it. Any help toward this goal would be very much appreciated. Best Regards, Wayne

                    Comment


                    • #11
                      Serial comms in Windows is different to DOS, so you'll definitely need to rewrite portions of the code that perform port I/O.

                      Search the BBS for "COMM OPEN" and you should get some idea of how your code would look with PB/CC.



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

                      Comment

                      Working...
                      X