I have a C++ dll with a header having the following struct:

struct TData
	DWORD  m_Command;
	BYTE   m_Option;
    	char   m_Message[300];

The dll also has a callback function MessageReceived that takes TData as a parameter. The function fills in the m_Message with some data and returns.

in VB6, I have a similar type:

Public Type TData
    m_Command As Long
    m_Option As Byte
    m_Message As String
End Type

when the MessageReceived is called, I have an error:
The instruction at ........ referenced memory at ........ The memory could not be "written"
I'm assuming that this is because I'm not initializing a buffer for m_Message. Is there a way I can do this, since the MessageReceived is a callback, I do not create my TData to pass it in the function. Help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.