[ros-diffs] [janderwald] 34192: If there is no process name passed in, try to obtain the console title. If that does not work either, use default of cmd.exe as a title. - fixes bug 3397

janderwald at svn.reactos.org janderwald at svn.reactos.org
Sun Jun 29 19:26:38 CEST 2008


Author: janderwald
Date: Sun Jun 29 12:26:38 2008
New Revision: 34192

URL: http://svn.reactos.org/svn/reactos?rev=34192&view=rev
Log:
If there is no process name passed in, try to obtain the console title. If that does not work either, use default of cmd.exe as a title.
- fixes bug 3397

Modified:
    trunk/reactos/dll/cpl/console/console.c

Modified: trunk/reactos/dll/cpl/console/console.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/console/console.c?rev=34192&r1=34191&r2=34192&view=diff
==============================================================================
--- trunk/reactos/dll/cpl/console/console.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/console/console.c [iso-8859-1] Sun Jun 29 12:26:38 2008
@@ -168,6 +168,7 @@
 	PROPSHEETHEADER psh;
 	INT i=0;
 	PConsoleInfo pConInfo;
+	WCHAR szTitle[100];
 	PConsoleInfo pSharedInfo = (PConsoleInfo)wParam;
 
 	UNREFERENCED_PARAMETER(uMsg);
@@ -222,17 +223,24 @@
 	ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
 	psh.dwSize = sizeof(PROPSHEETHEADER);
 	psh.dwFlags =  PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
-
 	if(_tcslen(pConInfo->szProcessName))
 	{
 		psh.dwFlags |= PSH_PROPTITLE;
 		psh.pszCaption = pConInfo->szProcessName;
-  	}
+	}
+	else
+	{
+		if (!GetConsoleTitleW(szTitle, sizeof(szTitle)/sizeof(WCHAR)))
+		{
+			_tcscpy(szTitle, _T("cmd.exe"));
+		}
+		szTitle[(sizeof(szTitle)/sizeof(WCHAR))-1] = _T('\0');
+		psh.pszCaption = szTitle;
+	}
 
 	psh.hwndParent = hwnd;
 	psh.hInstance = hApplet;
 	psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON));
-	psh.pszCaption = 0;
 	psh.nPages = 4;
 	psh.nStartPage = 0;
 	psh.ppsp = psp;



More information about the Ros-diffs mailing list