Skip to content

Commit

Permalink
eliminate an unnecessary file
Browse files Browse the repository at this point in the history
  • Loading branch information
freedom7341 committed Jul 26, 2024
1 parent 9b646e5 commit a4c1ad5
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 123 deletions.
1 change: 0 additions & 1 deletion CscdCfg/CscdCfg.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="cfg.c" />
<ClCompile Include="dlgproc.c" />
<ClCompile Include="gui.c" />
</ItemGroup>
<ItemGroup>
Expand Down
3 changes: 0 additions & 3 deletions CscdCfg/CscdCfg.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
<ClCompile Include="gui.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="dlgproc.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="cfg.h">
Expand Down
119 changes: 0 additions & 119 deletions CscdCfg/dlgproc.c

This file was deleted.

102 changes: 102 additions & 0 deletions CscdCfg/gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
#include "resource.h"
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <windowsx.h>
#include <CommCtrl.h>
#include <shlwapi.h>

/* Variables */
// Handles
Expand Down Expand Up @@ -59,6 +61,106 @@ int WINAPI GuiMain(
return 0;
}

/* * * *\
CascadesDialogProc -
Main dialog procedure.
\* * * */
INT_PTR CALLBACK CascadesDialogProc(
_In_ HWND hDlg,
_In_ UINT uMsg,
_In_ WPARAM wParam,
_In_ LPARAM lParam
)
{
switch (uMsg)
{
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDCANCEL:
SendMessage(hDlg, WM_CLOSE, 0, 0);
return TRUE;

case IDC_THEMES:
return 0;

case IDC_START:
{
CascadesToggleHook(TRUE);
/*
if (!CascadesToggleHook(TRUE))
{
MessageBox(hDlg, L"Started Cascades.", L"Cascades",
MB_OK | MB_ICONINFORMATION | MB_DEFAULT_DESKTOP_ONLY);
}
else
{
MessageBox(hDlg, L"Failed to start Cascades.", L"Cascades",
MB_OK | MB_ICONINFORMATION | MB_DEFAULT_DESKTOP_ONLY);
}
*/
return 0;
}

case IDC_STOP:
CascadesToggleHook(FALSE);
/*
if (!CascadesToggleHook(FALSE))
{
MessageBox(hDlg, L"Failed to stop Cascades.", L"Cascades",
MB_OK | MB_ICONINFORMATION | MB_DEFAULT_DESKTOP_ONLY);
}
*/
return 0;

case IDC_INSTALL:
{
WCHAR szCurrentPath[MAX_PATH];

// Get current filename and path
GetModuleFileName(NULL, szCurrentPath, MAX_PATH);

// Strip the filename from the path
PathRemoveFileSpec(szCurrentPath);

// Call the service and install
ShellExecute(NULL, TEXT("runas"), TEXT("CscdSvc.exe"), TEXT("install"), szCurrentPath, SW_SHOWDEFAULT);
return 0;
}
case IDC_ENABLE:
DoEnableSvc();
return 0;
case IDC_DISABLE:
DoDisableSvc();
return 0;

}

break;

case WM_INITDIALOG:
Button_SetCheck(GetDlgItem(hDlg, IDC_INSTALL), BST_CHECKED);
Button_Enable(GetDlgItem(hDlg, IDC_START), TRUE);
Button_Enable(GetDlgItem(hDlg, IDC_STOP), TRUE);
Button_Enable(GetDlgItem(hDlg, IDC_INSTALL), TRUE);
Button_Enable(GetDlgItem(hDlg, IDC_ENABLE), TRUE);
Button_Enable(GetDlgItem(hDlg, IDC_DISABLE), TRUE);
return TRUE;

case WM_CLOSE:
if (MessageBox(hDlg, L"Quit Cascades?", L"Close",
MB_ICONQUESTION | MB_YESNO) == IDYES)
DestroyWindow(hDlg);
return TRUE;

case WM_DESTROY:
SendMessage(hDlg, WM_COMMAND, IDC_STOP, 0);
PostQuitMessage(0);
return TRUE;
}
return 0;
}

/* * * *\
CascadesToggleHook -
NT Style's hook creation and removal function.
Expand Down

0 comments on commit a4c1ad5

Please sign in to comment.