home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch      Fun with MS-DOS batch files      42,547 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 41,675 of 42,547   
   Herbert Kleebauer to pyotr filipivich   
   Re: how to get the title into task mange   
   23 Sep 18 09:04:29   
   
   XPost: alt.windows7.general   
   From: klee@unibwm.de   
      
   On 23.09.2018 03:07, pyotr filipivich wrote:   
      
   >>I already posted the few lines of source code. Here the   
   >>listing from the assembler which explains the meaning   
   >>of every byte in the 1024 byte exe:   
   >   
   > 	Wow.   
   >   
   > 	One more reason I don't like programming at the assembler level.   
   > B-)   
      
      
   What's wrong with this source code? It calls "GetCommandLine"   
   to get a pointer to the command line, then skips the program   
   name to get the pointer to the new title string given on   
   the command line. Then it gets the handle to the console   
   window (GetConsoleWindow), sets the new title (SetWindowTextA)   
   and terminates the program (ExitProcess). Anything else you see   
   in the list file is normally generated by the assembler and linker   
   (but if I want a small exe file to include it in a batch program,   
   I do it by hand). You can also write it as a two line C program, but   
   don't expect to get a 1 kByte binary.   
      
      
      
   winmain::   
      
             jsr.l   (GetCommandLine)   
                                     ; skip program name   
             eor.l   r1,r1           ; not within "" flag   
             dec.l   r0   
   _20:    inc.l   r0   
             cmp.b   #0,(r0)   
             beq.b   _10   
             cmp.b   #'"',(r0)   
             bne.b   _30   
             not.l   r1   
   _30:    or.l    r1,r1   
             bne.b   _20   
             cmp.b   #' ',(r0)   
             bne.b   _20   
             inc.l   r0   
      
   _10:    move.l  r0,-(sp)   
             jsr.l   (GetConsoleWindow)   
             move.l  r0,-(sp)   
             jsr.l   (SetWindowTextA)   
             moveq.l #0,-(sp)   
             jsr.l   (ExitProcess)   ; exit program   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca