ReactOS  0.4.12-dev-18-gf469aca
toolspage.cpp File Reference
#include "precomp.h"
#include "xmldomparser.hpp"
#include "utils.h"
#include "listview.h"
#include "uxthemesupp.h"
Include dependency graph for toolspage.cpp:

Go to the source code of this file.

Classes

struct  TOOL
 

Functions

static void AddTool (IXMLDOMElement *, BOOL)
 
static HRESULT ParseToolsList (IXMLDOMDocument *pXMLDom, BOOL bIsStandard)
 
static void AddItem (BOOL bIsStandard, const _bstr_t &name, const _bstr_t &descr, TOOL *tool)
 
static void FillListView (void)
 
static size_t BuildCommandLine (LPWSTR lpszDest, LPCWSTR lpszCmdLine, LPCWSTR lpszParam, size_t bufSize)
 
static void Update_States (int iSelectedItem)
 
static BOOL RunSelectedTool (VOID)
 
INT_PTR CALLBACK ToolsPageWndProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 

Variables

static HWND hToolsPage = NULL
 
static HWND hToolsListCtrl = NULL
 
static int iToolsPageSortedColumn = 0
 

Function Documentation

◆ AddItem()

static void AddItem ( BOOL  bIsStandard,
const _bstr_t &  name,
const _bstr_t &  descr,
TOOL tool 
)
static

Definition at line 123 of file toolspage.cpp.

Referenced by AddTool().

124 {
125  LPWSTR lpszStandard;
126  LVITEM item = {};
127 
128  assert(tool);
129 
130  item.mask = LVIF_TEXT | LVIF_PARAM;
131  item.lParam = (LPARAM)tool;
132 
133  item.pszText = (LPWSTR)name;
134  item.iSubItem = 0;
135  // item.iItem = ListView_GetItemCount(hToolsListCtrl);
136 
138 
139  if (bIsStandard)
140  {
141  lpszStandard = LoadResourceString(hInst, IDS_YES);
142  ListView_SetItemText(hToolsListCtrl, item.iItem, 1, lpszStandard);
143  MemFree(lpszStandard);
144  }
145  else
146  {
147  lpszStandard = LoadResourceString(hInst, IDS_NO);
148  ListView_SetItemText(hToolsListCtrl, item.iItem, 1, lpszStandard);
149  MemFree(lpszStandard);
150  }
151 
153 }
BOOL MemFree(IN PVOID lpMem)
Definition: utils.c:26
static HWND hToolsListCtrl
Definition: toolspage.cpp:17
#define assert(x)
Definition: debug.h:53
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2378
#define IDS_YES
Definition: resource.h:16
#define LVIF_TEXT
Definition: commctrl.h:2279
#define IDS_NO
Definition: resource.h:17
#define ListView_SetItemText(hwndLV, i, iSubItem_, pszText_)
Definition: commctrl.h:2661
VOID LoadResourceString(UINT ResourceId, LPVOID Buffer, UINT ccount, LPVOID DefaultString, BOOL bUnicode)
Definition: enum.c:13
HINSTANCE hInst
Definition: dxdiag.c:13
static ATOM item
Definition: dde.c:856
Definition: name.c:36
#define LVIF_PARAM
Definition: commctrl.h:2281
#define LVITEM
Definition: commctrl.h:2345
const char * descr
Definition: boot.c:42
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define LPARAM
Definition: msvc.h:38

◆ AddTool()

static void AddTool ( IXMLDOMElement pXMLTool,
BOOL  bIsStandard 
)
static

Definition at line 156 of file toolspage.cpp.

Referenced by ParseToolsList().

157 {
158  TOOL* tool;
159  _variant_t varLocID, varName, varPath,
160  varDefOpt, varAdvOpt, varHelp;
161 
162  assert(pXMLTool);
163 
164  pXMLTool->getAttribute(_bstr_t(L"_locID") , &varLocID );
165  pXMLTool->getAttribute(_bstr_t(L"NAME") , &varName );
166  pXMLTool->getAttribute(_bstr_t(L"PATH") , &varPath );
167  pXMLTool->getAttribute(_bstr_t(L"DEFAULT_OPT"), &varDefOpt);
168  pXMLTool->getAttribute(_bstr_t(L"ADV_OPT") , &varAdvOpt);
169  pXMLTool->getAttribute(_bstr_t(L"HELP") , &varHelp );
170 
171  // TODO: check if the tool really exists... ??
172 
173  tool = new TOOL(_bstr_t(varPath), _bstr_t(varDefOpt), _bstr_t(varAdvOpt));
174  AddItem(bIsStandard, _bstr_t(varName), _bstr_t(varHelp), tool);
175 }
#define assert(x)
Definition: debug.h:53
TOOL
Definition: imgedwnd.h:21
static void AddItem(BOOL bIsStandard, const _bstr_t &name, const _bstr_t &descr, TOOL *tool)
Definition: toolspage.cpp:123
static const WCHAR L[]
Definition: oid.c:1087
HRESULT getAttribute([in] BSTR name, [out, retval] VARIANT *value)

◆ BuildCommandLine()

static size_t BuildCommandLine ( LPWSTR  lpszDest,
LPCWSTR  lpszCmdLine,
LPCWSTR  lpszParam,
size_t  bufSize 
)
static

Definition at line 204 of file toolspage.cpp.

Referenced by Update_States().

205 {
206  size_t numOfChars = 0; // The null character is counted in ExpandEnvironmentStrings(...).
207  // TODO: Take into account the "plus one" for numOfChars for ANSI version (see MSDN for more details).
208 
209  if (lpszCmdLine && *lpszCmdLine)
210  {
211  numOfChars += ExpandEnvironmentStringsW(lpszCmdLine, NULL, 0);
212  if (lpszDest)
213  ExpandEnvironmentStringsW(lpszCmdLine, lpszDest, (DWORD)bufSize); // TODO: size_t to DWORD conversion !
214 
215  if (lpszParam && *lpszParam)
216  {
217  ++numOfChars;
218  if (lpszDest)
219  wcscat(lpszDest, L" ");
220  }
221  }
222 
223  if (lpszParam && *lpszParam)
224  {
225  numOfChars += wcslen(lpszParam);
226  if (lpszDest)
227  wcscat(lpszDest, lpszParam);
228  }
229 
230  return numOfChars;
231 }
GLuint GLsizei bufSize
Definition: glext.h:6040
smooth NULL
Definition: ftsmooth.c:416
WCHAR lpszDest[260]
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1087
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

◆ FillListView()

static void FillListView ( void  )
static

Definition at line 178 of file toolspage.cpp.

Referenced by ToolsPageWndProc().

179 {
180  IXMLDOMDocument* pXMLDom = NULL;
181 
182  if (!SUCCEEDED(InitXMLDOMParser()))
183  return;
184 
185  if (SUCCEEDED(CreateAndInitXMLDOMDocument(&pXMLDom)))
186  {
187  // Load the internal tools list.
188  if (LoadXMLDocumentFromResource(pXMLDom, L"MSCFGTL.XML"))
189  ParseToolsList(pXMLDom, TRUE);
190 
191  // Try to load the user-provided tools list. If it doesn't exist,
192  // then the second list-view's column "Standard" tool is removed.
193  if (LoadXMLDocumentFromFile(pXMLDom, L"MSCFGTLC.XML", TRUE))
194  ParseToolsList(pXMLDom, FALSE);
195  else
197  }
198 
199  SAFE_RELEASE(pXMLDom);
201 }
VOID UninitXMLDOMParser(VOID)
#define TRUE
Definition: types.h:120
#define ListView_DeleteColumn(hwnd, iCol)
Definition: commctrl.h:2609
static HWND hToolsListCtrl
Definition: toolspage.cpp:17
HRESULT InitXMLDOMParser(VOID)
smooth NULL
Definition: ftsmooth.c:416
HRESULT CreateAndInitXMLDOMDocument(IXMLDOMDocument **ppDoc)
#define SAFE_RELEASE(p)
BOOL LoadXMLDocumentFromFile(IXMLDOMDocument *pDoc, LPCWSTR lpszFilename, BOOL bIgnoreErrorsIfNonExistingFile)
static const WCHAR L[]
Definition: oid.c:1087
static HRESULT ParseToolsList(IXMLDOMDocument *pXMLDom, BOOL bIsStandard)
Definition: toolspage.cpp:46
BOOL LoadXMLDocumentFromResource(IXMLDOMDocument *pDoc, LPCWSTR lpszXMLResName)
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ ParseToolsList()

static HRESULT ParseToolsList ( IXMLDOMDocument pXMLDom,
BOOL  bIsStandard 
)
static

Definition at line 46 of file toolspage.cpp.

Referenced by FillListView().

47 {
48  static const _bstr_t XMLFileTag(L"MSCONFIGTOOLFILE");
49  static const _bstr_t XMLToolsTag(L"MSCONFIGTOOLS");
50 
51  HRESULT hr = S_OK;
52 
53  IXMLDOMNode *pIterator = NULL, *pTmp = NULL;
54  IXMLDOMElement* pEl = NULL;
56  _bstr_t tagName;
57 
58  if (!pXMLDom)
59  return E_POINTER; // E_INVALIDARG
60 
61  pXMLDom->get_documentElement(&pEl);
62 
63  pEl->get_tagName(&tagName.GetBSTR());
64  _wcsupr(tagName);
65  if (tagName == XMLFileTag)
66  {
67  pEl->get_firstChild(&pIterator); SAFE_RELEASE(pEl);
68  while (pIterator)
69  {
70  pIterator->get_nodeType(&type);
71  if (type == NODE_ELEMENT)
72  {
73  pIterator->QueryInterface(IID_PPV_ARG(IXMLDOMElement, &pEl) /* IID_PPV_ARGS(&pEl) */);
74 
75  pEl->get_tagName(&tagName.GetBSTR());
76  _wcsupr(tagName);
77  if (tagName == XMLToolsTag)
78  {
79  pEl->get_firstChild(&pIterator); SAFE_RELEASE(pEl);
80  while (pIterator)
81  {
82  pIterator->QueryInterface(IID_PPV_ARG(IXMLDOMElement, &pEl) /* IID_PPV_ARGS(&pEl) */);
83  AddTool(pEl, bIsStandard);
84  SAFE_RELEASE(pEl);
85 
86  pIterator->get_nextSibling(&pTmp);
87  SAFE_RELEASE(pIterator); pIterator = pTmp;
88  }
89  // SAFE_RELEASE(pIterator);
90 
91  break;
92  }
93 
94  SAFE_RELEASE(pEl);
95  }
96 
97  pIterator->get_nextSibling(&pTmp);
98  SAFE_RELEASE(pIterator); pIterator = pTmp;
99  }
100  // SAFE_RELEASE(pIterator);
101  }
102  else if (tagName == XMLToolsTag)
103  {
104  pEl->get_firstChild(&pIterator); SAFE_RELEASE(pEl);
105  while (pIterator)
106  {
107  pIterator->QueryInterface(IID_PPV_ARG(IXMLDOMElement, &pEl) /* IID_PPV_ARGS(&pEl) */);
108  AddTool(pEl, bIsStandard);
109  SAFE_RELEASE(pEl);
110 
111  pIterator->get_nextSibling(&pTmp);
112  SAFE_RELEASE(pIterator); pIterator = pTmp;
113  }
114  // SAFE_RELEASE(pIterator);
115  }
116 
117  SAFE_RELEASE(pEl);
118 
119  return hr;
120 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define IID_PPV_ARG(Itype, ppType)
smooth NULL
Definition: ftsmooth.c:416
#define SAFE_RELEASE(p)
_CRTIMP wchar_t *__cdecl _wcsupr(_Inout_z_ wchar_t *_String)
static void AddTool(IXMLDOMElement *, BOOL)
Definition: toolspage.cpp:156
LONG HRESULT
Definition: typedefs.h:77
static const WCHAR L[]
Definition: oid.c:1087
#define S_OK
Definition: intsafe.h:59
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
__MSXML_DOMNODETYPE_DEFINED enum tagDOMNodeType DOMNodeType
#define E_POINTER
Definition: winerror.h:2365

◆ RunSelectedTool()

static BOOL RunSelectedTool ( VOID  )
static

Definition at line 290 of file toolspage.cpp.

Referenced by ToolsPageWndProc().

291 {
292  BOOL Success = FALSE;
293  BOOL bUseAdvParams;
294 
295  LVITEM item = {};
296  item.mask = LVIF_PARAM;
299 
300  if (ListView_GetItem(hToolsListCtrl, &item)) // (item.iItem > -1) // TODO: corriger ailleurs ce genre de code...
301  {
304  bUseAdvParams = TRUE;
305  else
306  bUseAdvParams = FALSE;
307 
308  // Values greater (strictly) than 32 indicate success (see MSDN documentation for ShellExecute(...) API).
309  Success = (reinterpret_cast<TOOL*>(item.lParam)->Run(bUseAdvParams) > 32);
310  }
311 
312  return Success;
313 }
#define TRUE
Definition: types.h:120
static HWND hToolsListCtrl
Definition: toolspage.cpp:17
static HWND hToolsPage
Definition: toolspage.cpp:16
#define Button_IsEnabled(hwndCtl)
Definition: comctl32supp.h:18
struct tagRun Run
unsigned int BOOL
Definition: ntddk_ex.h:94
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define Button_GetCheck(hwndCtl)
Definition: windowsx.h:6
#define IDC_CBX_TOOLS_ADVOPT
Definition: resource.h:85
static ATOM item
Definition: dde.c:856
#define BST_CHECKED
Definition: winuser.h:197
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2364
#define LVIF_PARAM
Definition: commctrl.h:2281
#define LVITEM
Definition: commctrl.h:2345
#define ListView_GetSelectionMark(hwnd)
Definition: commctrl.h:2759

◆ ToolsPageWndProc()

INT_PTR CALLBACK ToolsPageWndProc ( HWND  hDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 318 of file toolspage.cpp.

319 {
320  switch (message)
321  {
322  case WM_INITDIALOG:
323  {
324  hToolsPage = hDlg;
326 
327  //
328  // Initialize the styles.
329  //
332  SetWindowTheme(hToolsListCtrl, L"Explorer", NULL);
333 
334  //
335  // Initialize the application page's controls.
336  //
337  LVCOLUMN column = {};
338 
339  // First column : Tool's name.
340  column.mask = LVCF_TEXT | LVCF_WIDTH;
342  column.cx = 150;
344  MemFree(column.pszText);
345 
346  // Second column : Whether the tool is a standard one or not.
347  column.mask = LVCF_TEXT | LVCF_WIDTH;
349  column.cx = 60;
351  MemFree(column.pszText);
352 
353  // Third column : Description.
354  column.mask = LVCF_TEXT | LVCF_WIDTH;
356  column.cx = 500;
358  MemFree(column.pszText);
359 
360  //
361  // Populate and sort the list.
362  //
363  FillListView();
365 
366  // Force an update in case of an empty list (giving focus on it when empty won't emit a LVN_ITEMCHANGED message).
367  Update_States(-1 /* Wrong index to initialize all the controls with their default state (i.e. disabled) */);
368 
370 
371  return TRUE;
372  }
373 
374  case WM_DESTROY:
375  {
376  LVITEM lvitem = {};
377  lvitem.mask = LVIF_PARAM;
378  lvitem.iItem = -1; // From the beginning.
379 
380  while ((lvitem.iItem = ListView_GetNextItem(hToolsListCtrl, lvitem.iItem, LVNI_ALL)) != -1)
381  {
382  // ListView_Update(); // Updates a list-view item.
383  // ListView_FindItem(); // peut être intéressant pour faire de la recherche itérative à partir du nom (ou partie du...) de l'item.
384 
386 
387  delete reinterpret_cast<TOOL*>(lvitem.lParam);
388  lvitem.lParam = NULL;
389  }
391 
392  return 0;
393  }
394 
395  case WM_COMMAND:
396  {
397  switch (LOWORD(wParam))
398  {
399  case IDC_BTN_RUN:
400  {
401  RunSelectedTool();
402  return TRUE;
403  }
404 
406  {
408  return TRUE;
409  }
410 
411  default:
412  return FALSE;
413  }
414  return FALSE;
415  }
416 
417  case WM_NOTIFY:
418  {
419  if (((LPNMHDR)lParam)->hwndFrom == hToolsListCtrl)
420  {
421  switch (((LPNMHDR)lParam)->code)
422  {
423  case LVN_ITEMCHANGED:
424  {
425  if ( (((LPNMLISTVIEW)lParam)->uChanged & LVIF_STATE) && /* The state has changed */
426  (((LPNMLISTVIEW)lParam)->uNewState & LVIS_SELECTED) /* The item has been (de)selected */ )
427  {
428  Update_States(((LPNMLISTVIEW)lParam)->iItem);
429  }
430 
431  return TRUE;
432  }
433 
434  case NM_DBLCLK:
435  case NM_RDBLCLK:
436  {
437  RunSelectedTool();
438  return TRUE;
439  }
440 
441  case LVN_COLUMNCLICK:
442  {
443  int iSortingColumn = ((LPNMLISTVIEW)lParam)->iSubItem;
444 
446  iToolsPageSortedColumn = iSortingColumn;
447 
448  return TRUE;
449  }
450 
451  default:
452  break;
453  }
454  }
455  else
456  {
457  switch (((LPNMHDR)lParam)->code)
458  {
459  case PSN_APPLY:
460  {
461  // Since there are nothing to modify, applying modifications
462  // cannot return any error.
465  return TRUE;
466  }
467 
468  case PSN_HELP:
469  {
470  MessageBoxW(hToolsPage, L"Help not implemented yet!", L"Help", MB_ICONINFORMATION | MB_OK);
471  return TRUE;
472  }
473 
474  case PSN_KILLACTIVE: // Is going to lose activation.
475  {
476  // Changes are always valid of course.
478  return TRUE;
479  }
480 
481  case PSN_QUERYCANCEL:
482  {
483  // Allows cancellation since there are nothing to cancel...
485  return TRUE;
486  }
487 
489  {
490  // Give the focus on and select the first item.
492 
494  return TRUE;
495  }
496 
497  //
498  // DO NOT TOUCH THESE NEXT MESSAGES, THEY ARE OK LIKE THIS...
499  //
500  case PSN_RESET: // Perform final cleaning, called before WM_DESTROY.
501  return TRUE;
502 
503  case PSN_SETACTIVE: // Is going to gain activation.
504  {
506  return TRUE;
507  }
508 
509  default:
510  break;
511  }
512  }
513 
514  return FALSE;
515  }
516 
517  default:
518  return FALSE;
519  }
520 
521  // return FALSE;
522 }
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2404
Definition: tftpd.h:59
#define TRUE
Definition: types.h:120
#define LVCF_WIDTH
Definition: commctrl.h:2557
BOOL MemFree(IN PVOID lpMem)
Definition: utils.c:26
#define LVCF_TEXT
Definition: commctrl.h:2558
#define PSN_HELP
Definition: prsht.h:119
static HWND hToolsListCtrl
Definition: toolspage.cpp:17
#define LVN_ITEMCHANGED
Definition: commctrl.h:3101
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2704
#define ListView_Sort(hListView, iSortingColumn)
Definition: listview.h:32
static HWND hToolsPage
Definition: toolspage.cpp:16
#define PSN_APPLY
Definition: prsht.h:117
#define PSN_SETACTIVE
Definition: prsht.h:115
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define DWLP_MSGRESULT
Definition: winuser.h:864
#define PSN_QUERYCANCEL
Definition: prsht.h:123
#define LVCOLUMN
Definition: commctrl.h:2551
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2606
#define NM_RDBLCLK
Definition: commctrl.h:134
#define PSN_KILLACTIVE
Definition: prsht.h:116
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2643
#define ListView_GetExtendedListViewStyle(hwndLV)
Definition: commctrl.h:2698
static BOOL RunSelectedTool(VOID)
Definition: toolspage.cpp:290
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69
static int iToolsPageSortedColumn
Definition: toolspage.cpp:18
smooth NULL
Definition: ftsmooth.c:416
#define LVIS_SELECTED
Definition: commctrl.h:2289
#define WM_DESTROY
Definition: winuser.h:1591
#define IDC_TOOLS_LIST
Definition: resource.h:18
static void Update_States(int iSelectedItem)
Definition: toolspage.cpp:233
VOID LoadResourceString(UINT ResourceId, LPVOID Buffer, UINT ccount, LPVOID DefaultString, BOOL bUnicode)
Definition: enum.c:13
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
#define PropSheet_UnChanged(d, w)
Definition: prsht.h:340
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_BTN_RUN
Definition: resource.h:16
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ListView_SetExtendedListViewStyle(hwndLV, dw)
Definition: commctrl.h:2695
#define PSNRET_NOERROR
Definition: prsht.h:129
#define MB_ICONINFORMATION
Definition: winuser.h:796
static const WCHAR L[]
Definition: oid.c:1087
#define WM_COMMAND
Definition: winuser.h:1716
#define IDC_CBX_TOOLS_ADVOPT
Definition: resource.h:85
#define LVNI_ALL
Definition: commctrl.h:2392
HWND WINAPI GetParent(_In_ HWND)
BOOL ListView_SortEx(HWND hListView, int iSortingColumn, int iSortedColumn)
Definition: listview.c:43
HINSTANCE hInst
Definition: dxdiag.c:13
#define NM_DBLCLK
Definition: commctrl.h:131
struct tagNMLISTVIEW * LPNMLISTVIEW
#define PSN_RESET
Definition: prsht.h:118
#define IDS_TOOLS_COLUMN_NAME
Definition: resource.h:79
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define MB_OK
Definition: winuser.h:784
#define LVN_COLUMNCLICK
Definition: commctrl.h:3109
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2364
#define LVIF_PARAM
Definition: commctrl.h:2281
#define LVITEM
Definition: commctrl.h:2345
#define ListView_GetSelectionMark(hwnd)
Definition: commctrl.h:2759
#define LVIF_STATE
Definition: commctrl.h:2282
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define PSN_QUERYINITIALFOCUS
Definition: settings.cpp:98
#define LVIS_FOCUSED
Definition: commctrl.h:2288
#define WM_NOTIFY
Definition: richedit.h:61
#define IDS_TOOLS_COLUMN_DESCR
Definition: resource.h:80
static void FillListView(void)
Definition: toolspage.cpp:178
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2384
#define IDS_TOOLS_COLUMN_STANDARD
Definition: resource.h:89

◆ Update_States()

static void Update_States ( int  iSelectedItem)
static

Definition at line 233 of file toolspage.cpp.

Referenced by ToolsPageWndProc().

234 {
235  TOOL* tool;
236  LVITEM item = {};
237 
239 
240  item.mask = LVIF_PARAM;
241  item.iItem = iSelectedItem;
242 
243  if (ListView_GetItem(hToolsListCtrl, &item)) // (item.iItem > -1) // TODO: corriger ailleurs ce genre de code...
244  {
245  LPWSTR lpszCmdLine = NULL;
246  size_t numOfChars = 0;
247  tool = reinterpret_cast<TOOL*>(item.lParam);
248 
250 
252 
253  if (!*(wchar_t*)tool->m_AdvParam)
254  {
257  }
258  else
259  {
262  }
263 
266  {
267  numOfChars = BuildCommandLine(NULL, tool->m_Command, tool->m_AdvParam, 0);
268  lpszCmdLine = (LPWSTR)MemAlloc(0, numOfChars * sizeof(WCHAR));
269  BuildCommandLine(lpszCmdLine, tool->m_Command, tool->m_AdvParam, numOfChars);
270  }
271  else
272  {
273  numOfChars = BuildCommandLine(NULL, tool->m_Command, tool->m_DefParam, 0);
274  lpszCmdLine = (LPWSTR)MemAlloc(0, numOfChars * sizeof(WCHAR));
275  BuildCommandLine(lpszCmdLine, tool->m_Command, tool->m_DefParam, numOfChars);
276  }
277 
279 
280  MemFree(lpszCmdLine);
281  }
282  else
283  {
287  }
288 }
_bstr_t m_Command
Definition: toolspage.cpp:38
#define ListView_EnsureVisible(hwndLV, i, fPartialOK)
Definition: commctrl.h:2489
#define SW_NORMAL
Definition: winuser.h:763
#define TRUE
Definition: types.h:120
BOOL MemFree(IN PVOID lpMem)
Definition: utils.c:26
_bstr_t m_DefParam
Definition: toolspage.cpp:39
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SW_HIDE
Definition: winuser.h:762
PVOID MemAlloc(IN DWORD dwFlags, IN DWORD dwBytes)
Definition: utils.c:33
static HWND hToolsListCtrl
Definition: toolspage.cpp:17
#define assert(x)
Definition: debug.h:53
#define Button_Enable(hwndCtl, fEnable)
Definition: windowsx.h:5
static HWND hToolsPage
Definition: toolspage.cpp:16
#define SendDlgItemMessage
Definition: winuser.h:5708
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define Button_IsEnabled(hwndCtl)
Definition: comctl32supp.h:18
LONG_PTR LPARAM
Definition: windef.h:208
smooth NULL
Definition: ftsmooth.c:416
#define WM_SETTEXT
Definition: winuser.h:1599
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_BTN_RUN
Definition: resource.h:16
#define Button_GetCheck(hwndCtl)
Definition: windowsx.h:6
#define IDC_CBX_TOOLS_ADVOPT
Definition: resource.h:85
static ATOM item
Definition: dde.c:856
#define BST_CHECKED
Definition: winuser.h:197
#define IDC_TOOLS_CMDLINE
Definition: resource.h:15
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2364
#define LVIF_PARAM
Definition: commctrl.h:2281
#define LVITEM
Definition: commctrl.h:2345
WCHAR * LPWSTR
Definition: xmlstorage.h:184
_bstr_t m_AdvParam
Definition: toolspage.cpp:40
static size_t BuildCommandLine(LPWSTR lpszDest, LPCWSTR lpszCmdLine, LPCWSTR lpszParam, size_t bufSize)
Definition: toolspage.cpp:204

Variable Documentation

◆ hToolsListCtrl

HWND hToolsListCtrl = NULL
static

Definition at line 17 of file toolspage.cpp.

◆ hToolsPage

HWND hToolsPage = NULL
static

Definition at line 16 of file toolspage.cpp.

◆ iToolsPageSortedColumn

int iToolsPageSortedColumn = 0
static

Definition at line 18 of file toolspage.cpp.

Referenced by ToolsPageWndProc().