Показать сообщение отдельно
Старый 10.08.2004, 13:10   #6  
BorDark is offline
BorDark
Участник
Аватар для BorDark
 
24 / 10 (1) +
Регистрация: 09.08.2004
Адрес: планета Земля
Talking Ой, протупил. Решение
В указанном коде надо заменить
h = textHandle.dWord(8); // всегда = 0
len = textLength.Word(8); // всегда = 0 :'((

на

h = textHandle.dWord(0); // то, что надо ;0)
len = textLength.Word(0); // то, что надо :0)

Вот функция, которая будет возвращать код и описание последней ошибки, произошедшей в Crystal Report Engine (мало ли, пригодится кому)


void showError(int _jn, str _descr = "")
{
Binary textHandle = new Binary(32);
Binary textLength = new Binary(16);
Binary errorText;
int errCode;
HWND h;
int len;

DLLFunction PEGetErrorCode;
DLLFunction PEGetErrorText;
DLLFunction PEGetHandleString;
;
PEGetErrorCode = new DLLFunction(crdll, "PEGetErrorCode");
PEGetErrorText = new DLLFunction(crdll, "PEGetErrorText");
PEGetHandleString = new DLLFunction(crdll, "PEGetHandleString");

PEGetErrorCode.returns(ExtTypes::Byte);
PEGetErrorCode.arg(ExtTypes:Word);

PEGetErrorText.returns(ExtTypes::Byte);
PEGetErrorText.arg(ExtTypes::Word,
ExtTypes::Pointer,
ExtTypes::Pointer);

PEGetHandleString.returns(ExtTypes::Byte);
PEGetHandleString.arg(ExtTypes:Word,
ExtTypes::Pointer,
ExtTypes::Word);

try
{
// код ошибки
errCode = PEGetErrorCode.call(_jn);

if (!PEGetErrorText.call(_jn, textHandle, textLength))
throw error("Неудачный вызов PEGetErrorText (showError #1)");
else
{
h = textHandle.dWord(0);
len = textLength.Word(0);
errorText = new Binary(textLength);
if (!PEGetHandleString.call(h, errorText, len))
throw error("Неудачный вызов PEGetHandleString (showError #2)");
}
_descr = _descr + (_descr ? "\n" : "") + int2str(errCode) + " - " + errorText.string(0);
throw error(_descr);
} catch (Exception::Error)
{
this.closeJob(_jn);
throw ("");
}
}

Отдельное спасибо dn за внимание к теме и помощь