Пример - отправка и получение в/из консоли строковых данных.
Только поставите в свойствах консоли шрифт поддерживающий русский язык (например - Lucida Console)
Add(MainForm,2953706,203,77)
{
Width=476
Height=205
Caption="Использовать консоль в неконсольном приложении"
link(onCreate,10503466:doEvent1,[])
}
Add(InlineCode,16215071,350,98)
{
WorkPoints=#13:doOpenConsole|16:doWriteToConsole|17:doReadFromConsole|13:doFreeConsole|
EventPoints=#7:onEvent|
Code=#15:unit HiAsmUnit;|0:|9:interface|0:|29:uses Windows,kol,Share,Debug;|0:|4:type|28: THiAsmClass = class(TDebug)|10: private|0:|9: public|16:{ Event Points }|20:onEvent : THI_Event;|0:|15:{ Work Points }|54:Procedure doOpenConsole (var _Data:TData; Index:word);|57:Procedure doWriteToConsole (var _Data:TData; Index:word);|58:Procedure doReadFromConsole (var _Data:TData; Index:word);|54:Procedure doFreeConsole (var _Data:TData; Index:word);|0:|5: end;|0:|14:implementation|15:{ Work Points }|67:Procedure THiAsmClass.doOpenConsole (var _Data:TData; Index:word);|5:Begin|16: AllocConsole;|22: SetConsoleCP(1251);|28: SetConsoleOutputCP(1251);|49: SetConsoleTitle( PChar( 'Консоль отладки' ) );|81: SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);|4:end;|70:Procedure THiAsmClass.doWriteToConsole (var _Data:TData; Index:word);|5:Begin|28: Writeln(ToString(_Data));|4:end;|71:Procedure THiAsmClass.doReadFromConsole (var _Data:TData; Index:word);|4: var|13: s: string;|5:Begin|37: Write('Печатать текст здесь> ');|28: Readln(s); |27: _hi_OnEvent(onEvent,s);|4:end;|67:Procedure THiAsmClass.doFreeConsole (var _Data:TData; Index:word);|5:Begin|15: FreeConsole;|4:end;|0:|4:end.|
link(onEvent,3647522:doAdd,[])
}
Add(ArrayEnum,12358217,287,105)
{
link(onItem,16215071:doWriteToConsole,[])
link(onEndEnum,15767886:doWork2,[])
link(Array,690153:Array,[])
}
Add(StrList,690153,273,49)
{
Strings=#37: __ __ _ _____ _____ _____ |37: | | |_| _ | __| | |37: | | | |__ | | | | |37: |__|__|_|__|__|_____|_|_|_| |11: |0:|0:|90:Item | Description | Quantity | Unit | Price | Value | |89:-----------------------------------------------------------------------------------------|90:13930 | Double-action Quickstart II rem. L=740mm | 1 | PC | 98,66 | 98,66 | |90:13100201 | Spray gun for udder washer | 20 | PC | 17,77 | 355,4 | |90:13246007 | COMBI-cock ?51 mm cpl. | 10 | PC | 63,43 | 634,3 | |90:25643301 | Milk hose ? 24/14 x 2750 | 32 | PC | 9,76 | 312,32 | |90:14291 | Service no.1 RDS MAX double box | 1 | PC | 250,51 | 250,51 | |90:24144638 | Spiral spring for tube filter | 3 | PC | 43,2 | 129,6 | |90:22121763 | V-belt spz 1087 | 4 | PC | 5,91 | 23,64 | |90:MH0015 | Repair kit non-rotating cylinder ?40mm | 8 | PC | 14,3 | 114,4 | |0:|0:|
}
Add(Hub,10503466,252,91)
{
link(onEvent1,16215071:doOpenConsole,[(333,97)(333,104)])
link(onEvent2,12358217:doEnum,[(277,104)(277,111)])
}
Add(Memo,3647522,406,98)
{
Width=460
Height=166
Align=5
ScrollBars=3
}
Add(Button,12285898,287,147)
{
Left=265
Top=160
Align=4
Caption="Get text from console"
link(onClick,15767886:doWork3,[(333,153)])
}
Add(HubEx,15767886,329,112)
{
link(onEvent,16215071:doReadFromConsole,[])
}
Запуск консоли из программы.JPG