The MASM Forum

General => The Campus => Topic started by: raleep on October 07, 2012, 01:39:35 AM

Title: Displaying Text in XP Taskbar
Post by: raleep on October 07, 2012, 01:39:35 AM
I want to display text in the XP taskbar after the executable name, for example, "lll c:\RDF", "lllSTABLE g:\...\fin", etc.

Can anyone help me get started researching how to do this?  I have not had much luck on msdn or in the SDK.

Thanks.
Title: Re: Displaying Text in XP Taskbar
Post by: TouEnMasm on October 07, 2012, 03:30:25 AM

Don't see really what you want to do.The taskar show the window title of the program being excuted.To modify this text,modify the title of the executable.
Title: Re: Displaying Text in XP Taskbar
Post by: dedndave on October 07, 2012, 04:32:18 AM
just set the window caption text (SetWindowText) - that is what gets displayed in the taskbar
Title: Re: Displaying Text in XP Taskbar
Post by: TouEnMasm on October 07, 2012, 05:36:52 AM

in the program ,no problem  invoke sendmessage,hwnd,WM_SETTEXT,,
By an outside prog you need to hook the program to know it's class.
and then EnumWindows GetClassName
Perhaps is there better way.
Title: Re: Displaying Text in XP Taskbar
Post by: jj2007 on October 07, 2012, 05:52:35 AM
Quote from: ToutEnMasm on October 07, 2012, 05:36:52 AM
By an outside prog you need to hook the program to know it's class.
and then EnumWindows GetClassName
Perhaps is there better way.

Is there better way:

include \masm32\MasmBasic\MasmBasic.inc   ; download (http://masm32.com/board/index.php?topic=94.0)
   Init
   .If WinByTitle("Post reply -")
      SetWin$ eax="Salut Yves"
   .endif
   Exit
end start

No hook needed.
Title: Re: Displaying Text in XP Taskbar
Post by: qWord on October 07, 2012, 06:14:39 AM
Quote from: jj2007 on October 07, 2012, 05:52:35 AMIs there better way:
as dave said, the best way is: SetWindowText() (http://msdn.microsoft.com/en-us/library/windows/desktop/ms633546(v=vs.85).aspx)  :bgrin:
Title: Re: Displaying Text in XP Taskbar
Post by: raleep on October 07, 2012, 06:58:42 AM
Quote from: dedndave on October 07, 2012, 04:32:18 AM
just set the window caption text (SetWindowText) - that is what gets displayed in the taskbar

That works!

Thank you.

(I am happy to have the text in the title bar also.)
Title: Re: Displaying Text in XP Taskbar
Post by: jj2007 on October 07, 2012, 07:07:38 AM
Quote from: qWord on October 07, 2012, 06:14:39 AM
Quote from: jj2007 on October 07, 2012, 05:52:35 AMIs there better way:
as dave said, the best way is: SetWindowText() (http://msdn.microsoft.com/en-us/library/windows/desktop/ms633546(v=vs.85).aspx)  :bgrin:

That works, sure, but in any case you never need a hook to perform that simple task ;-)

include \masm32\MasmBasic\MasmBasic.inc   ; download (http://masm32.com/board/index.php?topic=94.0)
  Init
  .If WinByTitle("Untitled")   ; needs a new file in qEditor
   .if rv(GetDlgItem, eax, 1F4H)
      xchg eax, ecx
      SetWin$ ecx=FileRead$("\masm32\include\Windows.inc")   ; Try that with SetWindowText ;-)
   .endif
  .endif
  Exit
end start
Title: Re: Displaying Text in XP Taskbar
Post by: qWord on October 07, 2012, 08:03:11 AM
Quote from: jj2007 on October 07, 2012, 07:07:38 AMSetWin$ ecx=FileRead$("\masm32\include\Windows.inc")   ; Try that with SetWindowText ;-)
Your wish is my command:
include \masm32\include\masm32rt.inc
.data?
    hInstance   HINSTANCE ?
.code
DlgProc proc uses edi ebx edi hDlg:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM

    .if uMsg == WM_CLOSE
        invoke EndDialog,hDlg,0
    .elseif uMsg == WM_INITDIALOG
        mov edi,rv(GetDlgItem,hDlg,100)
        invoke GlobalFree,ASM(mov rv(SetWindowText,edi,ASM(mov ebx,InputFile("\masm32\include\Windows.inc"))),ebx) ; ;-D
    .else
        xor eax,eax
        ret
    .endif
    mov eax,1
    ret
   
DlgProc endp

main proc
    mov hInstance,rv(GetModuleHandle,0)
    Dialog "SetWindowText","Arial",10,WS_SYSMENU OR DS_CENTER,1,0,0,220,220,1024
    DlgEdit WS_BORDER or ES_MULTILINE,0,0,200,200,100
    CallModalDialog hInstance,0,DlgProc,0
    invoke ExitProcess,0
main endp
end main

8)
Title: Re: Displaying Text in XP Taskbar
Post by: jj2007 on October 07, 2012, 05:23:18 PM
Not bad, young friend, really not bad :t

Note, however, that my proggie (in response to ToutEnMasm's claim that you need all sorts of complicated stuff - hooks, class info etc) sets the text in the child window of another process - and that would indeed fail miserably with SetWindowText, as you certainly know ;-)
:icon14:

P.S.: I attach the MasmBasic equivalent to your dialog example. Here is the source code:

include \masm32\MasmBasic\MasmBasic.inc        ; download (http://masm32.com/board/index.php?topic=94.0)
  Init
 DlgDefine "Resources", 0, 0, 500, 200
  DlgControl dcEdit, Cat$(FileRead$("DlgTest.rc")), ES_MULTILINE, 1, 1, 100.0, 100.0   ; DlgTest.rc must be a Unicode text file
  DlgShow
  Exit
end start
Title: Re: Displaying Text in XP Taskbar
Post by: TouEnMasm on October 07, 2012, 06:27:33 PM
Quote
in response to ToutEnMasm's claim that you need all sorts of complicated stuff - hooks, class info etc
Don't write only lies.I was  just asking what was the exact need.
just read the title of a window to get his handle is not the only way to do and couldn't be apply to all case.
There is a number of functions in the sdk who are abble to solve any case.
Title: Re: Displaying Text in XP Taskbar
Post by: jj2007 on October 07, 2012, 06:49:25 PM
Quote from: ToutEnMasm on October 07, 2012, 06:27:33 PM
Don't write only lies.I was  just asking what was the exact need.

See your reply #3.
Title: Re: Displaying Text in XP Taskbar
Post by: TouEnMasm on October 07, 2012, 07:23:28 PM

This is of better use than your library:
http://vbsedit.en.softonic.com/ (http://vbsedit.en.softonic.com/)
Title: Re: Displaying Text in XP Taskbar
Post by: jj2007 on October 07, 2012, 08:26:51 PM
Looks nice, Yves. Is that what you are using nowadays? Unfortunately it doesn't assemble with JWasm :(
Title: Re: Displaying Text in XP Taskbar
Post by: TouEnMasm on October 08, 2012, 03:42:39 AM

Quote
Unfortunately it doesn't assemble with JWasm
Try masmbasic,he surely assemble it  :lol:
Title: Re: Displaying Text in XP Taskbar
Post by: Gunther on October 08, 2012, 04:43:59 AM
Hi TotEnMasm,

Quote from: ToutEnMasm on October 08, 2012, 03:42:39 AM
Try masmbasic,he surely assemble it  :lol:

are you sure? I've strong doubts.

Gunther