|
![]() |
#1 |
MCTS
|
Дополнительно к функции WinAPI::EnumPrinters создайте еще одну:
X++: static client server str GetPrinterPort(str _printerName) { DLL _winApiDLL = new DLL("kernel32.dll"); DLLFunction _getProfileString = new DLLFunction(_winApiDLL, 'GetProfileStringA'); Binary _bStrApp = new Binary(10); Binary _bStrKey = new Binary(255); Binary _bStrDef = new Binary(1); Binary _bStrRet = new Binary(255); ; _getProfileString.returns(ExtTypes::DWord); _getProfileString.arg( ExtTypes::Pointer, ExtTypes::Pointer, ExtTypes::Pointer, ExtTypes::Pointer, ExtTypes::DWord); _bStrApp.string(0, "Devices"); _bStrKey.string(0, _printerName); _bStrDef.string(0, ""); _getProfileString.call( _bStrApp, _bStrKey, _bStrDef, _bStrRet, 255); return strReplace(_bStrRet.string(0), "winspool,", ''); } X++: static void listPrinters(Args _args) { container con; int i; ; con = WinAPI::EnumPrinters(); for (i = 1; i <= conlen(con); i++) info(strfmt("%1 (%2)", conpeek(con, i), winAPI::GetPrinterPort(conpeek(con, i)))); } |
|
|
За это сообщение автора поблагодарили: KingPeas (1), samolalex (2). |
![]() |
#2 |
Участник
|
Цитата:
Цитата:
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 В случае маппинга секции HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping чтение ключа "Devices" приведет к обращению к ветке реестра USR:Software\Microsoft\Windows NT\CurrentVersion\Devices Последний раз редактировалось petergunn; 25.02.2009 в 10:06. |
|
![]() |
#3 |
Участник
|
Цитата:
Только я обрадовался что мне уже все подсказали)))
__________________
Хочу IQ как ICQ, ну или хотя бы ICQ как IQ. ![]() |
|