Вверх ↑
Ответов: 783
Рейтинг: 168
#1: 2023-10-29 15:06:58 ЛС | профиль | цитата
Для вывода данных на консоль можно воспользоваться функцией - WriteConsole.
С её помощью можно выводить строковые данные в любом месте, где предварительно установлен курсор (функция - SetConsoleCursorPosition)
Пример вывода на экран текста в одной и той же позиции.
Add(MainForm,10748406,140,175)
{
Width=476
Height=175
Visible=1
Caption="run Forrest, run!"
link(onCreate,469673:doEvent1,[])
}
Add(InlineCode,16215071,448,189)
{
WorkPoints=#13:doOpenConsole|16:doWriteToConsole|13:doFreeConsole|
EventPoints=#7:onEvent|
DataPoints=#3:Str|
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|0:|22:Str,onEvent:THI_Event;|0:|54:Procedure doOpenConsole (var _Data:TData; Index:word);|57:Procedure doWriteToConsole (var _Data:TData; Index:word);|54:Procedure doFreeConsole (var _Data:TData; Index:word);|0:|5: end;|0:|14:implementation|0:|67:Procedure THiAsmClass.doOpenConsole (var _Data:TData; Index:word);|14:var C : COORD;|19: R : SMALL_RECT;|23: hConsole : Integer;|5:Begin|16: AllocConsole;|47: hConsole := GetStdHandle(STD_OUTPUT_HANDLE);|15: R.Left := 0;|14: R.Top := 0;|17: R.Right := 80;|18: R.Bottom := 30;|31: C.X := R.Right + 1 - R.Left;|31: C.y := R.Bottom + 1 - R.Top;|43: SetConsoleScreenBufferSize(hConsole, C);|46: SetConsoleWindowInfo(hConsole, True, R); |55: //SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE),4);|65: //SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),10);|22: SetConsoleCP(1251);|28: SetConsoleOutputCP(1251);|51: SetConsoleTitle( PChar( 'run Forrest, run!' ) );|4:end;|70:Procedure THiAsmClass.doWriteToConsole (var _Data:TData; Index:word);|3:var|13: C: _COORD;|21: Hnd, Wr: Cardinal;|15: Buf: String;|5:Begin|40: Hnd:=GetStdHandle(STD_OUTPUT_HANDLE);|10: C.X:=0;|10: C.Y:=0;|24: Buf:=ToString(_Data);|29: //Buf:=ToStringEvent(Str);|35: SetConsoleCursorPosition(Hnd,C);|58: WriteConsole(Hnd,PChar(Buf),StrLen(PChar(Buf)),Wr,nil);|87://WriteConsole(Hnd,PChar(ToStringEvent(Str)),StrLen(PChar(ToStringEvent(Str))),Wr,nil);|50://FillConsoleOutputAttribute(Hnd,15+4*16,10,C,Wr);|0:|4:end;|67:Procedure THiAsmClass.doFreeConsole (var _Data:TData; Index:word);|5:Begin|15: FreeConsole;|4:end;|0:|4:end.|
}
Add(Hub,469673,189,189)
{
OutCount=3
link(onEvent1,16215071:doOpenConsole,[])
link(onEvent2,7301401:doTimer,[(228,202)(228,209)])
}
Add(StreamArray,7682180,336,140)
{
Streams=['1'=[ZIP4604000078DAB5933B6E04410844734B7B07672425B4311C620E01D92075DAC77775CBFB75EFEC26269860782AA0A04F5FDFCB405698EBDD9FD39A5478ED5BC72724A2EF29EF49844744BD255505D6EAA1CD25A923507B7B438A99108467AF83D955DC1C833437A286596041226031D230A22D335BE377883F5757E60322561545D0847ECD8EFFF4C9F20658EEC9D2804E737535915085BADB96CDF4709B96541C85F7F379CBC06B124549EEC7A2F5091BD6A4BA4F307C8C4FEDDE134B3FE9A60D7264E9A97BE4EF9DDCC8B117508BB33BF47A53D56F24119A3D6FA7B5A022EEAF8FF65FAA7369CCFB0CD675D1077711EDA259394011B9ADF8FE0E1057CDAAA7437CF22238BCCE6DC61138CCE0F4E346D8A71D80F3458D9057EF6811FF43FE00DD2BBAF3],'2'=[ZIP4604000078DA8D92316EC4400845FB487B077734086D0D87F021A01B24DA397EFED81BC7ABC49EA5B1653FF1F91F1E5FCBBF25E4DDE5FCE57145AAC75A342785C962ED67F4AA2799BA67CA849474D32A2399A893DA106F3975442C421CADEC9E24832AC86C75EF5D54153D99B57AAFF12A72457AA9109CAB6705AA625BC15F755633D668914AC49A5975419232225AD7D794D7EA8B1852CFDE7A2BBEF70E92316BB4E7B3D5ED8EA0CEAAE99A60BBC91B8964DC791F08EF9813BE159B8FF6DB7690EC11BD12A5963D06E9E9303ED8E083142DC74FC8D9B89F423AE3417BB63DE8203914B2B2D5E833A43D6D37A771221779B72EC6CCBB111C951F677275C9C70DD4CFA0B7E4428E3BB14F4834451808704EBA6F07D579462EAF4CC64E66E479EFDF023ABCF3],'3'=[ZIP4604000078DA8D923B8E04310844F395E60E9D91200E501CC28780CC48A43EFE626947F3D9EEB609ADA7C255D4E3E7381FA11A797B785C90028B31B0432A476B4E5BA445E49214524400900529A68431928FC53FCBB6B0B791BA229945B42423E89E5490482D0F5B9002A57264EE8E45F215106B94A28F04CB8DA6AA225BCB0ACABD3E21D72431E67D540891F94CFF846422D6EC7D5E9D98E9BFA6D4FCA1C2C8D1BB9D3AE232D047946F612D55CBDEFA4997C4C2E600B317199877F73EF49BAC60682EAFADA62868866496FE867E3B2ABA7E5939A13694B6AC5A376B87F4DC68F241A616BB24C264870C98F3B1455A7EB4FE8EAC94FCE5FE92E4AAFCEC87BDC85F178DBAE8],'4'=[ZIP4604000078DA8D9331AEC3300C43F702B9C3DFB4083A0075881E42DE2240AB8F5F3A28D0FCD6A9EB2DC6034D52CA76FBBB382662E7EFED8234D7ECA5BF90AA79BF77F9491355B52269D11109852D484978F54A5925A247B4BD55F98A94C8D63332FF897E921651FB5E8888B3CD19E940D065C4D2270B1267EDD9173ECD9D15556BAD02FA9D1445EEFB20B35E56272437832C458BB55E9266A34E311367AA8E4B9F68BDA0EA3A0E88A64D49CB9123D923469B99446BF6BA45712C1053F8919F706B3AD3F48A63CDA91DF043173A4FF4BCF5C0187ABA7D9FE6B17324F5ED7ABA21E3E1777042521299614BD2463BA7C8D7A4B04F92F46A4B12E36FFB94DD6E0F6580BC98],'5'=[ZIP4604000078DA85933D8EC5300884FB95DE1DD2D1200E0087C821A03312AD8FFFC62BEDBE9FD88E8B14C9273C334C1E3FC7F4901111CBDB9BC78A748FD6F49E14268BB395DC9366EA9E7E4B8AA557BADDE924F58C1E157C6C49D2EAAD977B95ED48518F9EAE9099F931F432139E9B224A18BAD129AC51C606E3992CB2D1290C85593D7CC4E4884B962443EA79462AB329F4D29224F36AEDC48A5449FE04CC52821F0C738405F8BF2513D261C79113E8444B7AC99AD4ACC032A1B102873724021AE0C814CFC54C0133BE1BE2517E19BA90A499881351AA88ACF72EA39420510EF956F541021C05860DBD76F19DA4A1CF7F15CA8E24B41C6EE8589C17891F22BF6ABEBA5DB4A2CFEE9DE82C78E9BC249FE54EC0AB],'6'=[ZIP4604000078DA85933DAEC4300884FB27ED1DD2D1200E0087D8434067245A1FFF8D93FD71946C421129D6670606FCF85BCEC3B254E683C70F522CDBB3E49E1426EDADBBDC929CE6AE197C4D8A40BB2AF9A64E41AA8AA80A5B2E48610595AE66E0E98AB46AA12C64EAEE57243B5A4681C48354231136E5D39C5ACD894833DDD84CF1D1E2B38E382399355AF8C8889CAC2667A478942A06D4636FD381B470876856F4F644E20F7D2051D4162BDE5B6BAF4D399064E6E866756AE01E3DCE7A5F48E164BAF33A55551B659FE4C488208A849BE794E8AD5EA39A4832AF72D3CD94D506FCF97BA13F240DCD51A0C977ED514ADAAE77611F8CC21F9A5C18E239BB2450CD31669E578270085775765ED06DD67E73B6FBD57B7F4F6A55A7F9EEEC84C708FE92B83EBF98FD4311D94D5364B98B5FEFFD8CFC074EAAC528],'7'=[ZIP4604000078DA8DD331AEC3300806E0FD49BD433616C401E0103904DE8CC4EAE3F7A74DD5B472FC6A75AABED83F18DFFEB6E9B2E1AA72FEE73697C2167D4FF945928FDEF87F496EEE1AB4942242ACD1D28D97A793B7D632EBA7DBA222D1847335AB5D69295B4F252153777F4A2199CAE8C3B992421A33137B864C7292B611901A0188101544655A5136674388860F8E35AF5D20CDB3EFA3E8AA4BA2CA38D573F47DEFF9C613C95508B47AB6DED10A9E4A518878D48D5A4A8F31782229F4D149B41453A2A46E311A9DA560CE2A9E17347AA5B3384BC669E6A138356BCBB0531884C83CA444266EBA52B9D520D1D7487B1C92020BEEDDE30F49A42FA99126DBE5C2A679DCA63E07E0529AE5C0B5312A9215AC99F12AC42EDED1D773A9CD7E90EBB73995776658C0A4],'8'=[ZIP4604000078DA8D92316EC4500844FB487B87ED6810078043F810D0198996E367FECFAEEC689DEF50DA4FC3307F1E5FCFCB11D276397F795C93A2EEBD05DD939C64B175D12DF924836AA6AC496156CF4A26596FA70C4C47DD5C445ED17BB87A94AD3429AB4399A74D5F9248A74D084EDD979A629AA14496E95E690675964B9F620060725A7557D8C86B72EC8FEE6D1BB76398E5AF94B0BFA262DFB6D6F5BB0B2EC76841B7F8931439B68F84465030BB1F2FFF43E2593A59E698E2268C9B0D36F4ECD32A610DB1F8C8DD0DD52815840ACBFDAE1E48193F7CB4420D6916D2C90C9BDDB3ECE08334A6D19AB99BA692E7DC09CB1E27F2E3F831AF128C1DB46EF23B5AA0FF21912DC8D7F16B1228AECFD9FD1B921C6457A124779A7857BC80F1ADE6AF867C03560CC4AC],'9'=[ZIP4604000078DA8D93BDAD03410884734BEEC11909A280A1882B02B28744BAE57BF602CBD6BB9FDDF0F4313003F77CBC8E9F099F7D7D789E90165163608574AD6D4B5922A3AA6F49132707C06E480D448E2E7FDDCCE915FD37BAFB8EF4EA319ADEABE4929488B1251064AF49032AA7E62F78D45DA0BA1B4AD8A57726E9881EC939ABCBAE487154E77405DAB27352C54441BD648D1C692AA0B65B129B4BE2A847B7645ACD18CB7D3657119D68FD7764E82A8E15CC91251DAC209A5F8BFF90AA8C844D29C8EBD88B26AAE729CD119D9413A5BADC5D9D0938C8CF8D9C5D32D7CF544BD6488F5E216D3A6A5DD1E4CFD1892532787C19B015B233FB93E8F3F106B2BABDFE],'10'=[ZIP4604000078DA8D9231AE03310844FB48B9433A1AC401E0103E04EE3C122DC70FFEFA52B22B6FBCEE2C3D0DCC30CFC7EBE209917CFF9F17A4182383EF90CC682DE996A646C48E14615387B2CA86A4823C3B68E74898C872F4B03B2446070EA22BB282E418E1FEBDE68A142321ED19DB3D4599B8AC17CB3FBD8B9929C68047B12EBF48328DD67A04A277C8354954C3638C4C987F444FA488CC90CA51646BB5275D4C2FC709552B559F68EADA91A03AD1036E15BD02912375A5295EA0335746AE6C15BC23B09C4E66F49FA89BCD2ED1A64BA4EE0E1C6EB924AB73B39DC75B2E49ABD1EAC7CA2D49C2DF39F5B523C5BDB8F3922B92305B54A9DA3D32673FCEDEDF786CBAC3],'11'=[ZIP4604000078DA8593318AC4300C45FB85B9833B35424C2D1DC28790BB08D4EAF8FB1D966586C48E8B049CC7FFD297F2FA69B7878C88583E6E5E2BD27D1CA5CFA430D9E847D2B3A6B0B987CB1329421AE1F65827BC615EF909DE91C20C4DAB236D4F8A1B4D725424EF483027C951559FE88564D75094A9EA39C0AAFEE57FD5743763CB4ABC23728C1A6758D73AD9D9347BCF3099F522AEA0FB8E6C7E3D702A54CE7057BD1BB13A4CFBFBDD87F23A2552E269395BAA8ED973DB692A663E1F898E5CD69AA6EEAE86A4EC3FA49B9462F60E50753624B2AA934EDB694E429B0D41ECD84A1CA5CBE27C91733E308E31B86D499A8354C57E48DB911C98B47EFD10F724652616C25A7B22A766D55079D46CCD300F8C9B97E42F97F7BBB6],'12'=[ZIP4604000078DA8D933B8EC3300C44FB057287746C0822F5F0103E04D589005B1D7F474EB0B1B1CA875021D80FE4CC48BAFC5C976568156A872F9735698EEC5BD76F488DD147D84752C323904D3F9026A2A83CC95C9204CDB47A7E224D27A818C3DF91447427DD630CCCEEAF4847609280471BA3B596802C480198B80832E7F24054A5DBB2274091ADB397D8D5E6B2A5A39990A3B6AD95DBFBD39CB623C7E81BE9D0D7A4CDD9111951A3DF6E5BDBEDAC48510E8F08A6E4DC14EDCB9214DC411805D35C16B70B9231B211C95D9EE68CE8011E49F5191DFB3C3C1B2520E3DF19C934110C1BFEF8E71C9C2527EF3C652A6345E22F437040351C53B26CFBD0803EEFC3552B93C64FA4146FC17E74E7600DD50EE8EC19C57768AB373283383A225A4FE5AFEAEE5D1CF61DF94D5D7E7E01AA17C025]]
UseName=1
FileName="Forrest"
}
Add(Timer,7301401,238,203)
{
Interval=100
Enable=1
link(onTimer,14982586:doNext,[])
}
Add(ArrayRW,7552558,336,203)
{
link(onRead,6979404:doConvert,[])
link(Array,7682180:Array,[])
}
Add(CounterEx,14982586,287,203)
{
Max=11
link(onNext,7552558:doRead,[])
}
Add(StreamConvertor,6979404,385,203)
{
Mode=6
link(onResult,16215071:doWriteToConsole,[(424,209)(424,202)])
}

карма: 15

1
Голосовали:zhorik5
Редактировалось 2 раз(а), последний 2023-10-30 18:46:12