Russ Dodge
November 26th, 1998, 05:22 PM
I am looking for some help converting a "short" API function,
printing textbox data to the printer exactly as seen on screen.
The following code works in VB4 16 but not in VB4 32.
The printer spools takes the paper and spits it out but
does not print any text.
I'm using a Form, textbox, Bas module, and command button.
************------------------------*******************
'Module1 (General Declarations):
Declare Function GetFocus% Lib "user" ()
Declare Function SendMessage% Lib "user" (ByVal hWnd%, ByVal wMsg%, _
ByVal wParam%, ByVal lParam As Any)
'(Form 1):
Private Sub Command3_Click()
Printer.CurrentY = Printer.CurrentY + 400
Text1.SetFocus
lnz% = SendMessage(GetFocus(), &H40A, 0&, 0&)
For ii = 0 To lnz%
Printer.CurrentX = 1000
Text1.SetFocus
tem$ = Space(80)
w% = SendMessage(GetFocus(), &H414, ii, tem$)
Printer.print tem$
Next ii
Printer.EndDoc
End Sub
************------------------------******************
The above code works in VB16 I've changed the declaration below
for Win32 - but still does not work.
Option Explicit
Declare Function GetFocus Lib "user32" Alias "GetFocus" () As Long
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As _
Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Thank You I appreciate any input.
Russ Dodge
rdodge@mathouse.com
Vacaville, Ca.
printing textbox data to the printer exactly as seen on screen.
The following code works in VB4 16 but not in VB4 32.
The printer spools takes the paper and spits it out but
does not print any text.
I'm using a Form, textbox, Bas module, and command button.
************------------------------*******************
'Module1 (General Declarations):
Declare Function GetFocus% Lib "user" ()
Declare Function SendMessage% Lib "user" (ByVal hWnd%, ByVal wMsg%, _
ByVal wParam%, ByVal lParam As Any)
'(Form 1):
Private Sub Command3_Click()
Printer.CurrentY = Printer.CurrentY + 400
Text1.SetFocus
lnz% = SendMessage(GetFocus(), &H40A, 0&, 0&)
For ii = 0 To lnz%
Printer.CurrentX = 1000
Text1.SetFocus
tem$ = Space(80)
w% = SendMessage(GetFocus(), &H414, ii, tem$)
Printer.print tem$
Next ii
Printer.EndDoc
End Sub
************------------------------******************
The above code works in VB16 I've changed the declaration below
for Win32 - but still does not work.
Option Explicit
Declare Function GetFocus Lib "user32" Alias "GetFocus" () As Long
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As _
Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Thank You I appreciate any input.
Russ Dodge
rdodge@mathouse.com
Vacaville, Ca.