tons of stuff here, most importantly now displays the username in the titlebar like old progman
This commit is contained in:
@@ -12,7 +12,11 @@
|
||||
#include "resource.h"
|
||||
#include "registry.h"
|
||||
// #define WIN32_LEAN_AND_MEAN
|
||||
#define SECURITY_WIN32
|
||||
#include <Windows.h>
|
||||
#include <strsafe.h>
|
||||
#include <Lmcons.h>
|
||||
#include <security.h>
|
||||
|
||||
/* Variables */
|
||||
// Global
|
||||
@@ -24,15 +28,23 @@ WCHAR szWebsite[64];
|
||||
// Window Related
|
||||
HICON hProgMgrIcon = NULL;
|
||||
HINSTANCE hAppInstance;
|
||||
HWND hwndProgMgr = NULL;
|
||||
HWND hwndMDIClient = NULL;
|
||||
HWND hWndProgMgr = NULL;
|
||||
HWND hWndMDIClient = NULL;
|
||||
|
||||
/* Program Entry Point */
|
||||
/* Functions */
|
||||
/* * * *\
|
||||
wWinMain -
|
||||
Program Manager's entry point.
|
||||
\* * * */
|
||||
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow)
|
||||
{
|
||||
MSG msg = { 0 };
|
||||
HANDLE hAccel;
|
||||
WNDCLASS wc = { 0 };
|
||||
WCHAR szClass[16];
|
||||
WCHAR szUsername[UNLEN + 1] = L"";
|
||||
DWORD dwUsernameLen = UNLEN;
|
||||
WCHAR szWindowTitle[UNLEN + ARRAYSIZE(szAppTitle) + 4] = L"";
|
||||
|
||||
hAppInstance = hInstance;
|
||||
|
||||
@@ -48,29 +60,47 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
|
||||
// Register the Frame Window
|
||||
wc.lpfnWndProc = WndProc;
|
||||
wc.hInstance = hAppInstance;
|
||||
wc.hIcon = hProgMgrIcon = LoadImage(hAppInstance, MAKEINTRESOURCE(PROGMGRICON), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED);
|
||||
wc.hIcon = hProgMgrIcon = LoadImage(hAppInstance, MAKEINTRESOURCE(IDI_PROGMGR), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED);
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)(COLOR_BACKGROUND);
|
||||
wc.lpszMenuName = MAKEINTRESOURCE(IDM_MAIN);
|
||||
wc.lpszClassName = szClass;
|
||||
if (!RegisterClass(&wc))
|
||||
return 1;
|
||||
return FALSE;
|
||||
|
||||
// Load the Accelerator table
|
||||
hAccel = LoadAccelerators(hAppInstance, MAKEINTRESOURCE(IDA_ACCELS));
|
||||
if (!hAccel)
|
||||
return FALSE;
|
||||
|
||||
InitializeRegistryKeys();
|
||||
//if (IsProgMgrDefaultShell) {
|
||||
|
||||
//}
|
||||
|
||||
GetUserNameEx(NameSamCompatible, szUsername, &dwUsernameLen);
|
||||
// OutputDebugString(szUsername);
|
||||
|
||||
StringCchCopy(szWindowTitle, ARRAYSIZE(szAppTitle), szAppTitle);
|
||||
StringCchCat(szWindowTitle, ARRAYSIZE(szWindowTitle), L" - ");
|
||||
StringCchCat(szWindowTitle, ARRAYSIZE(szWindowTitle), szUsername);
|
||||
|
||||
if (!CreateWindow(wc.lpszClassName,
|
||||
szAppTitle,
|
||||
szWindowTitle,
|
||||
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
160, 80, 640, 480, 0, 0, hInstance, NULL))
|
||||
160, 80, 640, 480, 0, 0, hAppInstance, NULL))
|
||||
return 2;
|
||||
|
||||
//hSystemMenu = GetSystemMenu(hwndProgman, FALSE);
|
||||
|
||||
while (GetMessage(&msg, NULL, 0, 0) > 0)
|
||||
DispatchMessage(&msg);
|
||||
{
|
||||
if (!TranslateMDISysAccel(hWndMDIClient, &msg) &&
|
||||
!TranslateAccelerator(hWndProgMgr, hAccel, &msg))
|
||||
{
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user