yiming
Nov 18th, 1999, 07:48 AM
Hi,
I have this really big problem, how can I call this API function that return a pointer? Any help will be grateful...
the dll function is like this:
---------------------------------------------
ReadCode(HWND hwnd,
SHORT MaxLength,
LPSTR Codeline,
SHORT *Length);
hwnd
Handle of the application windows which will receive the notification messages.
MaxLength
Specify the size of the user buffer pointed by Codeline parameter.
Codeline
Pointer to the user buffer where codeline will be transferred by the service.
This value is return by function.
Length
Pointer to a variable that will contain the effective size of the codeline transferred by the service.
This value is return by function.
---------------------------------------------
SO, in my VB coding, I declare like this:
Public Declare Function ReadCode Lib "ReadCode.dll" _
(ByVal hwnd As Long, _
ByVal MaxLength As Integer, _
ByRef Codeline As String, _
ByRef Length As Integer) As Integer
THEN, I call like this:
dim FullCode as string
dim ActualLen as integer
rc = ReadCode(frmread.hwnd, 60, FullCode, ActualLen)
---------------------------------------------
RESULT:
I get a error message popup saying...
The instruction at "0x65343221" referenced memory at "0x30303038". The memory could not be "read".
--------------------------------------
Anyone who can help will be most grateful, thanks.
ming
I have this really big problem, how can I call this API function that return a pointer? Any help will be grateful...
the dll function is like this:
---------------------------------------------
ReadCode(HWND hwnd,
SHORT MaxLength,
LPSTR Codeline,
SHORT *Length);
hwnd
Handle of the application windows which will receive the notification messages.
MaxLength
Specify the size of the user buffer pointed by Codeline parameter.
Codeline
Pointer to the user buffer where codeline will be transferred by the service.
This value is return by function.
Length
Pointer to a variable that will contain the effective size of the codeline transferred by the service.
This value is return by function.
---------------------------------------------
SO, in my VB coding, I declare like this:
Public Declare Function ReadCode Lib "ReadCode.dll" _
(ByVal hwnd As Long, _
ByVal MaxLength As Integer, _
ByRef Codeline As String, _
ByRef Length As Integer) As Integer
THEN, I call like this:
dim FullCode as string
dim ActualLen as integer
rc = ReadCode(frmread.hwnd, 60, FullCode, ActualLen)
---------------------------------------------
RESULT:
I get a error message popup saying...
The instruction at "0x65343221" referenced memory at "0x30303038". The memory could not be "read".
--------------------------------------
Anyone who can help will be most grateful, thanks.
ming