Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Aug 6, 1997

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 If
End Function
For more information, check out the Microsoft Knowledge Base article Q130650.
Clinton D.
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date