Michael, that may be the only remedy. But it isn't appropriate, as I will
explain later. 

I tried the SendMessage() approach, with WM_SETTEXT but it's not useful. 

Using a SendMessage(_hwnd, WM_SETTEXT, 0, "My new text") will work only if
the called process "allows" it - ie, has a method for setting its window
title. For example, the code works when sent to Notepad, until any event
within that application causes the window title to be updated. There is an
interesting article at stackoverflow
<http://stackoverflow.com/questions/1016823/c-how-can-i-rename-a-process-win
dow-that-i-started>  which got a bit pointless, with one antagonist
insisting that if he coded an event to check when Notepad's title changed,
he could just change it back again! 

CMD.EXE will actually allow its Title to be changed, but for the process
that I need to run (call it MyExternalProcess) I must get its error messages
passed directly back to my .NET application. With a batch file (using CMD)
to run MyExternalProcess, I will lose that connection, I believe. Or, it
becomes more messy than the aesthetics of an informative title is worth. 

My initial idea was to use the (OS) C source for MyExternalProcess.exe and
compile for .NET so I can have in-process control (and perhaps better error
feedback), but it uses C99 extensions so has been compiled with MinGW - and
I see no way to get over that. 

 

  _____  

Ian Thomas
Victoria Park, Western Australia

  _____  

From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com]
On Behalf Of Michael Minutillo
Sent: Tuesday, November 30, 2010 9:59 AM
To: ozDotNet
Subject: Re: Setting CMD-window title

 

What about calling a batch file that sets the title (using the TITLE
command) and then runs your normal command http://ss64.com/nt/title.html

 





On Tue, Nov 30, 2010 at 8:51 AM, Mark Hurd <markeh...@gmail.com> wrote:

On 30 November 2010 11:20, Mark Hurd <markeh...@gmail.com> wrote:
> Back in VB6 the App object was available to libraries to use, and so
> they could adjust App.Title. I never did get around to work out what
> it did and whether it was possible to replicate in .NET (i.e. allow an
> assembly to adjust the main application's title).

Just confirming: I'm talking normal Windows applications, not a CLI app.


--
Regards,
Mark Hurd, B.Sc.(Ma.)(Hons.)

 

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1170 / Virus Database: 426/3286 - Release Date: 11/28/10

Reply via email to