Skip to content

Commit

Permalink
Major overhaul, XP dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
aubymori committed Oct 19, 2023
1 parent 3c23dc7 commit e63a325
Show file tree
Hide file tree
Showing 23 changed files with 1,526 additions and 620 deletions.
908 changes: 310 additions & 598 deletions ClassicShutdown.cpp

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions ClassicShutdown.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <windows.h>
#include "resource.h"

#ifndef _ClassicShutdown_
#define _ClassicShutdown_

extern HWND g_hDesktopWnd, g_hDlg;
extern HBITMAP g_hbDesktop;
extern HINSTANCE g_hAppInstance, g_hShell32;
extern BOOL g_bLogoff;
extern LPDWORD g_dwRes;

typedef enum tagSHUTDOWNSTYLE
{
SS_CLASSIC,
SS_XPCLASSIC,
SS_XPFRIENDLY
} SHUTDOWNSTYLE;

extern SHUTDOWNSTYLE g_ssStyle;

void PositionDlg(HWND hDlg);
void HandleShutdown(HWND hWnd, DWORD dwCode);

#define IsXP(ss) (ss == SS_XPCLASSIC | ss == SS_XPFRIENDLY)

#define SHTDN_NONE 0
#define SHTDN_LOGOFF 1
#define SHTDN_SHUTDOWN 2
#define SHTDN_RESTART 3
#define SHTDN_STANDBY 4
#define SHTDN_LOCK 5

#endif
61 changes: 58 additions & 3 deletions ClassicShutdown.rc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

IDI_CLASSICSHUTDOWN ICON "ClassicShutdown.ico"

/* Main (classic) */
IDD_EXITWINDOWS DIALOG 0, 0, 274, 103
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Shut Down Windows"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg 2"
Expand All @@ -19,7 +20,7 @@ FONT 8, "MS Shell Dlg 2"
}

IDD_LOGOFFWINDOWS DIALOGEX 0, 0, 188, 60
STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Log Off Windows"
FONT 8, "MS Shell Dlg 2"
{
Expand All @@ -29,6 +30,7 @@ FONT 8, "MS Shell Dlg 2"
CONTROL "&No", IDCANCEL, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 99, 38, 43, 14
}


STRINGTABLE
{
IDS_LOGOFF "Log off %s"
Expand All @@ -41,6 +43,59 @@ STRINGTABLE
IDS_STANDBY_DESC "Maintains your session, keeping the computer running on low power with data still in memory."
IDS_LOCK "Lock"
IDS_LOCK_DESC "Maintains your session, requiring you to log in to access your desktop again."
IDS_LOGOFF_BTN "&Log Off"
IDS_CANCEL_BTN "Cancel"

/* For some fucking reason, Microsoft decided it would be a good idea to have RC files NOT support multiline strings. Fuck you, M$. */
IDS_USAGE "Usage:\n classicshutdown [/logoff] [/noclose] [/xpdim]\n\n /logoff: Displays the logoff confirmation dialog.\n /noclose: Does not display a close button on the shutdown dialog, like Windows XP.\n /xpdim: Fades the screen to black and white like Windows XP rather than applying a dither effect like 2000."
}
}

/* XP friendly */
IDD_EXITWINDOWS_FRIENDLY DIALOGEX DISCARDABLE 0, 0, 208, 122
STYLE DS_SYSMODAL | DS_SETFOREGROUND | WS_POPUP | WS_BORDER
FONT 8, "MS Shell Dlg"
{
PUSHBUTTON "Cancel", IDCANCEL, 161, 103, 40, 12
CONTROL "Flag", IDC_TITLE_FLAG, "Static", SS_OWNERDRAW, 176, 0, 32, 26
CONTROL "Turn off computer", IDC_TITLE_TURNOFF, "Static", SS_OWNERDRAW | WS_VISIBLE, 7, 0, 162, 26
CONTROL "&Stand By", IDC_BUTTON_STANDBY, "Button", BS_OWNERDRAW | BS_NOTIFY | WS_TABSTOP, 36, 49, 22, 20
CONTROL "T&urn Off", IDC_BUTTON_TURNOFF, "Button", BS_OWNERDRAW | BS_NOTIFY | WS_TABSTOP, 93, 49, 22, 20
CONTROL "&Restart", IDC_BUTTON_RESTART, "Button", BS_OWNERDRAW | BS_NOTIFY | WS_TABSTOP, 150, 49, 22, 20
CONTROL "", IDC_TEXT_STANDBY, "Static", SS_OWNERDRAW | WS_DISABLED, 22, 73, 50, 8
CONTROL "", IDC_TEXT_TURNOFF, "Static", SS_OWNERDRAW | WS_DISABLED, 79, 73, 50, 8
CONTROL "", IDC_TEXT_RESTART, "Static", SS_OWNERDRAW | WS_DISABLED, 136, 73, 50, 8
}

IDD_LOGOFFWINDOWS_FRIENDLY DIALOGEX DISCARDABLE 0, 0, 208, 122
STYLE DS_SYSMODAL | DS_SETFOREGROUND | WS_POPUP | WS_BORDER
FONT 8, "MS Shell Dlg"
{
PUSHBUTTON "&Cancel", IDCANCEL, 161, 103, 40, 12
CONTROL "Flag", IDC_TITLE_FLAG, "Static", SS_OWNERDRAW, 176, 0, 32, 26
CONTROL "Log Off Windows", IDC_TITLE_SWITCHUSER, "Static", SS_OWNERDRAW, 7, 0, 162, 26
CONTROL "&Switch User", IDC_BUTTON_SWITCHUSER, "Button", BS_OWNERDRAW | BS_NOTIFY | WS_TABSTOP, 55, 49, 22, 20
CONTROL "&Log Off", IDC_BUTTON_LOGOFF, "Button", BS_OWNERDRAW | BS_NOTIFY | WS_TABSTOP, 132, 49, 22, 20
CONTROL "", IDC_TEXT_SWITCHUSER, "Static", SS_OWNERDRAW | WS_DISABLED, 41, 73, 50, 8
CONTROL "", IDC_TEXT_LOGOFF, "Static", SS_OWNERDRAW | WS_DISABLED, 118, 73, 50, 8
}

STRINGTABLE DISCARDABLE
{
IDS_GENERIC_CAPTION "Windows Logon"

IDS_TURNOFF_TITLE_FACENAME "Franklin Gothic"
IDS_TURNOFF_TITLE_FACESIZE "14"
IDS_TURNOFF_BUTTON_FACENAME "Tahoma"
IDS_TURNOFF_BUTTON_FACESIZE "8"
IDS_TURNOFF_TOOLTIP_TEXT_TURNOFF "Shuts down Windows so that you can safely turn off the computer."
IDS_TURNOFF_TOOLTIP_TEXT_STANDBY "Puts your computer in a low-power state so that you can quickly resume your Windows session."
IDS_TURNOFF_TOOLTIP_TEXT_RESTART "Shuts down Windows and then starts Windows again."
IDS_SWITCHUSER_TOOLTIP_TEXT_SWITCHUSER "Lets another user log on while your programs and files remain open.\r\n\r\n(You can also switch users by pressing the Windows logo key + L.)"
IDS_SWITCHUSER_TOOLTIP_TEXT_LOGOFF "Closes your programs and ends your Windows session."
}

IDB_BACKGROUND BITMAP DISCARDABLE "res\\to_background.bmp"
IDB_FLAG BITMAP DISCARDABLE "res\\to_flag.bmp"

IDB_BUTTONS BITMAP DISCARDABLE "res\\to_buttons.bmp"
IDB_LOGOFF_BUTTONS BITMAP DISCARDABLE "res\\su_buttons.bmp"
15 changes: 11 additions & 4 deletions ClassicShutdown.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalManifestDependencies>"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'";%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
<AdditionalDependencies>powrprof.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>gdi32.lib;msimg32.lib;powrprof.lib;wtsapi32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand All @@ -99,7 +99,7 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalManifestDependencies>"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'";%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
<AdditionalDependencies>powrprof.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>gdi32.lib;msimg32.lib;powrprof.lib;wtsapi32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
Expand All @@ -113,7 +113,7 @@
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalManifestDependencies>"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'";%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
<AdditionalDependencies>powrprof.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>gdi32.lib;msimg32.lib;powrprof.lib;wtsapi32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand All @@ -131,15 +131,22 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalManifestDependencies>"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'";%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
<AdditionalDependencies>powrprof.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>gdi32.lib;msimg32.lib;powrprof.lib;wtsapi32.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="DimmedWindow.cpp" />
<ClCompile Include="ClassicShutdown.cpp" />
<ClCompile Include="ExitWindowsDlg.cpp" />
<ClCompile Include="FriendlyDlg.cpp" />
<ClCompile Include="FriendlyDlg.h" />
<ClCompile Include="LogoffDlg.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="ClassicShutdown.h" />
<ClInclude Include="DimmedWindow.h" />
<ClInclude Include="ExitWindowsDlg.h" />
<ClInclude Include="LogoffDlg.h" />
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
Expand Down
21 changes: 21 additions & 0 deletions ClassicShutdown.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@
<ClCompile Include="DimmedWindow.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ExitWindowsDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="LogoffDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="FriendlyDlg.h">
<Filter>Header Files</Filter>
</ClCompile>
<ClCompile Include="FriendlyDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h">
Expand All @@ -29,6 +41,15 @@
<ClInclude Include="DimmedWindow.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ExitWindowsDlg.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ClassicShutdown.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="LogoffDlg.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ClassicShutdown.rc">
Expand Down
Loading

0 comments on commit e63a325

Please sign in to comment.