1)
Print #1, Chr(27) + Chr(74) + Chr(100) + Chr(27) + Chr(74) + Chr(100)
2)
Open "LPT1:" For Output As #1
Print #1, Chr(27) + Chr(64) + Chr(27) + Chr(50) + Chr(27) + Chr(67) + Chr(29) + Chr(27) + Chr(106) + Chr(100) + Chr(27) + Chr(106) + Chr(100) + Chr(27) + Chr(106) + Chr(75)
13 个解决方案
#1
1.向句柄为1的对象中写入{ESC}Jd{ESC}Jd
2.输出到打印机:{ESC}@{ESC}2{ESC}C................................
2.输出到打印机:{ESC}@{ESC}2{ESC}C................................
#2
以 ASCII 方式写文件 MSDN 有详细介绍
#3
好像都没讲到要点上。
#4
唉,你是问Print,#1,Chr(),Open,For,Output,As 这些是做什么用的?
Print:输出方法,配合Open就属于File I/O, 如果直接调用,则是PrintScreen.
#1:是句柄为"1"的对象
Chr():是一个函数,可以将ASCII码转成字符。
Open:File I/O的方法
For:在这里是Open方法中的关键字
Output:在这里是File I/O的操作类型(输出)
...
...
Print:输出方法,配合Open就属于File I/O, 如果直接调用,则是PrintScreen.
#1:是句柄为"1"的对象
Chr():是一个函数,可以将ASCII码转成字符。
Open:File I/O的方法
For:在这里是Open方法中的关键字
Output:在这里是File I/O的操作类型(输出)
...
...
#5
Open Statement Example
This example illustrates various uses of the Open statement to enable input and output to a file.
The following code opens the file TESTFILE in sequential-input mode.
Open "TESTFILE" For Input As #1
' Close before reopening in another mode.
Close #1
This example opens the file in Binary mode for writing operations only.
Open "TESTFILE" For Binary Access Write As #1
' Close before reopening in another mode.
Close #1
The following example opens the file in Random mode. The file contains records of the user-defined type Record.
Type Record ' Define user-defined type.
ID As Integer
Name As String * 20
End Type
Dim MyRecord As Record ' Declare variable.
Open "TESTFILE" For Random As #1 Len = Len(MyRecord)
' Close before reopening in another mode.
Close #1
This code example opens the file for sequential output; any process can read or write to file.
Open "TESTFILE" For Output Shared As #1
' Close before reopening in another mode.
Close #1
This code example opens the file in Binary mode for reading; other processes can't read file.
Open "TESTFILE" For Binary Access Read Lock Read As #1
This example illustrates various uses of the Open statement to enable input and output to a file.
The following code opens the file TESTFILE in sequential-input mode.
Open "TESTFILE" For Input As #1
' Close before reopening in another mode.
Close #1
This example opens the file in Binary mode for writing operations only.
Open "TESTFILE" For Binary Access Write As #1
' Close before reopening in another mode.
Close #1
The following example opens the file in Random mode. The file contains records of the user-defined type Record.
Type Record ' Define user-defined type.
ID As Integer
Name As String * 20
End Type
Dim MyRecord As Record ' Declare variable.
Open "TESTFILE" For Random As #1 Len = Len(MyRecord)
' Close before reopening in another mode.
Close #1
This code example opens the file for sequential output; any process can read or write to file.
Open "TESTFILE" For Output Shared As #1
' Close before reopening in another mode.
Close #1
This code example opens the file in Binary mode for reading; other processes can't read file.
Open "TESTFILE" For Binary Access Read Lock Read As #1
#6
Dim MyChar
MyChar = Chr(65) ' Returns A.
MyChar = Chr(97) ' Returns a.
MyChar = Chr(62) ' Returns >.
MyChar = Chr(37) ' Returns %.
MyChar = Chr(65) ' Returns A.
MyChar = Chr(97) ' Returns a.
MyChar = Chr(62) ' Returns >.
MyChar = Chr(37) ' Returns %.
#7
我见到别人的原代码是这样的,很奇怪倒底是起什么作用的.他的过程是先执行第一句,然后Form.print,在执行第二句.我的问题就是,这两句倒底起到什么作用或走说产生什么效果?
#8
form.print是打印当前活动窗体
#9
我晕
#10
打印机的一些操作命令,说明书上好象有
#11
这段程序是这样的:
1\Print #1, Chr(27) + Chr(74) + Chr(100) + Chr(27) + Chr(74) + Chr(100)
是倒退一段纸张
2\打印form
3\前进一段纸张
我的问题:1、哪位高手解是一下。
2、当(2、)Form正在打印时,马上执行(3、)会出错,提示“招不到路经”,能否解决,如第二段Form完全打印好以后,则不会出错。
1\Print #1, Chr(27) + Chr(74) + Chr(100) + Chr(27) + Chr(74) + Chr(100)
是倒退一段纸张
2\打印form
3\前进一段纸张
我的问题:1、哪位高手解是一下。
2、当(2、)Form正在打印时,马上执行(3、)会出错,提示“招不到路经”,能否解决,如第二段Form完全打印好以后,则不会出错。
#12
QB、VB1~3能得到正确结果
但自从VB4引入UniCode字符串后,直接Chr即有可能造成字符集映射错误
强烈建议用二进制方式操作,用Byte数组读写
但自从VB4引入UniCode字符串后,直接Chr即有可能造成字符集映射错误
强烈建议用二进制方式操作,用Byte数组读写
#13
Open "LPT1:" For Output As #1
当正在打印时会包错,“路经未找到”,怎避免这个问题?
当正在打印时会包错,“路经未找到”,怎避免这个问题?
#1
1.向句柄为1的对象中写入{ESC}Jd{ESC}Jd
2.输出到打印机:{ESC}@{ESC}2{ESC}C................................
2.输出到打印机:{ESC}@{ESC}2{ESC}C................................
#2
以 ASCII 方式写文件 MSDN 有详细介绍
#3
好像都没讲到要点上。
#4
唉,你是问Print,#1,Chr(),Open,For,Output,As 这些是做什么用的?
Print:输出方法,配合Open就属于File I/O, 如果直接调用,则是PrintScreen.
#1:是句柄为"1"的对象
Chr():是一个函数,可以将ASCII码转成字符。
Open:File I/O的方法
For:在这里是Open方法中的关键字
Output:在这里是File I/O的操作类型(输出)
...
...
Print:输出方法,配合Open就属于File I/O, 如果直接调用,则是PrintScreen.
#1:是句柄为"1"的对象
Chr():是一个函数,可以将ASCII码转成字符。
Open:File I/O的方法
For:在这里是Open方法中的关键字
Output:在这里是File I/O的操作类型(输出)
...
...
#5
Open Statement Example
This example illustrates various uses of the Open statement to enable input and output to a file.
The following code opens the file TESTFILE in sequential-input mode.
Open "TESTFILE" For Input As #1
' Close before reopening in another mode.
Close #1
This example opens the file in Binary mode for writing operations only.
Open "TESTFILE" For Binary Access Write As #1
' Close before reopening in another mode.
Close #1
The following example opens the file in Random mode. The file contains records of the user-defined type Record.
Type Record ' Define user-defined type.
ID As Integer
Name As String * 20
End Type
Dim MyRecord As Record ' Declare variable.
Open "TESTFILE" For Random As #1 Len = Len(MyRecord)
' Close before reopening in another mode.
Close #1
This code example opens the file for sequential output; any process can read or write to file.
Open "TESTFILE" For Output Shared As #1
' Close before reopening in another mode.
Close #1
This code example opens the file in Binary mode for reading; other processes can't read file.
Open "TESTFILE" For Binary Access Read Lock Read As #1
This example illustrates various uses of the Open statement to enable input and output to a file.
The following code opens the file TESTFILE in sequential-input mode.
Open "TESTFILE" For Input As #1
' Close before reopening in another mode.
Close #1
This example opens the file in Binary mode for writing operations only.
Open "TESTFILE" For Binary Access Write As #1
' Close before reopening in another mode.
Close #1
The following example opens the file in Random mode. The file contains records of the user-defined type Record.
Type Record ' Define user-defined type.
ID As Integer
Name As String * 20
End Type
Dim MyRecord As Record ' Declare variable.
Open "TESTFILE" For Random As #1 Len = Len(MyRecord)
' Close before reopening in another mode.
Close #1
This code example opens the file for sequential output; any process can read or write to file.
Open "TESTFILE" For Output Shared As #1
' Close before reopening in another mode.
Close #1
This code example opens the file in Binary mode for reading; other processes can't read file.
Open "TESTFILE" For Binary Access Read Lock Read As #1
#6
Dim MyChar
MyChar = Chr(65) ' Returns A.
MyChar = Chr(97) ' Returns a.
MyChar = Chr(62) ' Returns >.
MyChar = Chr(37) ' Returns %.
MyChar = Chr(65) ' Returns A.
MyChar = Chr(97) ' Returns a.
MyChar = Chr(62) ' Returns >.
MyChar = Chr(37) ' Returns %.
#7
我见到别人的原代码是这样的,很奇怪倒底是起什么作用的.他的过程是先执行第一句,然后Form.print,在执行第二句.我的问题就是,这两句倒底起到什么作用或走说产生什么效果?
#8
form.print是打印当前活动窗体
#9
我晕
#10
打印机的一些操作命令,说明书上好象有
#11
这段程序是这样的:
1\Print #1, Chr(27) + Chr(74) + Chr(100) + Chr(27) + Chr(74) + Chr(100)
是倒退一段纸张
2\打印form
3\前进一段纸张
我的问题:1、哪位高手解是一下。
2、当(2、)Form正在打印时,马上执行(3、)会出错,提示“招不到路经”,能否解决,如第二段Form完全打印好以后,则不会出错。
1\Print #1, Chr(27) + Chr(74) + Chr(100) + Chr(27) + Chr(74) + Chr(100)
是倒退一段纸张
2\打印form
3\前进一段纸张
我的问题:1、哪位高手解是一下。
2、当(2、)Form正在打印时,马上执行(3、)会出错,提示“招不到路经”,能否解决,如第二段Form完全打印好以后,则不会出错。
#12
QB、VB1~3能得到正确结果
但自从VB4引入UniCode字符串后,直接Chr即有可能造成字符集映射错误
强烈建议用二进制方式操作,用Byte数组读写
但自从VB4引入UniCode字符串后,直接Chr即有可能造成字符集映射错误
强烈建议用二进制方式操作,用Byte数组读写
#13
Open "LPT1:" For Output As #1
当正在打印时会包错,“路经未找到”,怎避免这个问题?
当正在打印时会包错,“路经未找到”,怎避免这个问题?