Serial Mouse Emulator

General information and assistance with DOSBox.

Serial Mouse Emulator

Postby videogamer555 » 2017-7-25 @ 06:50

I wrote this program in VB6. It uses Windows API to read raw HID (human interface device) data from the real USB mouse attached to your computer. By doing so, instead of getting the current cursor's position on the screen, it gets the x/y movement values sent from the actual mouse. And these are what is needed to generate a proper serial mouse data packet. From there it uses the Winsock ActiveX control to send the packet.

When the program first starts, it attempts to connect to IP address 127.0.0.1 and port 1234. After about one second, if no server program is listening on that port, my program closes. To make my program work with DosBox, use notepad and load your DosBox config file, and in the serial port configuration set serial port 1 to:
serial1=nullmodem port:1234
Then save the config file. Then start DosBox. After DosBox is running, start my serial mouse emulator. Then run a program that you know absolutely requires a serial mouse (such as Windows 1.0, and don't use the modded version that is actually using the Windows 2.0 PS2 mouse driver, or maybe play some really old game that requires a serial mouse). It should work perfectly, just as if you were using a real serial mouse. If you don't want to see both your real mouse cursor and the one in DosBox both at the same time, you can make DosBox grab your real cursor, which makes it disappear. To do this, press Ctrl+F10 in DosBox. Press Ctrl+F10 again to make DosBox release control of your real cursor.

Here's something to note. As my serial mouse emulator uses the Winsock ActiveX control for the TCP connection, you will need to have a copy of the file MSWINSCK.OCX in your system folder (Windows\System32 on 32bit Windows, or Windows\SysWOW64 on 64bit Windows). This OCX file comes with VB6 when you install it, and also I think in some older versions of Windows, but not in anything newer than Windows XP. I could have created an installer package for my program that would have installed this dependency, but since you may already have the file, I felt it was easier to post it as a separate download here. If you don't already have MSWINSCK.OCX installed on your computer, you will need to copy it to the correct system folder (as mentioned above), and then you will need to run the following 2 commands from a command prompt with administrator privilege:
cd c:\windows\system32 (or if in 64bit Windows, use cd c:\windows\syswow64)
regsvr32 MSWINSCK.OCX
That will install the Winsock ActiveX control on your system. Then the serial mouse emulator program should run fine.

Also note that sometimes my program locks up when it first starts, at least on my PC. I traced this back to my copy of Norton Antivirus somehow interfering with its operation. It's not because it detects it as a virus (it doesn't, it finds it completely clean/uninfected), but rather somehow its scanning process (which involves injecting virus scanner threads into the running program, in order to monitor the program for suspicious behavior) is itself sometimes causing interference in the program's normal execution. I found that one specific feature of Norton Antivirus is responsible for this problem. It's called "SONAR Protection". If you disable just that one Norton feature (and leave all of the other antivirus/security features running), then my serial mouse emulator will always run without a problem. I would highly recommend permanently disabling that one feature as it has caused problems in other programs too, and it seems to do so more in ones written in VB6.

Attached to this message are 2 files:
Serial Mouse Emulator.exe
MSWINSCK.zip (I put the OCX file into the ZIP file, because the attachment system here didn't let me directly attach the OCX file)
Attachments
MSWINSCK.zip
This is required for the serial mouse emulator to work.
(55.69 KiB) Downloaded 83 times
Serial Mouse Emulator.exe
Allows your normal USB mouse to be used as a serial mouse in DosBox. Connects to 127.0.0.1:1234
(24 KiB) Downloaded 97 times
videogamer555
Member
 
Posts: 128
Joined: 2010-2-04 @ 08:18

Re: Serial Mouse Emulator

Postby olddos25 » 2017-7-30 @ 04:28

Tried it on a Windows 7 laptop and it really works! This is useful for the ones that need it!
Currently mod on several Discord servs and a forum, so you can trust me if you want a DOSBox mod here!
Other places to find me:
DraStic: http://drastic-ds.com (as dsattorney)
EPForums: http://www.epforums.org (as emulationfan)
olddos25
Member
 
Posts: 181
Joined: 2017-5-14 @ 02:34
Location: Argentina

Re: Serial Mouse Emulator

Postby ProphetPX » 2018-7-21 @ 21:57

This program works great but is there any support in it for the scroll wheel on my mouse? I did everything as you said but i do not know how to enable scroll wheel support?

I used it to setup an old copy of AutoCAD R11 inside DOSBOX under Windows 10 x64 :D
And it works great -- except the mouse wheel.

IF it is enabled in your emulator then what am i missing?

videogamer555 wrote:I wrote this program in VB6. It uses Windows API to read raw HID (human interface device) data from the real USB mouse attached to your computer. By doing so, instead of getting the current cursor's position on the screen, it gets the x/y movement values sent from the actual mouse. And these are what is needed to generate a proper serial mouse data packet. From there it uses the Winsock ActiveX control to send the packet.

When the program first starts, it attempts to connect to IP address 127.0.0.1 and port 1234. After about one second, if no server program is listening on that port, my program closes. To make my program work with DosBox, use notepad and load your DosBox config file, and in the serial port configuration set serial port 1 to:
serial1=nullmodem port:1234
Then save the config file. Then start DosBox. After DosBox is running, start my serial mouse emulator. Then run a program that you know absolutely requires a serial mouse (such as Windows 1.0, and don't use the modded version that is actually using the Windows 2.0 PS2 mouse driver, or maybe play some really old game that requires a serial mouse). It should work perfectly, just as if you were using a real serial mouse. If you don't want to see both your real mouse cursor and the one in DosBox both at the same time, you can make DosBox grab your real cursor, which makes it disappear. To do this, press Ctrl+F10 in DosBox. Press Ctrl+F10 again to make DosBox release control of your real cursor.

Here's something to note. As my serial mouse emulator uses the Winsock ActiveX control for the TCP connection, you will need to have a copy of the file MSWINSCK.OCX in your system folder (Windows\System32 on 32bit Windows, or Windows\SysWOW64 on 64bit Windows). This OCX file comes with VB6 when you install it, and also I think in some older versions of Windows, but not in anything newer than Windows XP. I could have created an installer package for my program that would have installed this dependency, but since you may already have the file, I felt it was easier to post it as a separate download here. If you don't already have MSWINSCK.OCX installed on your computer, you will need to copy it to the correct system folder (as mentioned above), and then you will need to run the following 2 commands from a command prompt with administrator privilege:
cd c:\windows\system32 (or if in 64bit Windows, use cd c:\windows\syswow64)
regsvr32 MSWINSCK.OCX
That will install the Winsock ActiveX control on your system. Then the serial mouse emulator program should run fine.

Also note that sometimes my program locks up when it first starts, at least on my PC. I traced this back to my copy of Norton Antivirus somehow interfering with its operation. It's not because it detects it as a virus (it doesn't, it finds it completely clean/uninfected), but rather somehow its scanning process (which involves injecting virus scanner threads into the running program, in order to monitor the program for suspicious behavior) is itself sometimes causing interference in the program's normal execution. I found that one specific feature of Norton Antivirus is responsible for this problem. It's called "SONAR Protection". If you disable just that one Norton feature (and leave all of the other antivirus/security features running), then my serial mouse emulator will always run without a problem. I would highly recommend permanently disabling that one feature as it has caused problems in other programs too, and it seems to do so more in ones written in VB6.

Attached to this message are 2 files:
Serial Mouse Emulator.exe
MSWINSCK.zip (I put the OCX file into the ZIP file, because the attachment system here didn't let me directly attach the OCX file)
ProphetPX
Newbie
 
Posts: 1
Joined: 2018-7-21 @ 21:51

Re: Serial Mouse Emulator

Postby olddos25 » 2018-7-27 @ 00:28

I don't think so. My laptop does not have a wheel to begin with, so I can't test this.
PD: I'm back!
Currently mod on several Discord servs and a forum, so you can trust me if you want a DOSBox mod here!
Other places to find me:
DraStic: http://drastic-ds.com (as dsattorney)
EPForums: http://www.epforums.org (as emulationfan)
olddos25
Member
 
Posts: 181
Joined: 2017-5-14 @ 02:34
Location: Argentina

Re: Serial Mouse Emulator

Postby videogamer555 » 2018-9-19 @ 08:29

ProphetPX wrote:This program works great but is there any support in it for the scroll wheel on my mouse? I did everything as you said but i do not know how to enable scroll wheel support?

I used it to setup an old copy of AutoCAD R11 inside DOSBOX under Windows 10 x64 :D
And it works great -- except the mouse wheel.

IF it is enabled in your emulator then what am i missing?


Scroll wheel support? There is no such thing as a scroll wheel on a serial mouse. The serial mouse was invented before the scroll wheel was even dreamed of. The serial data packets don't support a scroll wheel, so there's nothing to emulate in this regard. I'd need to make a new data packet type, but that would no longer be compatible with the serial mouse specification, so it wouldn't work on old programs that require a real serial mouse (only on ones that were created nowadays to specifically support such a custom serial protocol)
videogamer555
Member
 
Posts: 128
Joined: 2010-2-04 @ 08:18

Re: Serial Mouse Emulator

Postby youplaboom07 » 2018-12-29 @ 04:21

Hi videogamer555,
would it be possible to have your Serial Mouse Emulator program to output to any serial port, virtual or real, like COM1 or 2?
I need a way to feed a COM port with serial mouse data.
Would you share your sources?
Thanks
youplaboom07
Newbie
 
Posts: 1
Joined: 2017-2-05 @ 20:08

Re: Serial Mouse Emulator

Postby cyclone3d » 2018-12-29 @ 05:08

youplaboom07 wrote:Hi videogamer555,
would it be possible to have your Serial Mouse Emulator program to output to any serial port, virtual or real, like COM1 or 2?
I need a way to feed a COM port with serial mouse data.
Would you share your sources?
Thanks


Thid should be possible to program.. but if this program doesn't support it, there is a project that allows you to use a Raspberry Pi to allow you to convert a USB mouse to serial.
User avatar
cyclone3d
l33t
 
Posts: 3070
Joined: 2015-4-08 @ 06:06
Location: Huntsville, AL USA

Re: Serial Mouse Emulator

Postby RobinHood2019 » 2019-7-25 @ 18:52

Thanks! Is it possible to get this to work on VirtualBox as well?
RobinHood2019
Newbie
 
Posts: 1
Joined: 2019-7-25 @ 18:46


Return to DOSBox General

Who is online

Users browsing this forum: No registered users and 1 guest