VOGONS


First post, by robert2040

User metadata
Rank Newbie
Rank
Newbie

A number of years ago I wrote a program in Visual Basic 6 to act as a front end to an old 16-bit QBasic program. After setting up a bunch of variables, the Visual Basic 6 code launches the 16-bit program as a separate process and waits for its completion.

On Windows 7, 64-bit mode, the 16-bit program will not run. The Visual Basic 6 front end, however, still works fine.

Here is my question: Is it possible for my Visual Basic 6 program to launch DosBox (instead of my 16-bit program) and then have DosBox launch the 16-bit program? Perhaps by my using the DosBox autoexec feature. Or perhaps there’s a DosBox API available for this sort of thing.

Any information you can pass my way would be much appreciated.

Thank you.

Robert

Reply 1 of 12, by ADDiCT

User metadata
Rank Oldbie
Rank
Oldbie

There's no API, but you can pass parameters via the "autoexec" section in dosbox.conf, or create a batch that you call via "autoexec" and which then runs in DOSBox.

Reply 2 of 12, by robert2040

User metadata
Rank Newbie
Rank
Newbie

Thanks for the reply.

I was testing DosBox last night. Do you know whether DosBox can be launched completely invisibly? I know I can use the "-noconsole" option to hide that screen. But how about the main DosBox screen? Can that too be hidden easily?

Thanks.

Robert

Reply 3 of 12, by IIGS_User

User metadata
Rank Oldbie
Rank
Oldbie

I don't think it's possible to hide the main DOSBox screen because you need a reply about what happens within DOSBox.

Remember, DosGamesOnlyBox.

Klimawandel.

Reply 4 of 12, by robertmo

User metadata
Rank l33t++
Rank
l33t++

set sdl_videodriver=dummy

Reply 5 of 12, by robert2040

User metadata
Rank Newbie
Rank
Newbie

Thanks. But I tried to find sdl_videodriver documented, and I couldn't find it. Where does one set that parameter?

Reply 6 of 12, by robertmo

User metadata
Rank l33t++
Rank
l33t++

in environment variables

Reply 7 of 12, by robert2040

User metadata
Rank Newbie
Rank
Newbie

Which environment variables? Windows?

Reply 8 of 12, by robert2040

User metadata
Rank Newbie
Rank
Newbie

Let me be more specific in my question. You said I should set the following:

set sdl_videodriver=dummy

Do I set this in the DosBox configuration file or is this a Windows environment variable? Specificially, where do I set this?

Thank you.

Reply 9 of 12, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

windows, but why not try both yourself to see which one worked instead of posting here a few times.
This option would have given you the answer much faster.

Water flows down the stream
How to ask questions the smart way!

Reply 10 of 12, by robert2040

User metadata
Rank Newbie
Rank
Newbie

I'm a software developer. Of course I tried both before posting here. I also tried various launch methods within my code. None of them allowed me to launch DosBox fully hidden.

However, because of your last specific post, I realized that I had been using upper case for the environment variable. Usually in Windows, case doesn't matter. Anyway, I just tried it using lower case and it works now.

Thanks for your help.

Reply 11 of 12, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

ah yes, I had to repair dosbox in the past as well as we upcased the value by default as well when updating the emulated environment. was one game that wanted a lowcase value

Water flows down the stream
How to ask questions the smart way!

Reply 12 of 12, by cobol30

User metadata
Rank Newbie
Rank
Newbie

I am currently working on a dos game menu system, that runs with ScummVM, DosBox and DosBox using Windows 3.11. I am writing it in Visual Studio 2011, below is the method I use to start DosBox. This code starts DosBox without the console been shown, it also hides the form when DosBox is started, and reshows the form when DosBox terminates. I hope this helps.

Public Declare Function apiFindWindow Lib "user32" Alias "FindWindowA" (ByVal strClass As String, ByVal lpWindow As String) As Long
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Public Function IsProcessRunning(ByVal ProcessName As String) As Boolean
Dim WMIServicesObject As Object, WMIServicesItems As Object
IsProcessRunning = False
WMIServicesObject = GetObject("winmgmts:\\.\root\cimv2")
WMIServicesItems = WMIServicesObject.InstancesOf("Win32_Process")
For Each WMIServicesProcess As Object In WMIServicesItems
If (Trim(LCase(WMIServicesProcess.Caption)) = Trim(LCase(ProcessName))) Then IsProcessRunning = True
Next WMIServicesProcess
WMIServicesObject = Nothing
WMIServicesItems = Nothing
End Function

Public Sub StartGame()
Dim DosBoxParameters as string = "-noconsole -conf game.conf"
Dim DosboxExecutable as string = "c:\program files (x86)\dosbox\dosbox.exe"
Me.hide()
ShellExecute(apiFindWindow("OPUSAPP", "0"), "open", DosBoxExecutable, DosBoxParameters, Mid(DosBoxExecutable, 1, InStrRev(DosBoxExecutable, "\")), 0)
Do
Loop Until (IsProcessRunning(Mid(DosBoxExecutable, InStrRev(DosBoxExecutable, "\") + 1)) = False)
Me.Show()
End Sub