ReactOS  0.4.14-dev-606-g14ebc0b
console.c File Reference
#include "precomp.h"
#include <stdlib.h>
#include <strsafe.h>
#include "resource.h"
#include <debug.h>
Include dependency graph for console.c:

Go to the source code of this file.

Classes

struct  _CONSOLE_MAINFRAME_WND
 
struct  _CONSOLE_CHILDFRM_WND
 

Macros

#define NDEBUG
 

Typedefs

typedef struct _CONSOLE_MAINFRAME_WND CONSOLE_MAINFRAME_WND
 
typedef struct _CONSOLE_MAINFRAME_WNDPCONSOLE_MAINFRAME_WND
 
typedef struct _CONSOLE_CHILDFRM_WND CONSOLE_CHILDFRM_WND
 
typedef struct _CONSOLE_CHILDFRM_WNDPCONSOLE_CHILDFRM_WND
 

Functions

PCONSOLE_CHILDFRM_WND GetActiveChildInfo (VOID)
 
static LPTSTR CreateNewConsoleTitle (VOID)
 
HWND CreateNewMDIChild (PCONSOLE_MAINFRAME_WND Info, HWND hwndMDIClient)
 
static LRESULT FrameOnCreate (HWND hwnd, LPARAM lParam)
 
static VOID SetFileName (PCONSOLE_CHILDFRM_WND Info, PWSTR pFileName)
 
static BOOL DoSaveFileAs (HWND hWnd, PCONSOLE_CHILDFRM_WND pChildInfo)
 
static BOOL DoSaveFile (HWND hWnd, PCONSOLE_CHILDFRM_WND pChildInfo)
 
static BOOL FrameOnSave (HWND hWnd)
 
static BOOL FrameOnSaveAs (HWND hWnd)
 
static VOID FrameOnCommand (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static VOID FrameOnSize (HWND hMainWnd, WORD cx, WORD cy)
 
static LRESULT CALLBACK ConsoleMainFrameWndProc (IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static LRESULT CALLBACK ConsoleChildFrmProc (IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
BOOL RegisterMMCWndClasses (VOID)
 
VOID UnregisterMMCWndClasses (VOID)
 
HWND CreateConsoleWindow (IN LPCTSTR lpFileName OPTIONAL, int nCmdShow)
 

Variables

static const TCHAR szMMCMainFrame [] = TEXT("MMCMainFrame")
 
static const TCHAR szMMCChildFrm [] = TEXT("MMCChildFrm")
 
static ULONG NewConsoleCount = 0
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 26 of file console.c.

Typedef Documentation

◆ CONSOLE_CHILDFRM_WND

◆ CONSOLE_MAINFRAME_WND

◆ PCONSOLE_CHILDFRM_WND

◆ PCONSOLE_MAINFRAME_WND

Function Documentation

◆ ConsoleChildFrmProc()

static LRESULT CALLBACK ConsoleChildFrmProc ( IN HWND  hwnd,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 468 of file console.c.

472 {
474 
476  0);
477 
478  switch (uMsg)
479  {
480  case WM_CREATE:
483  sizeof(CONSOLE_CHILDFRM_WND));
484  if (Info != NULL)
485  {
486  Info->hwnd = hwnd;
487 
489  0,
490  (LONG_PTR)Info);
491  }
492  break;
493 
494  case WM_DESTROY:
495  if (Info != NULL)
496  {
497  if (Info->pFileName)
498  HeapFree(hAppHeap, 0, Info->pFileName);
499 
500  HeapFree(hAppHeap, 0, Info);
501  }
502 
504  break;
505 
506  default:
507  return DefMDIChildProc(hwnd, uMsg, wParam, lParam);
508  }
509 
510  return 0;
511 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define WM_USER_CLOSE_CHILD
Definition: precomp.h:14
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
struct TraceInfo Info
smooth NULL
Definition: ftsmooth.c:416
struct _CONSOLE_CHILDFRM_WND * PCONSOLE_CHILDFRM_WND
#define DefMDIChildProc
Definition: ros2win.h:33
#define WM_DESTROY
Definition: winuser.h:1591
#define PostMessage
Definition: winuser.h:5807
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HANDLE hAppHeap
Definition: mmc.c:24
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define WM_CREATE
Definition: winuser.h:1590
#define GetWindowLongPtr
Definition: treelist.c:73
HWND hwndMainConsole
Definition: mmc.c:25
LPARAM lParam
Definition: combotst.c:139
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by RegisterMMCWndClasses().

◆ ConsoleMainFrameWndProc()

static LRESULT CALLBACK ConsoleMainFrameWndProc ( IN HWND  hwnd,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 387 of file console.c.

391 {
393 
395  0);
396 
397  switch (uMsg)
398  {
399  case WM_CREATE:
400  return FrameOnCreate(hwnd,
401  lParam);
402 
403  case WM_COMMAND:
405  uMsg,
406  wParam,
407  lParam);
408  break;
409 
410  case WM_SIZE:
412  LOWORD(lParam),
413  HIWORD(lParam));
414  break;
415 
416  case WM_CLOSE:
418  break;
419 
420  case WM_DESTROY:
421  if (Info != NULL)
422  {
423  SetMenu(Info->hwnd,
424  NULL);
425 
426  if (Info->hMenuConsoleSmall != NULL)
427  {
428  DestroyMenu(Info->hMenuConsoleSmall);
429  Info->hMenuConsoleSmall = NULL;
430  }
431 
432  if (Info->hMenuConsoleLarge != NULL)
433  {
434  DestroyMenu(Info->hMenuConsoleLarge);
435  Info->hMenuConsoleLarge = NULL;
436  }
437 
439  0,
440  Info);
441  }
442 
443  PostQuitMessage(0);
444  break;
445 
446  case WM_USER_CLOSE_CHILD:
447  Info->nConsoleCount--;
448  if (Info->nConsoleCount == 0)
449  {
450  SetMenu(Info->hwnd,
451  Info->hMenuConsoleSmall);
452  }
453  break;
454 
455  default:
456  return DefFrameProc(hwnd,
458  uMsg,
459  wParam,
460  lParam);
461  }
462 
463  return 0;
464 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
struct _CONSOLE_MAINFRAME_WND * PCONSOLE_MAINFRAME_WND
HWND hwndMDIClient
Definition: mmc.c:26
#define WM_USER_CLOSE_CHILD
Definition: precomp.h:14
BOOL WINAPI DestroyWindow(_In_ HWND)
WPARAM wParam
Definition: combotst.c:138
struct TraceInfo Info
#define DefFrameProc
Definition: ros2win.h:32
smooth NULL
Definition: ftsmooth.c:416
#define WM_DESTROY
Definition: winuser.h:1591
#define WM_SIZE
Definition: winuser.h:1593
BOOL WINAPI SetMenu(_In_ HWND, _In_opt_ HMENU)
#define WM_CLOSE
Definition: winuser.h:1603
static LRESULT FrameOnCreate(HWND hwnd, LPARAM lParam)
Definition: console.c:113
HANDLE hAppHeap
Definition: mmc.c:24
#define WM_COMMAND
Definition: winuser.h:1722
BOOL WINAPI DestroyMenu(_In_ HMENU)
static VOID FrameOnSize(HWND hMainWnd, WORD cx, WORD cy)
Definition: console.c:356
static VOID FrameOnCommand(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: console.c:307
#define WM_CREATE
Definition: winuser.h:1590
#define HIWORD(l)
Definition: typedefs.h:246
#define GetWindowLongPtr
Definition: treelist.c:73
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:402
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)

Referenced by RegisterMMCWndClasses().

◆ CreateConsoleWindow()

HWND CreateConsoleWindow ( IN LPCTSTR lpFileName  OPTIONAL,
int  nCmdShow 
)

Definition at line 574 of file console.c.

576 {
577  HWND hWndConsole;
579 
580  hWndConsole = CreateWindowEx(WS_EX_WINDOWEDGE,
582  NULL,
588  NULL,
589  NULL,
590  hAppInstance,
591  (PVOID)FileName);
592 
593  if (hWndConsole != NULL)
594  {
595  ShowWindow(hWndConsole, nCmdShow);
596  }
597 
598  return hWndConsole;
599 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define LONG_PTR
Definition: treelist.c:79
static const TCHAR szMMCMainFrame[]
Definition: console.c:54
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define CreateWindowEx
Definition: winuser.h:5730
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
_In_ LPCSTR lpFileName
Definition: winbase.h:3028
HINSTANCE hAppInstance
Definition: mmc.c:23

Referenced by _tWinMain().

◆ CreateNewConsoleTitle()

static LPTSTR CreateNewConsoleTitle ( VOID  )
static

Definition at line 73 of file console.c.

74 {
76 
79  &lpTitle,
80  ++NewConsoleCount) == 0)
81  {
82  lpTitle = NULL;
83  }
84 
85  return lpTitle;
86 }
#define IDS_CONSOLETITLE
Definition: resource.h:4
CHAR * LPTSTR
Definition: xmlstorage.h:192
smooth NULL
Definition: ftsmooth.c:416
DWORD LoadAndFormatString(IN HINSTANCE hInstance, IN UINT uID, OUT LPTSTR *lpTarget,...)
Definition: misc.c:86
static ULONG NewConsoleCount
Definition: console.c:57
TCHAR lpTitle[80]
Definition: ctm.c:69
HINSTANCE hAppInstance
Definition: mmc.c:23

Referenced by CreateNewMDIChild().

◆ CreateNewMDIChild()

HWND CreateNewMDIChild ( PCONSOLE_MAINFRAME_WND  Info,
HWND  hwndMDIClient 
)

Definition at line 89 of file console.c.

91 {
93  HWND hChild;
94 
95  mcs.szTitle = CreateNewConsoleTitle();
96  mcs.szClass = szMMCChildFrm;
97  mcs.hOwner = GetModuleHandle(NULL);
98  mcs.x = mcs.cx = CW_USEDEFAULT;
99  mcs.y = mcs.cy = CW_USEDEFAULT;
100  mcs.style = MDIS_ALLCHILDSTYLES;
101 
103  if (hChild)
104  {
105  Info->nConsoleCount++;
106  }
107 
108  return hChild;
109 }
static LPTSTR CreateNewConsoleTitle(VOID)
Definition: console.c:73
HWND hwndMDIClient
Definition: mmc.c:26
static HTREEITEM hChild
Definition: treeview.c:381
HANDLE HWND
Definition: compat.h:13
struct TraceInfo Info
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define MDIS_ALLCHILDSTYLES
Definition: winuser.h:253
#define GetModuleHandle
Definition: winbase.h:3661
static const TCHAR szMMCChildFrm[]
Definition: console.c:55
#define WM_MDICREATE
Definition: winuser.h:1794
#define SendMessage
Definition: winuser.h:5818
static struct myctx * mcs
Definition: adnstest.c:53

Referenced by FrameOnCommand().

◆ DoSaveFile()

static BOOL DoSaveFile ( HWND  hWnd,
PCONSOLE_CHILDFRM_WND  pChildInfo 
)
static

Definition at line 207 of file console.c.

210 {
211  DPRINT1("pChildInfo %p\n", pChildInfo);
212 
213  DPRINT1("FileName %S\n", pChildInfo->pFileName);
214 
215  if (pChildInfo->pFileName == NULL)
216  return DoSaveFileAs(hWnd, pChildInfo);
217 
218  /* FIXME: Save the console here! */
219 
220  return TRUE;
221 }
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
smooth NULL
Definition: ftsmooth.c:416
static BOOL DoSaveFileAs(HWND hWnd, PCONSOLE_CHILDFRM_WND pChildInfo)
Definition: console.c:224
#define DPRINT1
Definition: precomp.h:8

Referenced by DoFileSave(), DoSaveFileAs(), and FrameOnSave().

◆ DoSaveFileAs()

static BOOL DoSaveFileAs ( HWND  hWnd,
PCONSOLE_CHILDFRM_WND  pChildInfo 
)
static

Definition at line 224 of file console.c.

227 {
228  OPENFILENAME saveas;
230 
231  DPRINT1("pChildInfo %p\n", pChildInfo);
232  DPRINT1("FileName %S\n", pChildInfo->pFileName);
233 
234  ZeroMemory(&saveas, sizeof(saveas));
235 
236  if (pChildInfo->pFileName != NULL)
237  {
238  StringCbCopy(szPath, sizeof(szPath), pChildInfo->pFileName);
239  }
240  else
241  {
242  GetWindowText(pChildInfo->hwnd, szPath, _countof(szPath));
243  StringCbCat(szPath, sizeof(szPath), TEXT(".msc"));
244  }
245 
246  saveas.lStructSize = sizeof(OPENFILENAME);
247  saveas.hwndOwner = hWnd;
248  saveas.hInstance = hAppInstance;
249  saveas.lpstrFilter = L"MSC Files\0*.msc\0";
250  saveas.lpstrFile = szPath;
251  saveas.nMaxFile = MAX_PATH;
253  saveas.lpstrDefExt = L"msc";
254 
255  if (GetSaveFileName(&saveas))
256  {
257  /* HACK: Because in ROS, Save-As boxes don't check the validity
258  * of file names and thus, here, szPath can be invalid !! We only
259  * see its validity when we call DoSaveFile()... */
260  SetFileName(pChildInfo, szPath);
261 
262  if (DoSaveFile(hWnd, pChildInfo))
263  {
264 // UpdateWindowCaption();
265  return TRUE;
266  }
267  else
268  {
269  SetFileName(pChildInfo, NULL);
270  return FALSE;
271  }
272  }
273  else
274  {
275  return FALSE;
276  }
277 }
#define TRUE
Definition: types.h:120
HWND hwndOwner
Definition: commdlg.h:330
#define _countof(array)
Definition: fontsub.cpp:30
HWND hWnd
Definition: settings.c:17
#define ZeroMemory
Definition: winbase.h:1642
LPCSTR lpstrDefExt
Definition: commdlg.h:345
#define GetWindowText
Definition: winuser.h:5773
DWORD nMaxFile
Definition: commdlg.h:337
#define GetSaveFileName
Definition: commdlg.h:666
smooth NULL
Definition: ftsmooth.c:416
HINSTANCE hInstance
Definition: commdlg.h:331
OPENFILENAMEA OPENFILENAME
Definition: commdlg.h:657
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
static VOID SetFileName(PCONSOLE_CHILDFRM_WND Info, PWSTR pFileName)
Definition: console.c:179
char TCHAR
Definition: xmlstorage.h:189
#define StringCbCat
Definition: strsafe.h:334
#define MAX_PATH
Definition: compat.h:26
DWORD lStructSize
Definition: commdlg.h:329
#define StringCbCopy
Definition: strsafe.h:155
static const WCHAR L[]
Definition: oid.c:1250
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
static BOOL DoSaveFile(HWND hWnd, PCONSOLE_CHILDFRM_WND pChildInfo)
Definition: console.c:207
#define TEXT(s)
Definition: k32.h:26
LPSTR lpstrFile
Definition: commdlg.h:336
LPCWSTR szPath
Definition: env.c:35
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
LPCSTR lpstrFilter
Definition: commdlg.h:332
#define DPRINT1
Definition: precomp.h:8
HINSTANCE hAppInstance
Definition: mmc.c:23
DWORD Flags
Definition: commdlg.h:342

Referenced by DoSaveFile(), and FrameOnSaveAs().

◆ FrameOnCommand()

static VOID FrameOnCommand ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 307 of file console.c.

311 {
313  HWND hChild;
314 
316 
317  switch (LOWORD(wParam))
318  {
319  case IDM_FILE_NEW:
321  SetMenu(Info->hwnd,
322  Info->hMenuConsoleLarge);
323  break;
324 
325  case IDM_FILE_SAVE:
326  FrameOnSave(hwnd);
327  break;
328 
329  case IDM_FILE_SAVEAS:
331  break;
332 
333  case IDM_FILE_EXIT:
334  PostMessage(hwnd, WM_CLOSE, 0, 0);
335  break;
336 
337  default:
339  {
341  }
342  else
343  {
345  if (hChild)
346  {
348  }
349  }
350  break;
351  }
352 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
struct _CONSOLE_MAINFRAME_WND * PCONSOLE_MAINFRAME_WND
HWND hwndMDIClient
Definition: mmc.c:26
static HTREEITEM hChild
Definition: treeview.c:381
static BOOL FrameOnSaveAs(HWND hWnd)
Definition: console.c:294
HANDLE HWND
Definition: compat.h:13
#define IDM_FILE_NEW
Definition: resource.h:11
static BOOL FrameOnSave(HWND hWnd)
Definition: console.c:280
WPARAM wParam
Definition: combotst.c:138
struct TraceInfo Info
#define DefFrameProc
Definition: ros2win.h:32
#define PostMessage
Definition: winuser.h:5807
BOOL WINAPI SetMenu(_In_ HWND, _In_opt_ HMENU)
#define WM_CLOSE
Definition: winuser.h:1603
#define IDM_MDI_FIRSTCHILD
Definition: resource.h:19
#define WM_MDIGETACTIVE
Definition: winuser.h:1803
#define WM_COMMAND
Definition: winuser.h:1722
#define IDM_FILE_SAVEAS
Definition: resource.h:14
#define SendMessage
Definition: winuser.h:5818
#define GetWindowLongPtr
Definition: treelist.c:73
HWND CreateNewMDIChild(PCONSOLE_MAINFRAME_WND Info, HWND hwndMDIClient)
Definition: console.c:89
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define IDM_FILE_EXIT
Definition: resource.h:15
#define IDM_FILE_SAVE
Definition: resource.h:13

Referenced by ConsoleMainFrameWndProc().

◆ FrameOnCreate()

static LRESULT FrameOnCreate ( HWND  hwnd,
LPARAM  lParam 
)
static

Definition at line 113 of file console.c.

115 {
117  CLIENTCREATESTRUCT ccs;
118  LPCTSTR lpFileName = (LPCTSTR)(((LPCREATESTRUCT)lParam)->lpCreateParams);
119 
122  sizeof(CONSOLE_MAINFRAME_WND));
123  if (Info == NULL)
124  return -1;
125 
126  Info->hwnd = hwnd;
127 
129  0,
130  (LONG_PTR)Info);
131 
132  Info->hMenuConsoleSmall = LoadMenu(hAppInstance,
134 
135  Info->hMenuConsoleLarge = LoadMenu(hAppInstance,
137 
138  if (lpFileName == NULL)
139  {
140  /* FIXME */
141  Info->AppAuthorMode = TRUE;
142 // Info->lpConsoleTitle = TEXT("ReactOS Management Console");
143  }
144  else
145  {
146  Info->AppAuthorMode = TRUE;
147 // Info->lpConsoleTitle = CreateNewConsoleTitle();
148  }
149 
150  SetMenu(Info->hwnd,
151  Info->hMenuConsoleSmall);
152 
153  SetWindowText(Info->hwnd, TEXT("ReactOS Management Console"));
154 
155  ccs.hWindowMenu = GetSubMenu(Info->hMenuConsoleLarge, 1);
157 
158  /* Create the MDI client window */
160  L"MDICLIENT",
161  (LPCTSTR)NULL,
167  hwnd,
168  (HMENU)0xCAC,
169  hAppInstance,
170  (LPVOID)&ccs);
171 
172  ShowWindow(Info->hwndMDIClient, SW_SHOW);
173 
174  return 0;
175 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define TRUE
Definition: types.h:120
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
HWND hwndMDIClient
Definition: mmc.c:26
#define WS_CHILD
Definition: pedump.c:617
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define SetWindowLongPtr
Definition: treelist.c:70
struct TraceInfo Info
#define CreateWindowEx
Definition: winuser.h:5730
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
#define IDM_CONSOLE_LARGE
Definition: resource.h:9
#define SW_SHOW
Definition: winuser.h:769
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL WINAPI SetMenu(_In_ HWND, _In_opt_ HMENU)
#define IDM_MDI_FIRSTCHILD
Definition: resource.h:19
#define WS_HSCROLL
Definition: pedump.c:628
static const WCHAR L[]
Definition: oid.c:1250
HANDLE hAppHeap
Definition: mmc.c:24
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define TEXT(s)
Definition: k32.h:26
#define WS_BORDER
Definition: pedump.c:625
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define LoadMenu
Definition: winuser.h:5792
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define SetWindowText
Definition: winuser.h:5832
#define WS_VSCROLL
Definition: pedump.c:627
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define IDM_CONSOLE_SMALL
Definition: resource.h:8
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
LPARAM lParam
Definition: combotst.c:139
_In_ LPCSTR lpFileName
Definition: winbase.h:3028
HINSTANCE hAppInstance
Definition: mmc.c:23

Referenced by ConsoleMainFrameWndProc().

◆ FrameOnSave()

static BOOL FrameOnSave ( HWND  hWnd)
static

Definition at line 280 of file console.c.

282 {
283  PCONSOLE_CHILDFRM_WND pChildInfo;
284 
285  pChildInfo = GetActiveChildInfo();
286  if (pChildInfo == NULL)
287  return FALSE;
288 
289  return DoSaveFile(hWnd, pChildInfo);
290 }
PCONSOLE_CHILDFRM_WND GetActiveChildInfo(VOID)
Definition: console.c:60
HWND hWnd
Definition: settings.c:17
smooth NULL
Definition: ftsmooth.c:416
static BOOL DoSaveFile(HWND hWnd, PCONSOLE_CHILDFRM_WND pChildInfo)
Definition: console.c:207

Referenced by FrameOnCommand().

◆ FrameOnSaveAs()

static BOOL FrameOnSaveAs ( HWND  hWnd)
static

Definition at line 294 of file console.c.

296 {
297  PCONSOLE_CHILDFRM_WND pChildInfo;
298 
299  pChildInfo = GetActiveChildInfo();
300  if (pChildInfo == NULL)
301  return FALSE;
302 
303  return DoSaveFileAs(hWnd, pChildInfo);
304 }
PCONSOLE_CHILDFRM_WND GetActiveChildInfo(VOID)
Definition: console.c:60
HWND hWnd
Definition: settings.c:17
smooth NULL
Definition: ftsmooth.c:416
static BOOL DoSaveFileAs(HWND hWnd, PCONSOLE_CHILDFRM_WND pChildInfo)
Definition: console.c:224

Referenced by FrameOnCommand().

◆ FrameOnSize()

static VOID FrameOnSize ( HWND  hMainWnd,
WORD  cx,
WORD  cy 
)
static

Definition at line 356 of file console.c.

359 {
360  RECT rcClient; //, rcTool, rcStatus;
361 // int lvHeight, iToolHeight, iStatusHeight;
362 
363  /* Size toolbar and get height */
364 // SendMessage(Info->hTool, TB_AUTOSIZE, 0, 0);
365 // GetWindowRect(Info->hTool, &rcTool);
366 // iToolHeight = rcTool.bottom - rcTool.top;
367 
368  /* Size status bar and get height */
369 // SendMessage(Info->hStatus, WM_SIZE, 0, 0);
370 // GetWindowRect(Info->hStatus, &rcStatus);
371 // iStatusHeight = rcStatus.bottom - rcStatus.top;
372 
373  /* Calculate remaining height and size list view */
374  GetClientRect(hMainWnd, &rcClient);
375 // lvHeight = rcClient.bottom - iToolHeight - iStatusHeight;
376  SetWindowPos(hwndMDIClient, //Info->hTreeView,
377  NULL,
378  0,
379  0, //iToolHeight,
380  rcClient.right,
381  rcClient.bottom, //lvHeight,
382  SWP_NOZORDER);
383 }
HWND hwndMDIClient
Definition: mmc.c:26
#define SWP_NOZORDER
Definition: winuser.h:1232
LONG right
Definition: windef.h:308
smooth NULL
Definition: ftsmooth.c:416
HWND hMainWnd
Definition: magnifier.c:32
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
LONG bottom
Definition: windef.h:309
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)

Referenced by ConsoleMainFrameWndProc().

◆ GetActiveChildInfo()

PCONSOLE_CHILDFRM_WND GetActiveChildInfo ( VOID  )

Definition at line 60 of file console.c.

61 {
62  HWND hWndMDIChild;
63 
64  hWndMDIChild = (HWND)SendMessageW(hwndMDIClient, WM_MDIGETACTIVE, 0, 0);
65  if (hWndMDIChild == NULL)
66  return NULL;
67 
68  return (PCONSOLE_CHILDFRM_WND)GetWindowLongPtr(hWndMDIChild, 0);
69 }
HWND hwndMDIClient
Definition: mmc.c:26
HANDLE HWND
Definition: compat.h:13
smooth NULL
Definition: ftsmooth.c:416
#define WM_MDIGETACTIVE
Definition: winuser.h:1803
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define GetWindowLongPtr
Definition: treelist.c:73

Referenced by FrameOnSave(), and FrameOnSaveAs().

◆ RegisterMMCWndClasses()

BOOL RegisterMMCWndClasses ( VOID  )

Definition at line 515 of file console.c.

516 {
517  WNDCLASSEX wc = {0};
518  BOOL Ret;
519 
520  /* Register the MMCMainFrame window class */
521  wc.cbSize = sizeof(WNDCLASSEX);
522  wc.style = 0;
524  wc.cbClsExtra = 0;
525  wc.cbWndExtra = sizeof(PCONSOLE_MAINFRAME_WND);
526  wc.hInstance = hAppInstance;
529  wc.hCursor = LoadCursor(NULL,
531  wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
532  wc.lpszMenuName = NULL;
534 
535  Ret = (RegisterClassEx(&wc) != (ATOM)0);
536 
537  if (Ret)
538  {
539  /* Register the MMCChildFrm window class */
540  wc.cbSize = sizeof(WNDCLASSEX);
541  wc.style = CS_HREDRAW | CS_VREDRAW;
543  wc.cbClsExtra = 0;
544  wc.cbWndExtra = sizeof(PCONSOLE_CHILDFRM_WND);
545  wc.hInstance = hAppInstance;
548  wc.hbrBackground = (HBRUSH)(COLOR_3DFACE+1);
549  wc.lpszMenuName = NULL;
552 
553  Ret = (RegisterClassEx(&wc) != (ATOM)0);
554  if (!Ret)
555  {
557  hAppInstance);
558  }
559  }
560 
561  return Ret;
562 }
UINT style
Definition: winuser.h:3177
#define MAKEINTRESOURCE
Definition: winuser.h:591
LPCSTR lpszMenuName
Definition: winuser.h:3185
#define RegisterClassEx
Definition: winuser.h:5812
struct _CONSOLE_MAINFRAME_WND * PCONSOLE_MAINFRAME_WND
HCURSOR hCursor
Definition: winuser.h:3183
WNDPROC lpfnWndProc
Definition: winuser.h:3178
LPCSTR lpszClassName
Definition: winuser.h:3186
WORD ATOM
Definition: dimm.idl:113
static const TCHAR szMMCMainFrame[]
Definition: console.c:54
static LRESULT CALLBACK ConsoleChildFrmProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: console.c:468
#define CS_HREDRAW
Definition: winuser.h:648
#define IDI_APPLICATION
Definition: winuser.h:699
HICON hIconSm
Definition: winuser.h:3187
static LRESULT CALLBACK ConsoleMainFrameWndProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: console.c:387
#define COLOR_3DFACE
Definition: winuser.h:919
HINSTANCE hInstance
Definition: winuser.h:3181
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
UINT cbSize
Definition: winuser.h:3176
struct _CONSOLE_CHILDFRM_WND * PCONSOLE_CHILDFRM_WND
HBRUSH hbrBackground
Definition: winuser.h:3184
#define CS_VREDRAW
Definition: winuser.h:653
int cbWndExtra
Definition: winuser.h:3180
HICON hIcon
Definition: winuser.h:3182
#define COLOR_BTNFACE
Definition: winuser.h:918
#define LoadCursor
Definition: winuser.h:5787
int cbClsExtra
Definition: winuser.h:3179
static const TCHAR szMMCChildFrm[]
Definition: console.c:55
#define IDC_ARROW
Definition: winuser.h:682
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5694
#define LoadIcon
Definition: winuser.h:5788
#define UnregisterClass
Definition: winuser.h:5836
HINSTANCE hAppInstance
Definition: mmc.c:23
#define IDI_MAINAPP
Definition: resource.h:6

Referenced by _tWinMain().

◆ SetFileName()

static VOID SetFileName ( PCONSOLE_CHILDFRM_WND  Info,
PWSTR  pFileName 
)
static

Definition at line 179 of file console.c.

182 {
183  DPRINT1("SetFileName(&p \'%S\')\n", Info, pFileName);
184 
185  if (Info->pFileName != NULL)
186  {
187  HeapFree(GetProcessHeap(), 0, Info->pFileName);
188  Info->pFileName = NULL;
189  }
190 
191  if (pFileName != NULL)
192  {
193  Info->pFileName = HeapAlloc(GetProcessHeap(),
194  0,
195  (_tcslen(pFileName) + 1) * sizeof(TCHAR));
196  if (Info->pFileName != NULL)
197  _tcscpy(Info->pFileName, pFileName);
198  }
199 }
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
struct TraceInfo Info
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
smooth NULL
Definition: ftsmooth.c:416
char TCHAR
Definition: xmlstorage.h:189
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define DPRINT1
Definition: precomp.h:8
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by DIALOG_FileSaveAs(), DoCloseFile(), DoOpenFile(), and DoSaveFileAs().

◆ UnregisterMMCWndClasses()

VOID UnregisterMMCWndClasses ( VOID  )

Definition at line 565 of file console.c.

566 {
568  hAppInstance);
570  hAppInstance);
571 }
static const TCHAR szMMCMainFrame[]
Definition: console.c:54
static const TCHAR szMMCChildFrm[]
Definition: console.c:55
#define UnregisterClass
Definition: winuser.h:5836
HINSTANCE hAppInstance
Definition: mmc.c:23

Referenced by _tWinMain().

Variable Documentation

◆ NewConsoleCount

ULONG NewConsoleCount = 0
static

Definition at line 57 of file console.c.

Referenced by CreateNewConsoleTitle().

◆ szMMCChildFrm

const TCHAR szMMCChildFrm[] = TEXT("MMCChildFrm")
static

Definition at line 55 of file console.c.

Referenced by CreateNewMDIChild(), RegisterMMCWndClasses(), and UnregisterMMCWndClasses().

◆ szMMCMainFrame

const TCHAR szMMCMainFrame[] = TEXT("MMCMainFrame")
static

Definition at line 54 of file console.c.

Referenced by CreateConsoleWindow(), RegisterMMCWndClasses(), and UnregisterMMCWndClasses().