Notes on How to Change a Port Associated with a Printer Driver
Keywords: port com lpt
Question:
How can I reload the registry without rebooting the machine in win95?Also, how can I write a script that will change a port that is associated with a printer driver?
For example, lpt1: is connected to HP Laserjet 5/5m driver. I want to change the driver to com1: and have that change take effect without rebooting.
Answer:
The files that get updated when changing the port they are:win.ini system.dat user.datthat seems to be it.Windows 95 seems to require not that the registry gets reset, but that whatever is changed by the registry gets reset. This said, I would look at resetting the ports and going from there.
When I make a port change, the following happens.
for 3) and 4) above, you might need to do a series of dllCalls once you discover the functions within them that get run.
- Win.ini gets updated.
- Registry gets updated.
- For my laserjet 4MX, the file HPPCL.P00 gets updated.
- Because it is a com port involved, serial.vxd and serialui.dll get opened and closed.
Let's be real careful. The registry is updated. The settings are changed.
Now if you want the various programs to pay attention to the newly installed registry settings, you must tell them. Generally you tell them via an wininichg message or a DMC message.
If you search the database for WININICHG= and DMC= then you can see how it is done.
The registry key got changed. Now the applications that process that information need to respond to the change. If they do not pay attention to the registry or pay attention when properly informed (that's the big trick - what is properly informed) then there is nothing anyone can do for the changes to take effect, aside from rebooting the machine.
Article ID: W13684Filename: Changing a Port Associated with a Printer Driver.txt