16 bit to 32 bit executable in Windows 7 / 64

Discussion in 'Programmer's Corner' started by cmartinez, May 22, 2015.

  1. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,573
    2,537
    I have a very old Quick Basic program that I use to generate random numbers that is very useful for a certain application of mine.
    The problem is that the program runs in 16 bit mode, and is rejected by Windows 7 - 64 professional.
    I do not want to use DosBox, since that would complicate things, and I also do not want to use .NET since it would require downloading all the framework needed for that small program to run in any computer.

    Is there a Basic or VB-like language out there that I could use to write the code, compile, and generate a small executable in at least 32-bit mode, so that it could easily run in Win7/64 ?
    I don't need fancy dialog boxes or anything, I just want to run the program from the command prompt. The program would then report a series of calculated numbers
     
  2. DerStrom8

    Well-Known Member

    Feb 20, 2011
    2,428
    1,328
    Have you tried running the exe in compatibility mode? Not sure if this will help, just an initial thought.
     
  3. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,573
    2,537
    Win7/64 does not allow 16 bit programs to run, either in compatibility or as administrator.
    I'm not against using a graphical user interface, I'm willing to use dialog boxes if necessary. My only concern here is that I do not want to have to download an entire .NET framework whenever I want to use that program in a different computer
     
  4. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    You could use VBScript, though it is an interpreted language, it comes with Windows, but you will likely run into issues down the road with availability.

    If you want something compiled, you will run into the obsolescence issue you are currently having in the future.
     
  5. DerStrom8

    Well-Known Member

    Feb 20, 2011
    2,428
    1,328
    Are you familiar with Java? There is a built-in Math library that has a "random" function. And Java applications are portable and cross-platform compatible. It is very easy to write a random number generator program in Java, and most computers already have Java installed.
     
    cmartinez and tshuck like this.
  6. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    That would be my plug too were it not for the desire to avoid having dependencies that may, or may not exist on a Windows machine.

    I'd still recommend it as a possibility though...
     
  7. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    Lots of things run using the .NET framework - you probably already have it installed and may not know it.
     
  8. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,573
    2,537
    I know what Java is... but I've never programmed a single line of code in it. Can Java be run as a simple terminal window?
    All I need to do is generate 3 numbers (whose equations I already know) and have the user input a 4th number. Then a small text file will be generated with the results.
    The numbers are all integers.
     
  9. DerStrom8

    Well-Known Member

    Feb 20, 2011
    2,428
    1,328
    You most certainly can run a java application in a terminal window. Considering what you're trying to do, you shouldn't need to worry about any external dependencies, so the program should be fully portable. The only concern would be creating the results text file in a specific directory, since directories are structured differently in Mac, Windows, and Linux. However, Java also has a built-in function to check what operating system is running it, and you can use a simple if/else statement to set the default directory.

    I'd offer to write it for you but I'm going camping this weekend and will not be back at a computer until Monday.
     
    cmartinez likes this.
  10. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    This has a dependency on having the Java Runtime Environment (JRE) on the computer.

    The odds of having the JRE installed in a computer is certainly less than having the .NET framework installed on a Windows machine.
     
    cmartinez likes this.
  11. DerStrom8

    Well-Known Member

    Feb 20, 2011
    2,428
    1,328
    Ah, I see what you mean. After working in Java for 3 years my definition of "dependency" is not exactly the same as yours :p

    I actually think you have a higher chance of having a JRE installed than .NET. Based on past experience, I gather that Java is used more than twice as much as .NET is, plus its cross-platform compatibility makes it a much better candidate for a wide variety of applications. As long as you don't mind having a lot of built-in libraries you don't need, it is really the best option in my opinion.
     
  12. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,573
    2,537
    Thanks for your very generous offer. I'll seriously consider waiting until monday for your help. It's an extremely easy program, but I'm completely unfamiliar with Java.
     
  13. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,573
    2,537
    Also, I'm under the impression that most browsers use java to access certain websites.
     
  14. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    In the sense that the OP would understand the phrase dependency, the JRE is a required piece of software for the program to run, not as in a library or external jar file, I should be more specific when talking with a programmer. ;)

    I just deployed a Java application I wrote to our group and found half if them did not have a JRE installed, but a .NET application I wrote last year found everyone had .NET 3.5 or higher already, but that may just be my experience.

    You can't neglect the Mono project when talking .NET portability. ;)

    Yes, I agree Java is probably the better option for future portability, just wanted to point out that a JRE is required software for it to run so cmartinez is aware.
     
    cmartinez and DerStrom8 like this.
  15. DerStrom8

    Well-Known Member

    Feb 20, 2011
    2,428
    1,328
    That gets into the realm of Java Server Pages, which are primarily what I was working with in my previous job with ADP. Simply put, JSPs allow the creation of dynamic webpages by manipulating the HTML with the Java language on the server-side computer. Then you have JavaScript, which is somewhat similar to Java but is NOT the same language. JS simply runs alongside HTML or JSPs to change the HTML or run operations on the client-side computer.
     
  16. DerStrom8

    Well-Known Member

    Feb 20, 2011
    2,428
    1,328
    You're right, for a program as simple as this I'm sure .NET would work just fine, but that assumes it will only be used on a PC. I know there are some open source third-party projects out there working to get .NET to run on different platforms, but to my knowledge none of them are all that dependable.

    Thanks for clarifying, you're absolutely right--cmartinez would need to ensure a JRE (Jave Runtime Environment) is installed on the computer before running the application.
     
  17. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    PureBasic is a native 32-bit and 64-bit programming language based on established BASIC rules.
    I haven't try it, maybe you can try.
     
    cmartinez likes this.
  18. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,573
    2,537
    Excellent suggestion, Scott. I'm already looking into it.
     
  19. cmartinez

    Thread Starter AAC Fanatic!

    Jan 17, 2007
    3,573
    2,537
    Do you know what the limitations of PureBasic's demo are?
     
  20. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,807
    834
    FreeBASIC! It will compile a working program on a 64-bit machine. It also has a QuickBASIC compatible mode, which will compile QuickBASIC code with minimal changes. The manual can be viewed here. And this page is where you download the compiler and IDE. There are two; I've used FB-IDE.
     
    ScottWang and cmartinez like this.
Loading...