I want to change the title of my VS 2015 isolated shell application dynamically.So I tried using SetWindowText() but it doesn't work for me.I thought that there may be some problem in my project and so I created simple isolated shell app.Then I added
following lines of code.SetWindowText() returns true but it is not changing the title of title bar.I even tried to get the title through GetWindowText() after SetWindowText() and it is returning the new title but it is not updated in the title bar.I don't
know where I am going wrong.Please Help me..
private static extern bool SetWindowText(IntPtr hWnd, string lpString);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern bool GetWindowText(IntPtr hWnd, StringBuilder sb,int size);
private void MenuItemCallback(object sender, EventArgs e)
{
AboutBox aboutBox = new AboutBox();
aboutBox.ShowModal();
EnvDTE.DTE dte;
dte = Package.GetGlobalService(typeof(DTE)) as DTE;
StringBuilder sb = new StringBuilder(10);
String WindowTitleText = null;
GetWindowText(new System.IntPtr(dte.MainWindow.HWnd), sb, 10);
WindowTitleText = sb.ToString();
bool a = SetWindowText(new System.IntPtr(dte.MainWindow.HWnd), "Hello");
GetWindowText(new System.IntPtr(dte.MainWindow.HWnd), sb,10);
WindowTitleText = sb.ToString();
}
Even I tried using Timer.Nothing works for me.