Printing Problem with Win95

Microsoft is currently working on a printing problem. Visual Basic 3.0 applications running in Windows 95 cannot print to shared printers with an embedded space. If a shared printer has an embedded space in the computer or printer name, the Visual Basic application will generate an Error 482.To work around this problem, change the computer or shared printer name to a name without an embedded space, or create a local printer and redirect the output to the shared printer with an embedded space (see Windows 95 online help).Add this code to your Visual Basic 3.0 applications to check for the error. Warning your users with a polite message box is more tolerable than an Error 482 message. This code assumes that you have declared the Windows API functions GetVersion and GetProfileString:

 Function Win95PrintBug ()	Dim LongReturn As Long, IntegerReturn As Integer, _		PortName As String	Dim StringReturn As String * 256, _		NullString As String * 256	LongReturn = GetVersion ()	If LongReturn = 0 Then		Win95PrintBug = False		'Code for failed GetVersion call	Else		LongReturn = LongReturn And &HFFFF& 			'Mask-Off upper two bytes		If LongReturn = (95 * 256) + 3 _			Then ' (Minor Version * 256) _			' + Major Version Code for Windows 95 			' operating system			IntegerReturn = GetProfileString ("windows", _				"device", NullString, StringReturn, 256)			StringReturn = Left$ _				(StringReturn, IntegerReturn)			StringReturn = Right$ _				(StringReturn, Len(StringReturn) - _				InStr(StringReturn, ","))			PortName = Trim$ (Mid$ (StringReturn, InStr_				(StringReturn, ",") + 1))			If InStr(PortName, " ") <> 0 Then				Win95PrintBug = True 				' VB 3.0 cannot print to this port			Else				Win95PrintBug = False 				' VB 3.0 can print to this port			End If		Else			Win95PrintBug = False ' Operating 				' system is not Windows 95		End If	End IfEnd Function

For more information, check out the Microsoft Knowledge Base article Q130650.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: