AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX: Программирование
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 18.06.2005, 15:30   #1  
DreamCreator is offline
DreamCreator
Moderator
Аватар для DreamCreator
Axapta Retail User
 
553 / 45 (3) +++
Регистрация: 04.11.2004
Адрес: Казань
WinAPI::getLastError()
День Добрый!

Хотел разобраться с расшифровкой числа которое возвращает WinAPI::getLastError

Нашел:
US-312-915-VPC4 WinAPi::getLastError() always returns 0 The problem was that the GetLastError value was set by Windows each time Windows API function was called. So, the reason that the X++ WinAPI::getLastError method wasn't able to pick up the correct error value, was that the kernel calls several Windows API functions between the X++ call to WinAPI::findFirstFile and WinAPI::getLastError, thus the GetLastError value was reset by Windows. This error was corrected - the kernel caches the GetLastError value right after a function call into a DLL and makes the value accessible from X++ via the DLL system class. Corrections needed: dllclass.hpp: Add a method to the classDLL class: int kcLastDLLError(interpret *ip); dllclass.cpp: Add int classDLL::kcLastDLLError(interpret *ip) { return ip->setIntReturnVal(LOCAL_SESSION_PBLK->_lastDLLError); } Add to classDLL::classDLL addMemberFunc(pType(DB_INT),"lastDLLError", QUALIFIER_STATIC | QUALIFIER_PROPERTY, (classStatic)&classDLL::kcLastDLLError); Change xDLLFunc::kcCall to { if (ip->getNumberOfArgs() != _numargs) // illegal number of arguments return ip->CQLRunError(CQL_ERR_FUNCARG2); int ret = CallDLLFunction(_dllfunc, _numargs, _argtypes, _rettype, ip, _dll->dllName(), _name); LOCAL_SESSION_PBLK->_lastDLLError = GetLastError(); return ret; } csesrv.hpp: Add a member to the SesPblk_t struct: public: DWORD _lastDLLError; X++ : WinAPI::getLastError: client server static int getLastError() { return DLL::lastDLLError(); }


Вопрос с рашифровкой остался открытым.
Старый 19.06.2005, 00:23   #2  
mazzy is offline
mazzy
Участник
Аватар для mazzy
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
Лучший по профессии 2011
Лучший по профессии 2009
 
29,472 / 4494 (208) ++++++++++
Регистрация: 29.11.2001
Адрес: Москва
Записей в блоге: 10
ничего не понял.
если это информация для других - то непонятная.
если это вопрос... то вопроса в вашем сообщении нет.
чего вы хотите то?
__________________
полезное на axForum, github, vk, coub.
Старый 20.06.2005, 09:25   #3  
BVN is offline
BVN
Участник
 
88 / 13 (1) ++
Регистрация: 07.04.2005
Адрес: г. Королёв МО
Ну это обычная WinApi финкция. Если вы хотите узнать, что означает возращаемое число, то лучше взять заголовочный файл winnt.h от С++ , там есть определения , плюс в Ах-е в макросе WINAPI.Их вообщем то много и приводить их значения тут бессмысленно. А сама функция определяется так:
The GetLastError function returns the calling thread's last-error code value. The last-error code is maintained on a per-thread basis. Multiple threads do not overwrite each other's last-error code.
DWORD GetLastError(VOID)
Parameters
This function has no parameters.
Return Values
The return value is the calling thread's last-error code value. Functions set this value by calling the SetLastError function. The Return Value section of each reference page notes the conditions under which the function sets the last-error code.
Старый 20.06.2005, 09:36   #4  
db is offline
db
Роман Долгополов (RDOL)
Лучший по профессии 2015
Лучший по профессии AXAWARD 2013
 
393 / 692 (24) +++++++
Регистрация: 01.04.2004
Адрес: Москва
1. программно вывести читабельное сообщение: FormatMessage
2. просто посмотреть и понять что за ошибка: VC++ Error Lookup из комплекта студии

и поставьте себе MSDN
Старый 20.06.2005, 10:03   #5  
DreamCreator is offline
DreamCreator
Moderator
Аватар для DreamCreator
Axapta Retail User
 
553 / 45 (3) +++
Регистрация: 04.11.2004
Адрес: Казань
Спасибо! То что надо!
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
WinAPI и работа с файлами SHiSHok DAX: Программирование 4 15.05.2007 11:31
WinAPI::getLastError() всегда возвращает 0 VictorSH DAX: Программирование 11 23.02.2007 13:06
Dynamics AX Geek: Finding files with WinAPI Blog bot DAX Blogs 0 28.10.2006 16:40
WinAPI. Ссылка (POINT) третьего уровня вложенности Владимир Максимов DAX: Программирование 2 06.02.2006 16:28
WinApi. Удаление файлов глючит. NJD DAX: Программирование 10 05.12.2003 13:31

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 03:06.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.