<div dir="ltr"><div class="gmail_default" style="font-size:large">Lol. That is not being done on purpose.</div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">To do it on purpose there are different ways depending upon your OS - windows I assume?</div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large"><pre class="gmail-lang-pascal gmail-prettyprint gmail-prettyprinted"><code><span class="gmail-pln">keybd</span><span class="gmail-pun">_</span><span class="gmail-pln">event</span><span class="gmail-pun">(Ord('A')</span><span class="gmail-pun">,</span><span class="gmail-pln"> </span><span class="gmail-lit">0</span><span class="gmail-pun">,</span><span class="gmail-pln"> KEYEVENTF</span><span class="gmail-pun">_</span><span class="gmail-pln">KEYDOWN</span><span class="gmail-pun">,</span><span class="gmail-pln"> </span><span class="gmail-lit">0</span><span class="gmail-pun">);</span><span class="gmail-pln">
keybd</span><span class="gmail-pun">_</span><span class="gmail-pln">event</span><span class="gmail-pun">(</span>Ord('A')<span class="gmail-pun">,</span><span class="gmail-pln"> </span><span class="gmail-lit">0</span><span class="gmail-pun">,</span><span class="gmail-pln"> KEYEVENTF</span><span class="gmail-pun">_</span><span class="gmail-pln">KEYUP</span><span class="gmail-pun">,</span><span class="gmail-pln"> </span><span class="gmail-lit">0</span><span class="gmail-pun">);<br><br></span></code></pre><pre class="gmail-lang-pascal gmail-prettyprint gmail-prettyprinted"><code><span class="gmail-pun">* Common mistake is to call it once, it must be both for it to register. (this is from some OLD code)... looking at FPC's site - keybd_event is deprecated.<br></span></code></pre><pre class="gmail-lang-pascal gmail-prettyprint gmail-prettyprinted"><code><span class="gmail-pun">This pay work:<br><a href="https://wiki.freepascal.org/MouseAndKeyInput">https://wiki.freepascal.org/MouseAndKeyInput</a><br><br> KeyInput.Apply([ssCtrl]);
 KeyInput.Press(VK_F1);                // This will simulate press of F1 function key.
 KeyInput.Unapply([ssCtrl]); <br><br></span></code></pre><pre class="gmail-lang-pascal gmail-prettyprint gmail-prettyprinted"><code><span class="gmail-pun">** Uses: MouseAndKeyInput, LCLType,<br></span></code></pre><pre class="gmail-lang-pascal gmail-prettyprint gmail-prettyprinted"><code><span class="gmail-pun">FROM LAZARUS being installed. <br></span></code></pre></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 26, 2020 at 4:41 AM Gerhard Scholz <<a href="mailto:gs@g--s.de">gs@g--s.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">(laughter)<br>
<br>
I know how to write console apps; I even know how to start them :-)<br>
{I have no experience with GUI progarms, but that's another story :-( }<br>
<br>
No, my question was: how did you put the "D" in the keyboard buffer? I would <br>
like to put out the next command<br>
<br>
<br>
----- Original Message ----- <br>
From: Ozz Nixon<br>
To: Gerhard Scholz<br>
Cc: FPC developers' list<br>
Sent: Sunday, April 26, 2020 8:31 AM<br>
Subject: Re: [fpc-devel] Windows Console App<br>
<br>
Sure! I assume you are asking how to make a console app?<br>
<br>
You do not need {$APPTYPE CONSOLE} ... instead, you simply write your code <br>
like normal:<br>
<br>
Program example;<br>
<br>
Uses<br>
   CRT;<br>
<br>
Begin<br>
   ClrScr;<br>
   Writeln('Wassup?!');<br>
   Readln;<br>
End.<br>
<br>
then in the command prompt (any OS), simply fpc example  .... then <br>
.\example, or ./example - depending upon your OS... voila. "Console App".... <br>
now, that is not a DOS 16bit APP... that requires other mess, and since I <br>
own Turbo Pascal 7.0 source, I have my own TP 32bit compiler that produces <br>
TP 7 compatible 16bit Units and Apps. ;-)<br>
<br>
<br>
@ you can get me at <a href="mailto:ozznixon@gmail.com" target="_blank">ozznixon@gmail.com</a> if you need any help (I do not <br>
normally code GUI apps - money in the Legacy market) so I have made a wide <br>
range of solutions. This email was started because of something odd on <br>
Windows recently for me...<br>
<br>
<br>
<br>
Ozz<br>
<br>
<br>
On Sun, Apr 26, 2020 at 1:27 AM Gerhard Scholz <<a href="mailto:gs@g--s.de" target="_blank">gs@g--s.de</a>> wrote:<br>
<br>
Hi,<br>
<br>
I would like to know how you did that since it was exactly what I was<br>
searchomg for a while ago...<br>
<br>
Could you send me a piece of code?<br>
<br>
Greetings<br>
<br>
Gerhard<br>
<br>
<br>
----- Original Message ----- <br>
From: Ozz Nixon via fpc-devel<br>
To: FPC developers' list<br>
Cc: Ozz Nixon<br>
Sent: Sunday, April 26, 2020 2:21 AM<br>
Subject: [fpc-devel] Windows Console App<br>
<br>
<br>
Anyone ever experience making a console app (cross-platform), but, on<br>
windows when the app finishes, it appears to have put an uppercase C or D in<br>
the keyboard buffer, so the Prompt now has C:\>D<cursor>  ???<br>
<br>
<br>
Every time I run my app, be it show help screen and end, or actually<br>
execute - when it finishes I end up with a letter sitting at the prompt. (A<br>
few months ago, I was having a problem, and it was related to compiling all<br>
of the methods with cdecl. That build would leave a stray "C" at the start<br>
of the prompt upon exiting. Now, I ran into a new problem where I needed to<br>
recompile with -FcUTF8 to track down which units it thought were having a<br>
UTF-8 mismatch... it was showing the wrong unit until I used the -FcUTF8<br>
compile option, then it actually showed what file had '<highbit ascii>'<br>
strings ... so I switched to #<byte_number> and it compiles, but, the<br>
prompts have "D" at the start of them now.    (hopefully I described that<br>
understandable).<br>
<br>
<br>
Environment: Windows XP 32bit<br>
C:\FPC\3.0.4\bin\i386-Win32\fpc.exe<br>
<br>
<br>
<br>
If no one else has experienced/has a solution, I will sit down and bang out<br>
test cases until I find what combination (units, code, whatever) is<br>
producing this result.<br>
<br>
<br>
Ozz<br>
<br>
<br>
<br>
_______________________________________________<br>
fpc-devel maillist  -  <a href="mailto:fpc-devel@lists.freepascal.org" target="_blank">fpc-devel@lists.freepascal.org</a><br>
<a href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel" rel="noreferrer" target="_blank">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a> <br>
<br>
</blockquote></div>