View Single Post
  #5  
Old September 20th 18, 08:58 PM posted to alt.msdos.batch,alt.windows7.general
Herbert Kleebauer
external usenet poster
 
Posts: 27
Default how to get the title into task manger 'window'?

On 20.09.2018 00:09, pyotr filipivich wrote:

Use the title command within your batch to set the title to
any string you like.


I do.
setting
Title ZZ Home Agent Bat
results in the window title
Administrator: ZZ Home Agent Bat

how do I get "Administrator" to a) go away,
b) be short enough I can see which "window title" on the task bar
is which actual window?


Just looked up the Windows documentation. You can use SetWindowTextA
from User32.dll to change the title.

https://docs.microsoft.com/en-us/win...setwindowtexta

As long as the batch is running, the title is changed. When
the batch has finished, then the title is reset by CMD to the
original text. Here an example:

:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::

@echo off
certutil -f -decode %~f0 settitle.exenul

settitle.exe ZZ Home Agent Bat
pause

del settitle.exe
goto :eof

-----BEGIN CERTIFICATE-----
TVpgAQEAAAAEAAAA//8AAGABAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAoAAAAA4fug4AtAnNIbgBTM0hTmljZSB0by BtZWV0IHNvbWVi
b2R5IHdobyBpcyBzdGlsbCB1c2luZyBET1MsDQpidXQgdGhpcy Bwcm9ncmFtIHJl
cXVpcmVzIFdpbjMyLg0KJFBFAABMAQEAUHmlNgAAAAAAAAAA4A APAQsBBQwAAgAA
AAAAAAAAAADMEAAAABAAAAAgAAAAAEAAABAAAAACAAAFAAAAAA AAAAUAAAAAAAAA
ACAAAAACAAAAAAAAAwAAAAAAEAAAEAAAAAAQAAAQAAAAAAAAEA AAAAAAAAAAAAAA
GBAAADwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAQAAAYAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALnRleHQAAAACAQAAAB AAAAACAAAAAgAA
AAAAAAAAAAAAAAAAIAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABoEAAAAA AAAJgQAACqEAAA
vhAAAAAAAABgEAAAAAAAAAAAAABUEAAAABAAAIgQAAAAAAAAAA AAAHoQAAAIEAAA
AAAAAAAAAAAAAAAAAAAAAAAAAABVU0VSMzIuZGxsAABoEAAAAA AAAAAAU2V0V2lu
ZG93VGV4dEEAAEtFUk5FTDMyLmRsbAAAmBAAAKoQAAC+EAAAAA AAAAAAR2V0Q29t
bWFuZExpbmVBAAAAR2V0Q29uc29sZVdpbmRvdwAAAABFeGl0UH JvY2VzcwD/FQgQ
QAAx0khAgDgAdBGAOCJ1AvfSCdJ174A4IHXqQFD/FQwQQABQ/xUAEEAAagD/FRAQ
QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAA==
-----END CERTIFICATE-----

:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::

The source code:

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
Ads