XPost: comp.langpascal.misc, comp.lang.pascal.delphi.misc   
   From: fv@nospam.tcenl.com   
      
   Dr John Stockton schreef:   
   > JRS: In article , dated Fri, 10 Mar   
   > 2006 17:13:46 remote, seen in news:comp.lang.pascal.borland, Femme   
   > Verbeek posted :   
   >   
   >>eljainc schreef:   
   >   
   >   
   >>>I have a DOS Real mode program written with Borland Pascal 7. Running   
   >>>concurrently is a Windows application (not a console app) written with   
   >>>Delphi Professional 5. The Delphi program is waiting for an event from   
   >>>the DOS program, but it needs to monitor it very often (almost real   
   >>>time). I tried file based I/O trapped in a loop but the CPU utilization   
   >>>on the Delphi application becomes close to 100%. My Delphi program   
   >>>basically has the structure like the following:   
   >>>   
   >>   
   >>A BP program can start any 32 bit windows program simply with exec(....)   
   >>If you know how to do it between two windows programs, a very simple   
   >>method would be to let the BP application start a tiny 32 bit   
   >>consolemode progam at the moment the event should occur. The 32 bit   
   >>program creates the event for the dos program e.g. by putting a message   
   >>on the windows clipboard or in shared memory.   
   >   
   >   
   > Since a message can be conveyed with a Longint or a short ShortString,   
   > ISTM that it should be practical and could be useful for someone to   
   > write a minimal such 32-bit program, with a parameter to identify (if   
   > appropriate) the means of transfer, a parameter for the data type, and a   
   > parameter for the date -- or whatever parameters are actually needed.   
   >   
      
   Why so difficult. Just a string containing any information you like   
   makes it a universal tool   
   ok, here it is:   
      
      
   program Msg2Clip;   
   {Delphi console mode program }   
   {This program copies the paramstring to the windows clipboard}   
   {To compile from the dos prompt type DCC32 Msg2clip }   
   {$APPTYPE CONSOLE}   
   uses clipbrd;   
   begin   
    clipboard.astext:=cmdline;   
   end.   
      
      
   Probably the shortest program I ever made, but still in Delphi 6 it   
   compiles to 390 KB.   
   Is there anyone with FP installed that would like to try this? In the   
   end, the compiler does not matter as long as it is 32bit windows native.   
      
   Run it from a bp application in the following way   
      
   Program testmsg;   
   uses dos;   
   {$M 8192,0,0}   
   begin   
    swapvectors;   
    exec(getenv('COMSPEC'),'/c msg2clip.exe Hello World');   
    swapvectors;   
   end.   
      
   The resulting string on the windows clipboard is something like   
      
   C:\BP\MYDIR\MSG2CLIP.EXE Hello World   
      
   So all the running windows program has to do is check the clipboard for   
   a string containing MSG2CLIP   
      
      
   -- Femme   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|