Цитата:
Сообщение от
Eldar9x
Дополнительно к функции WinAPI::EnumPrinters создайте еще одну:
X++:
static client server str GetPrinterPort(str _printerName)
{
DLL _winApiDLL = new DLL("kernel32.dll");
DLLFunction _getProfileString = new DLLFunction(_winApiDLL, 'GetProfileStringA');
...
}
imho, использование
GetProfileString не лучшее решение, т.к. эта функция в API присутсвует только для обратной совместимости с 16-bit приложениями.
Цитата:
GetProfileString Function
Retrieves the string associated with a key in the specified section of the Win.ini file.
Note This function is provided only for compatibility with 16-bit Windows-based applications, therefore this function should not be called from server code. Applications should store initialization information in the registry.
Цитата:
Windows Server 2003 and Windows XP/2000: Calls to profile functions may be mapped to the registry instead of to the initialization files. This mapping occurs when the initialization file and section are specified in the registry under the following keys:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\
CurrentVersion\IniFileMapping
Более подробно
тут (msdn).
В случае маппинга секции
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping чтение ключа
"Devices" приведет к обращению к ветке реестра
USR:Software\Microsoft\Windows NT\CurrentVersion\Devices