Page 1 of 1

The Access Violation Error

Posted: Tue Feb 10, 2009 11:44 am
by RiderChips
I used the function "setSensor(int nSensorNbr, bool bOn)" in ICubeLib library to turn on sensors from 1 to 8. I always got an access violation error during the execution time of my program. A part of my code is shown below:

void CMyApp::OnBnClickedStart()
openPort(eUSB_MIDIdig, 0, true);
BYTE sxHostMode[] = { 0xF0, 0x7D, 0x0, 0x5A, 0x00, 0xF7 };
.(sxHostMode, sizeof(sxHostMode));
for (int i = 0; i < 8; i++)
setSensor(i, true);
SetTimer(1001, 300, NULL);

My program always got an access violation error in the line "setSensor(i, true);". The error message is "0xC0000005: Access Violation, write of address 0x009b0008". I went to call stack windows in Visual C++ and got information below:


I think maybe it is a bug in ICubeXLib.DLL. How should I solve this problem!?

Thanks a lot!