1414// #define WIN32_LEAN_AND_MEAN
1515#define SECURITY_WIN32
1616#include <Windows.h>
17- #include <strsafe.h>
18- #include <Lmcons.h>
19- #include <security.h>
2017
2118/* Variables */
2219// Global
@@ -37,7 +34,7 @@ HWND hWndMDIClient = NULL;
3734 wWinMain -
3835 Program Manager's entry point.
3936\* * * */
40- int WINAPI wWinMain (HINSTANCE hInstance , HINSTANCE hPrevInstance , LPWSTR lpCmdLine , int nCmdShow )
37+ int WINAPI wWinMain (_In_ HINSTANCE hInstance , _In_opt_ HINSTANCE hPrevInstance , _In_ LPWSTR lpCmdLine , _In_ int nCmdShow )
4138{
4239 MSG msg = { 0 };
4340 HANDLE hAccel ;
@@ -46,9 +43,6 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
4643 WNDCLASS wc = { 0 };
4744 WCHAR szBuffer [MAX_PATH ];
4845 WCHAR szClass [16 ];
49- WCHAR szUsername [UNLEN + 1 ] = L"" ;
50- DWORD dwUsernameLen = UNLEN ;
51- WCHAR szWindowTitle [UNLEN + ARRAYSIZE (szAppTitle ) + 4 ] = L"" ;
5246 RECT rcRoot ;
5347 POINT ptOffset ;
5448
@@ -58,7 +52,6 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
5852 LoadString (hAppInstance , IDS_PMCLASS , szClass , ARRAYSIZE (szClass ));
5953 LoadString (hAppInstance , IDS_APPTITLE , szAppTitle , ARRAYSIZE (szAppTitle ));
6054 LoadString (hAppInstance , IDS_WEBSITE , szWebsite , ARRAYSIZE (szWebsite ));
61- GetUserNameEx (NameSamCompatible , szUsername , & dwUsernameLen );
6255
6356 // Get Desktop background color
6457 //CreateSolidBrush(GetBackgroundColor
@@ -91,15 +84,6 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
9184 return FALSE;
9285 }
9386
94- // Add username to window title if settings permit
95- StringCchCopy (szWindowTitle , ARRAYSIZE (szAppTitle ), szAppTitle );
96-
97- if (bShowUsername )
98- {
99- StringCchCat (szWindowTitle , ARRAYSIZE (szWindowTitle ), L" - " );
100- StringCchCat (szWindowTitle , ARRAYSIZE (szWindowTitle ), szUsername );
101- }
102-
10387 // Get size of the root HWND
10488 GetWindowRect (GetDesktopWindow (), & rcRoot );
10589
@@ -109,7 +93,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
10993
11094 // Create main window with a default size
11195 // NOTE: i pulled 320x240 out of my ass, make this dynamic later
112- if (!CreateWindow (wc .lpszClassName , szWindowTitle , WS_OVERLAPPEDWINDOW | WS_VISIBLE ,
96+ if (!CreateWindow (wc .lpszClassName , szAppTitle , WS_OVERLAPPEDWINDOW | WS_VISIBLE ,
11397 rcRoot .left + ptOffset .x , rcRoot .top + ptOffset .y ,
11498 rcRoot .left + ptOffset .x + 320 , rcRoot .top + ptOffset .y + 240 ,
11599 0 , 0 , hAppInstance , NULL ))
@@ -126,13 +110,15 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
126110 hMenu = GetMenu (hWndProgMgr );
127111 hSystemMenu = GetSystemMenu (hWndProgMgr , FALSE);
128112
129- // Update our menu checkmarks
113+ // Update relevant parts of the window
130114 UpdateChecks (bAutoArrange , IDM_OPTIONS , IDM_OPTIONS_AUTOARRANGE );
131115 UpdateChecks (bMinOnRun , IDM_OPTIONS , IDM_OPTIONS_MINONRUN );
132116 UpdateChecks (bTopMost , IDM_OPTIONS , IDM_OPTIONS_TOPMOST );
133117 UpdateChecks (bShowUsername , IDM_OPTIONS , IDM_OPTIONS_SHOWUSERNAME );
134118 UpdateChecks (bSaveSettings , IDM_OPTIONS , IDM_OPTIONS_SAVESETTINGS );
135119
120+ UpdateWindowTitle ();
121+
136122 // Update settings based on their values
137123 if (bTopMost )
138124 SetWindowPos (hWndProgMgr , HWND_TOPMOST , 0 , 0 , 0 , 0 , SWP_NOMOVE | SWP_NOSIZE );
0 commit comments