`........
implementation
function getfonthex(pch_text,pch_font:pchar;int_fontsize,int_x,int_y,intstyle:integer;var ary_byt:array of byte):integer;stdcall;external '.\ttftohex.dll' name 'getfonthex';
{$R *.DFM}
...
...
procedure TTEC_DLL.btn_CallDllClick(Sender: TObject);
var
ary_byt1: array [0..51200] of byte;
int_bufsize of integer;
begin
int_bufsize:=getfonthex('DLL示例 ','黑体',50 ,20,20,0,ary_byt1); //汉字存入ary_byt1缓存中
END.
我用vb改写了
'在公共模块中的声明
Public Declare Function getfonthex Lib "ttftohex.dll" (ByVal outStr As String, ByVal lfFaceName As String, ByVal lfStrSize As Long, ByVal lfXcoordinates As Long, ByVal lfYCoordinates As Long, ByVal lfStyle As Long, ByRef hexBuf() As String) As Integer'窗体中的调用
Private Sub Command1_Click() Dim array1(0 To 51200) As String
Dim int_size As Long int_size = getfonthex("DLL", "黑体", 20, 20, 20, 0, array1)End Sub
====================================
问题是我在vb中调用getfonthex程序就回异常中断退出,各位达人我改写的有问题吗?
implementation
function getfonthex(pch_text,pch_font:pchar;int_fontsize,int_x,int_y,intstyle:integer;var ary_byt:array of byte):integer;stdcall;external '.\ttftohex.dll' name 'getfonthex';
{$R *.DFM}
...
...
procedure TTEC_DLL.btn_CallDllClick(Sender: TObject);
var
ary_byt1: array [0..51200] of byte;
int_bufsize of integer;
begin
int_bufsize:=getfonthex('DLL示例 ','黑体',50 ,20,20,0,ary_byt1); //汉字存入ary_byt1缓存中
END.
我用vb改写了
'在公共模块中的声明
Public Declare Function getfonthex Lib "ttftohex.dll" (ByVal outStr As String, ByVal lfFaceName As String, ByVal lfStrSize As Long, ByVal lfXcoordinates As Long, ByVal lfYCoordinates As Long, ByVal lfStyle As Long, ByRef hexBuf() As String) As Integer'窗体中的调用
Private Sub Command1_Click() Dim array1(0 To 51200) As String
Dim int_size As Long int_size = getfonthex("DLL", "黑体", 20, 20, 20, 0, array1)End Sub
====================================
问题是我在vb中调用getfonthex程序就回异常中断退出,各位达人我改写的有问题吗?
解决方案 »
- 请教一个关于方法指针的问题
- realaudio和Xaudio.dll 的问题!高手请进。
- 我在Rave报表上放了一个databand然后在它上面放了一个datatext为什么不能显示datatext中的数呢???
- 求计算专业论文!作参考
- 怎么样在程序中(也就是通过编程方式)替adoquery1增加计算字段或其它字段?
- 为什么用sqlserver的DTS导入foxpro的数据时,数据读取错误
- 如何锁定Win2000, 就是按三键后点击“锁定”的效果?
- 问一个简单的,看有没有有理俺?15分
- 各位高手:有关Web开发的问题?
- xe是什么
- 网站后台
- 如何将treeview一个节点上的文字,拖拽到paintbox并显示?
* getfonthex - - Get bitmap in hex code of specific out
* string and font to buffer.
* Parameter:
* 1) LPSTR outStr, // output string 字符串 (或单色bmp文件名称)
* 2) LPSTR lfFaceName, // Windows font name 字体名称 (或指定为 BITMAP)
* 3) int lfStrSize, // string size (in 0.1mm units, in 0.05mm units if
// the printer resolution is 600dpi ) 字体大小(单位 0.1mm,若打印机为600DPI,则单位为0.05mm)
* 4) int lfXCoordinates, // x-coordinates of print origin for drawing 打印开始位置X坐标
* 5) int lfYCoordinates, // y-coordinates of print origin for drawing 打印开始位置Y坐标
* 6) int lfstyle, // font style 0:normal,1:bold ,2:Italic,3:underline,4:strikeout 字形
* 7) LPSTR hexBuf // buffer to receive hex codes,
* buffer size has better less than 100k 接收缓冲区:字符以16进制存储 Buffer最好小于100K
* int Return : Byte count of buffer contents if successful 返回值: Buffer的大小
*
* Note : 1) Before program to call function getfonthex in ttftohex.dll,
* Statement must be added to declare it in the call program.
* 2) Function name getfonthex must in lower case.
* 3) Before function getfonthex() is called, the buffer must to allocate first.
* 4) The return of getfonthex() is greate than 0 if function call is
* successful, and result of Chinese data is stored buffer.
* The total number of byte output in buffer is return by getfonthex().
=========================================
这是ttftohex.dll 的说明