作为下面的代码,我声明了一个dll来使用它的函数,它在成功时返回0,否则当它不成功时。
我需要从函数生成宽度,高度,步幅,长度,字节,所以我使用ByRef来声明它们。当我启动它时,它运行良好,但在显示3 msgbox后,视觉基本崩溃。
我刚开始vb 2天前,我知道这肯定是一个菜鸟问题,但我甚至不知道问题是什么,所以......帮助我们。
任何让你困惑的人请告诉我,我马上就会纠正它。
这是DLL的纪录片
sn Char
width int(IN / OUT)
高度Int(IN / OUT)
bytes char *(IN / OUT)
stride int(IN / OUT)
len int(IN / OUT)
Private Declare Function Ict_WMK_ISV Lib "C:\acd.dll" (ByVal PrinterModel As String, ByRef width As Long, ByRef height As Long, ByRef bytes As Variant, ByRef stride As Long, ByRef leng As Long) As Integer
Private Sub Command1_Click()
'Ict_WMK_ISV (Fax)
Dim width As Long
Dim height As Long
Dim stride As Long
Dim leng As Long
Dim bytes As Variant
Dim printmodel As String
Dim iResult As Integer
printmodel = "Samsung SCX-6x45 Series PCL6"
If IsNull(bytes) Then
MsgBox ("null")
Else
MsgBox ("not null")
End If
bytes = Empty
iResult = Ict_WMK_ISV(printmodel, width, height, bytes, stride, leng)
MsgBox (Str(iResult))
End Sub
答案 0 :(得分:0)
然后在windbg下运行它(下载并安装Windows调试工具)
http://msdn.microsoft.com/en-us/windows/hardware/hh852363
安装Windows SDK,但只需选择调试工具。
在C:\
中创建名为Symbols的文件夹启动Windbg。文件菜单 - 符号文件路径并输入
srv*C:\symbols*http://msdl.microsoft.com/download/symbols
来自http://blogs.msdn.com/b/arvindsh/archive/2006/08/30/731150.aspx
How to generate symbol files for Visual Basic 6.0
In VB6, symbols are not created by default. To create symbols for your VB6 applications, follow these steps:
•Open the source code for your project.
•Select "<projectname> Properties" from the Project menu.
•In the Compile tab, check Create Symbolic Debug Info and select No Optimizations
•Recompile. This will create a .PDB file (the symbols) in the same directory as your .DLL / .EXE / .OCX file.
•Note: This does *not* break binary compatibility.
(如果设置环境变量link=/pdb:none
,则符号存储在已编译的文件中)
崩溃时,您可以获得异常信息。