ReactOS  0.4.14-dev-1115-gebeeb9d
dialog.c File Reference
#include "precomp.h"
Include dependency graph for dialog.c:

Go to the source code of this file.

Functions

VOID InitUtilsList (BOOL bInitGui)
 
BOOL DlgInitHandler (IN HWND hDlg)
 
VOID GroupBoxUpdateTitle (VOID)
 
VOID UpdateUtilityState (IN BOOL bUtilState)
 
INT ListBoxRefreshContents (VOID)
 
INT_PTR APIENTRY DlgProc (IN HWND hDlg, IN UINT Msg, IN WPARAM wParam, IN LPARAM lParam)
 
INT WINAPI wWinMain (IN HINSTANCE hInstance, IN HINSTANCE hPrevInstance, IN LPWSTR pCmdLine, IN INT nCmdShow)
 

Variables

UTILMAN_GLOBALS Globals
 
UTILMAN_STATE EntriesList []
 

Function Documentation

◆ DlgInitHandler()

BOOL DlgInitHandler ( IN HWND  hDlg)

@DlgInitHandler

Function which processes several operations for WM_INITDIALOG.

Parameters
[in]hDlgThe handle object of the dialog.
Returns
TRUE to inform the system that WM_INITDIALOG has been processed and that it should set the keyboard focus to the control.

Definition at line 97 of file dialog.c.

98 {
99  INT PosX, PosY;
100  RECT rc;
101  WCHAR szAboutDlg[MAX_BUFFER];
102  HMENU hSysMenu;
103 
104  /* Save the dialog handle */
105  Globals.hMainDlg = hDlg;
106 
107  /* Center the dialog on the screen */
108  GetWindowRect(hDlg, &rc);
109  PosX = (GetSystemMetrics(SM_CXSCREEN) - rc.right) / 2;
110  PosY = (GetSystemMetrics(SM_CYSCREEN) - rc.bottom) / 2;
111  SetWindowPos(hDlg, 0, PosX, PosY, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
112 
113  /* Load the icon resource */
116  IMAGE_ICON,
117  0,
118  0,
120 
121  /* Set the icon within the dialog's title bar */
122  if (Globals.hIcon)
123  {
124  SendMessageW(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)Globals.hIcon);
125  }
126 
127  /* Retrieve the system menu and append the "About" menu item onto it */
128  hSysMenu = GetSystemMenu(hDlg, FALSE);
129  if (hSysMenu != NULL)
130  {
131  if (LoadStringW(Globals.hInstance, IDM_ABOUT, szAboutDlg, _countof(szAboutDlg)))
132  {
133  AppendMenuW(hSysMenu, MF_SEPARATOR, 0, NULL);
134  AppendMenuW(hSysMenu, MF_STRING, IDM_ABOUT, szAboutDlg);
135  }
136  }
137 
138  /* Get the dialog items, specifically the dialog list box, the Start and Stop buttons */
142 
143  /* Initialize the GUI listbox */
145 
146  /* Set the selection to the first item */
148 
149  /* Refresh the list */
151 
152  /* Create a timer, we'll use it to control the state of our items in the listbox */
153  Globals.iTimer = SetTimer(hDlg, 0, 400, NULL);
154 
155  return TRUE;
156 }
#define TRUE
Definition: types.h:120
#define IMAGE_ICON
Definition: winuser.h:212
#define IDM_ABOUT
Definition: resource.h:29
#define _countof(array)
Definition: fontsub.cpp:30
#define IDI_ICON_UTILMAN
Definition: resource.h:13
#define MF_STRING
Definition: winuser.h:138
HINSTANCE hInstance
Definition: precomp.h:32
#define SWP_NOZORDER
Definition: winuser.h:1232
LONG right
Definition: windef.h:308
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:57
BOOL WINAPI AppendMenuW(_In_ HMENU, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)
#define ICON_SMALL
Definition: tnclass.cpp:48
#define IDC_START
Definition: resource.h:137
#define SM_CXSCREEN
Definition: winuser.h:949
INT ListBoxRefreshContents(VOID)
Definition: dialog.c:206
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
#define IDC_LISTBOX
Definition: resource.h:16
#define IDC_STOP
Definition: resource.h:69
HMENU WINAPI GetSystemMenu(_In_ HWND, _In_ BOOL)
smooth NULL
Definition: ftsmooth.c:416
#define MF_SEPARATOR
Definition: winuser.h:137
LONG_PTR LPARAM
Definition: windef.h:208
HICON hIcon
Definition: precomp.h:33
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define SM_CYSCREEN
Definition: winuser.h:950
HWND hDlgCtlStart
Definition: precomp.h:36
#define LR_DEFAULTSIZE
Definition: winuser.h:1084
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_BUFFER
Definition: precomp.h:26
int WINAPI GetSystemMetrics(_In_ int)
HWND hDlgCtlStop
Definition: precomp.h:37
#define SWP_NOSIZE
Definition: winuser.h:1230
UTILMAN_GLOBALS Globals
Definition: dialog.c:15
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND hMainDlg
Definition: precomp.h:39
HWND hListDlg
Definition: precomp.h:38
HWND WINAPI GetDlgItem(HWND hDlg, int nIDDlgItem)
Definition: dialog.c:2183
LONG bottom
Definition: windef.h:309
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
VOID InitUtilsList(BOOL bInitGui)
Definition: dialog.c:38
INT iSelectedIndex
Definition: precomp.h:35
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
UINT_PTR iTimer
Definition: precomp.h:34

Referenced by DlgProc().

◆ DlgProc()

INT_PTR APIENTRY DlgProc ( IN HWND  hDlg,
IN UINT  Msg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)

@DlgProc

Main dialog application procedure function.

Parameters
[in]hDlgThe handle object of the dialog.
[in]MsgMessage events (in unsigned int).
[in]wParamMessage parameter (in UINT_PTR).
[in]lParamMessage paramater (in LONG_PTR).
Returns
Returns 0 to inform the system that the procedure has been handled.

Definition at line 272 of file dialog.c.

277 {
278  switch (Msg)
279  {
280  case WM_INITDIALOG:
281  DlgInitHandler(hDlg);
282  return TRUE;
283 
284  case WM_CLOSE:
285  KillTimer(hDlg, Globals.iTimer);
287  EndDialog(hDlg, FALSE);
288  break;
289 
290  case WM_COMMAND:
291  {
292  switch (LOWORD(wParam))
293  {
294  case IDC_OK:
295  case IDC_CANCEL:
296  EndDialog(hDlg, FALSE);
297  break;
298 
299  case IDC_LISTBOX:
300  {
301  switch (HIWORD(wParam))
302  {
303  case LBN_SELCHANGE:
304  {
305  /* Retrieve the index of the current selected item */
306  INT iIndex = SendMessageW(Globals.hListDlg, LB_GETCURSEL, 0, 0);
307  if ((iIndex == LB_ERR) || (iIndex >= _countof(EntriesList)))
308  break;
309 
310  /* Assign the selected index and check the utility's state */
311  Globals.iSelectedIndex = iIndex;
313  break;
314  }
315  break;
316  }
317  break;
318  }
319 
320  case IDC_START:
322  break;
323 
324  case IDC_STOP:
326  break;
327 
328  default:
329  break;
330  }
331  break;
332  }
333 
334  case WM_TIMER:
336  return 0;
337 
338  case WM_SYSCOMMAND:
339  {
340  switch (LOWORD(wParam))
341  {
342  case IDM_ABOUT:
343  ShowAboutDlg(hDlg);
344  break;
345  }
346  break;
347  }
348  }
349 
350  return 0;
351 }
#define TRUE
Definition: types.h:120
VOID ShowAboutDlg(HWND hWndParent)
Definition: about.c:77
#define IDM_ABOUT
Definition: resource.h:29
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define _countof(array)
Definition: fontsub.cpp:30
#define LBN_SELCHANGE
Definition: winuser.h:2057
int32_t INT
Definition: typedefs.h:57
WPARAM wParam
Definition: combotst.c:138
#define IDC_START
Definition: resource.h:137
INT ListBoxRefreshContents(VOID)
Definition: dialog.c:206
#define LB_ERR
Definition: winuser.h:2407
#define IDC_LISTBOX
Definition: resource.h:16
VOID UpdateUtilityState(IN BOOL bUtilState)
Definition: dialog.c:188
#define IDC_STOP
Definition: resource.h:69
HICON hIcon
Definition: precomp.h:33
#define IDC_CANCEL
Definition: resource.h:60
#define WM_TIMER
Definition: winuser.h:1724
#define WM_CLOSE
Definition: winuser.h:1603
UTILMAN_STATE EntriesList[]
Definition: dialog.c:19
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
BOOL bState
Definition: precomp.h:50
#define WM_COMMAND
Definition: winuser.h:1722
UTILMAN_GLOBALS Globals
Definition: dialog.c:15
BOOL LaunchProcess(LPCWSTR lpProcessName)
Definition: process.c:117
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2085
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_GETCURSEL
Definition: winuser.h:2021
HWND hListDlg
Definition: precomp.h:38
struct @1587 Msg[]
BOOL CloseProcess(IN LPCWSTR lpProcessName)
Definition: process.c:192
#define HIWORD(l)
Definition: typedefs.h:247
BOOL DlgInitHandler(IN HWND hDlg)
Definition: dialog.c:97
LPCWSTR lpProgram
Definition: precomp.h:47
INT iSelectedIndex
Definition: precomp.h:35
#define WM_SYSCOMMAND
Definition: winuser.h:1723
#define IDC_OK
Definition: resource.h:59
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LOWORD(l)
Definition: pedump.c:82
UINT_PTR iTimer
Definition: precomp.h:34

Referenced by WinMain(), and wWinMain().

◆ GroupBoxUpdateTitle()

VOID GroupBoxUpdateTitle ( VOID  )

@GroupBoxUpdateTitle

Updates the title of the groupbox.

Returns
Nothing.

Definition at line 167 of file dialog.c.

168 {
169  WCHAR szFormat[MAX_BUFFER];
170 
171  /* Format the string with the utility's name and set it to the listbox's title */
174 }
#define _countof(array)
Definition: fontsub.cpp:30
#define IDC_GROUPBOX
Definition: resource.h:27
WCHAR szResource[MAX_BUFFER]
Definition: precomp.h:49
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_BUFFER
Definition: precomp.h:26
WCHAR szGrpBoxTitle[MAX_BUFFER]
Definition: precomp.h:42
UTILMAN_STATE EntriesList[]
Definition: dialog.c:19
UTILMAN_GLOBALS Globals
Definition: dialog.c:15
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
HWND hMainDlg
Definition: precomp.h:39
HWND WINAPI GetDlgItem(HWND hDlg, int nIDDlgItem)
Definition: dialog.c:2183
INT iSelectedIndex
Definition: precomp.h:35

Referenced by UpdateUtilityState().

◆ InitUtilsList()

VOID InitUtilsList ( BOOL  bInitGui)

@InitUtilsList

Initializes the list of accessibility utilities.

Parameters
[in]bInitGuiWhether we are initializing the UI list (TRUE) or the internal array (FALSE).
Returns
Nothing.

Definition at line 38 of file dialog.c.

39 {
40  UINT i;
41 
42  if (!bInitGui)
43  {
44  // TODO: Load the list dynamically from the registry key
45  // hklm\software\microsoft\windows nt\currentversion\accessibility
46 
47  /* Initialize the resource utility strings only once */
48  for (i = 0; i < _countof(EntriesList); ++i)
49  {
51  EntriesList[i].szResource, _countof(EntriesList[i].szResource));
52 
54  }
55  }
56  else
57  {
58  INT iItem;
59  BOOL bIsRunning;
60  WCHAR szFormat[MAX_BUFFER];
61 
62  /* Reset the listbox */
64 
65  /* Add the utilities in the listbox */
66  for (i = 0; i < _countof(EntriesList); ++i)
67  {
68  bIsRunning = IsProcessRunning(EntriesList[i].lpProgram);
69  EntriesList[i].bState = bIsRunning;
70 
71  /* Load the string and append the utility's name to the format */
72  StringCchPrintfW(szFormat, _countof(szFormat),
73  (bIsRunning ? Globals.szRunning : Globals.szNotRunning),
75 
76  /* Add the item in the listbox */
77  iItem = (INT)SendMessageW(Globals.hListDlg, LB_ADDSTRING, 0, (LPARAM)szFormat);
78  if (iItem != LB_ERR)
80  }
81  }
82 }
UINT uNameId
Definition: precomp.h:48
#define LB_ADDSTRING
Definition: winuser.h:2013
#define _countof(array)
Definition: fontsub.cpp:30
#define INT
Definition: polytest.cpp:20
BOOL IsProcessRunning(IN LPCWSTR lpProcessName)
Definition: process.c:71
HINSTANCE hInstance
Definition: precomp.h:32
WCHAR szResource[MAX_BUFFER]
Definition: precomp.h:49
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:57
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define LB_RESETCONTENT
Definition: winuser.h:2037
#define LB_ERR
Definition: winuser.h:2407
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG_PTR LPARAM
Definition: windef.h:208
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_BUFFER
Definition: precomp.h:26
UTILMAN_STATE EntriesList[]
Definition: dialog.c:19
#define LB_SETITEMDATA
Definition: winuser.h:2047
BOOL bState
Definition: precomp.h:50
UTILMAN_GLOBALS Globals
Definition: dialog.c:15
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
unsigned int UINT
Definition: ndis.h:50
HWND hListDlg
Definition: precomp.h:38
WCHAR szNotRunning[MAX_BUFFER]
Definition: precomp.h:41
WCHAR szRunning[MAX_BUFFER]
Definition: precomp.h:40

Referenced by DlgInitHandler(), and wWinMain().

◆ ListBoxRefreshContents()

INT ListBoxRefreshContents ( VOID  )

@ListBoxRefreshContents

Handle the tasks on a periodic cycle. This function handles WM_TIMER message.

Returns
Returns 0 to inform the system that WM_TIMER has been processed.

Definition at line 206 of file dialog.c.

207 {
208  UINT i;
209  INT iItem;
210  BOOL bIsRunning;
211  WCHAR szFormat[MAX_BUFFER];
212 
213  /* Disable listbox redraw */
215 
216  for (i = 0; i < _countof(EntriesList); ++i)
217  {
218  /* Check the utility's state */
219  bIsRunning = IsProcessRunning(EntriesList[i].lpProgram);
220  if (bIsRunning != EntriesList[i].bState)
221  {
222  /* The utility's state has changed, save it */
223  EntriesList[i].bState = bIsRunning;
224 
225  /* Update the corresponding item in the listbox */
226  StringCchPrintfW(szFormat, _countof(szFormat),
227  (bIsRunning ? Globals.szRunning : Globals.szNotRunning),
229 
231  iItem = SendMessageW(Globals.hListDlg, LB_INSERTSTRING, (LPARAM)i, (LPARAM)szFormat);
232  if (iItem != LB_ERR)
234  }
235  }
236 
237  /* Re-enable listbox redraw */
239 
240  /*
241  * Check the previously selected item. This will help us determine what
242  * item has been selected and set its focus selection back. Furthermore, check
243  * the state of each accessibility tool and enable/disable the buttons.
244  */
247 
248  return 0;
249 }
#define LB_SETCURSEL
Definition: winuser.h:2045
#define TRUE
Definition: types.h:120
#define _countof(array)
Definition: fontsub.cpp:30
BOOL IsProcessRunning(IN LPCWSTR lpProcessName)
Definition: process.c:71
#define WM_SETREDRAW
Definition: winuser.h:1598
WCHAR szResource[MAX_BUFFER]
Definition: precomp.h:49
UINT_PTR WPARAM
Definition: windef.h:207
int32_t INT
Definition: typedefs.h:57
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define LB_ERR
Definition: winuser.h:2407
unsigned int BOOL
Definition: ntddk_ex.h:94
VOID UpdateUtilityState(IN BOOL bUtilState)
Definition: dialog.c:188
LONG_PTR LPARAM
Definition: windef.h:208
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_BUFFER
Definition: precomp.h:26
UTILMAN_STATE EntriesList[]
Definition: dialog.c:19
#define LB_SETITEMDATA
Definition: winuser.h:2047
BOOL bState
Definition: precomp.h:50
UTILMAN_GLOBALS Globals
Definition: dialog.c:15
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
unsigned int UINT
Definition: ndis.h:50
HWND hListDlg
Definition: precomp.h:38
#define LB_DELETESTRING
Definition: winuser.h:2014
INT iSelectedIndex
Definition: precomp.h:35
#define LB_INSERTSTRING
Definition: winuser.h:2035
WCHAR szNotRunning[MAX_BUFFER]
Definition: precomp.h:41
WCHAR szRunning[MAX_BUFFER]
Definition: precomp.h:40

Referenced by DlgInitHandler(), and DlgProc().

◆ UpdateUtilityState()

VOID UpdateUtilityState ( IN BOOL  bUtilState)

@UpdateUtilityState

Checks the state of the given accessibility tool.

Parameters
[in]bUtilStateState condition (boolean TRUE: started / FALSE: stopped).
Returns
Nothing.

Definition at line 188 of file dialog.c.

189 {
190  Button_Enable(Globals.hDlgCtlStart, !bUtilState);
191  Button_Enable(Globals.hDlgCtlStop, bUtilState);
192 
193  /* Update the groupbox's title based on the selected utility item */
195 }
#define Button_Enable(hwndCtl, fEnable)
Definition: windowsx.h:5
HWND hDlgCtlStart
Definition: precomp.h:36
HWND hDlgCtlStop
Definition: precomp.h:37
UTILMAN_GLOBALS Globals
Definition: dialog.c:15
VOID GroupBoxUpdateTitle(VOID)
Definition: dialog.c:167

Referenced by DlgProc(), and ListBoxRefreshContents().

◆ wWinMain()

INT WINAPI wWinMain ( IN HINSTANCE  hInstance,
IN HINSTANCE  hPrevInstance,
IN LPWSTR  pCmdLine,
IN INT  nCmdShow 
)

@wWinMain

Application entry point.

Parameters
[in]hInstanceApplication instance.
[in]hPrevInstanceThe previous instance of the application (not used).
[in]pCmdLinePointer to a command line argument (in wide string – not used).
[in]nCmdShowAn integer served as a flag to note how the application will be shown (not used).
Returns
Returns 0 to let the function terminating before it enters in the message loop.

Definition at line 374 of file dialog.c.

379 {
380  HANDLE hMutex;
381  DWORD dwError;
382  INITCOMMONCONTROLSEX iccex;
383 
384  UNREFERENCED_PARAMETER(hPrevInstance);
385  UNREFERENCED_PARAMETER(pCmdLine);
386  UNREFERENCED_PARAMETER(nCmdShow);
387 
388  /* Create a mutant object for the program. */
389  hMutex = CreateMutexW(NULL, FALSE, L"Utilman");
390  if (hMutex)
391  {
392  /* Check if there's already a mutex for the program */
393  dwError = GetLastError();
394  if (dwError == ERROR_ALREADY_EXISTS)
395  {
396  /*
397  The program's instance is already here. That means
398  the program is running and we should not set a new instance
399  and mutex object.
400  */
402  return 0;
403  }
404  }
405 
406  /* Load the common controls for the program */
407  iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);
409  InitCommonControlsEx(&iccex);
410 
411  /* Initialize the globals */
412  ZeroMemory(&Globals, sizeof(Globals));
414 
421 
422  /* Initialize the list of accessibility utilities */
424 
425  /* Create the dialog box of the program */
429  DlgProc);
430 
431  /* Delete the mutex */
432  if (hMutex)
433  {
435  }
436 
437  return 0;
438 }
#define CloseHandle
Definition: compat.h:406
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define _countof(array)
Definition: fontsub.cpp:30
HINSTANCE hInstance
Definition: precomp.h:32
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1642
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
struct tagINITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
#define IDS_GROUPBOX_OPTIONS_TITLE
Definition: resource.h:28
HINSTANCE hInstance
Definition: charmap.c:20
#define ICC_WIN95_CLASSES
Definition: commctrl.h:66
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652
HANDLE hMutex
Definition: mutex.c:11
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4374
#define IDD_MAIN_DIALOG
Definition: resource.h:6
WCHAR szGrpBoxTitle[MAX_BUFFER]
Definition: precomp.h:42
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDS_RUNNING
Definition: resource.h:258
static const WCHAR L[]
Definition: oid.c:1250
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
INT_PTR APIENTRY DlgProc(IN HWND hDlg, IN UINT Msg, IN WPARAM wParam, IN LPARAM lParam)
Definition: dialog.c:272
#define IDS_NOTRUNNING
Definition: resource.h:23
UTILMAN_GLOBALS Globals
Definition: dialog.c:15
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexW(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, IN BOOL bInitialOwner, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:576
#define ICC_STANDARD_CLASSES
Definition: commctrl.h:73
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
VOID InitUtilsList(BOOL bInitGui)
Definition: dialog.c:38
WCHAR szNotRunning[MAX_BUFFER]
Definition: precomp.h:41
WCHAR szRunning[MAX_BUFFER]
Definition: precomp.h:40

Variable Documentation

◆ EntriesList

UTILMAN_STATE EntriesList[]
Initial value:
=
{
{L"magnify.exe", IDS_MAGNIFIER, L"", FALSE},
{L"osk.exe", IDS_OSK, L"", FALSE}
}
#define IDS_MAGNIFIER
Definition: resource.h:20
#define IDS_OSK
Definition: resource.h:19
static const WCHAR L[]
Definition: oid.c:1250

Definition at line 19 of file dialog.c.

Referenced by DlgProc(), GroupBoxUpdateTitle(), InitUtilsList(), and ListBoxRefreshContents().

◆ Globals