ReactOS  0.4.12-dev-102-g4b7f1e0
console.c File Reference
#include "precomp.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 24 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 466 of file console.c.

Referenced by RegisterMMCWndClasses().

470 {
472 
474  0);
475 
476  switch (uMsg)
477  {
478  case WM_CREATE:
479  Info = HeapAlloc(hAppHeap,
481  sizeof(CONSOLE_CHILDFRM_WND));
482  if (Info != NULL)
483  {
484  Info->hwnd = hwnd;
485 
487  0,
488  (LONG_PTR)Info);
489  }
490  break;
491 
492  case WM_DESTROY:
493  if (Info != NULL)
494  {
495  if (Info->pFileName)
496  HeapFree(hAppHeap, 0, Info->pFileName);
497 
498  HeapFree(hAppHeap, 0, Info);
499  }
500 
502  break;
503 
504  default:
505  return DefMDIChildProc(hwnd, uMsg, wParam, lParam);
506  }
507 
508  return 0;
509 }
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:5698
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:394

◆ ConsoleMainFrameWndProc()

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

Definition at line 385 of file console.c.

Referenced by RegisterMMCWndClasses().

389 {
391 
393  0);
394 
395  switch (uMsg)
396  {
397  case WM_CREATE:
398  return FrameOnCreate(hwnd,
399  lParam);
400 
401  case WM_COMMAND:
403  uMsg,
404  wParam,
405  lParam);
406  break;
407 
408  case WM_SIZE:
410  LOWORD(lParam),
411  HIWORD(lParam));
412  break;
413 
414  case WM_CLOSE:
416  break;
417 
418  case WM_DESTROY:
419  if (Info != NULL)
420  {
421  SetMenu(Info->hwnd,
422  NULL);
423 
424  if (Info->hMenuConsoleSmall != NULL)
425  {
427  Info->hMenuConsoleSmall = NULL;
428  }
429 
430  if (Info->hMenuConsoleLarge != NULL)
431  {
433  Info->hMenuConsoleLarge = NULL;
434  }
435 
437  0,
438  Info);
439  }
440 
441  PostQuitMessage(0);
442  break;
443 
444  case WM_USER_CLOSE_CHILD:
445  Info->nConsoleCount--;
446  if (Info->nConsoleCount == 0)
447  {
448  SetMenu(Info->hwnd,
449  Info->hMenuConsoleSmall);
450  }
451  break;
452 
453  default:
454  return DefFrameProc(hwnd,
456  uMsg,
457  wParam,
458  lParam);
459  }
460 
461  return 0;
462 }
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:111
HANDLE hAppHeap
Definition: mmc.c:24
#define WM_COMMAND
Definition: winuser.h:1716
BOOL WINAPI DestroyMenu(_In_ HMENU)
static VOID FrameOnSize(HWND hMainWnd, WORD cx, WORD cy)
Definition: console.c:354
static VOID FrameOnCommand(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: console.c:305
#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:394
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)

◆ CreateConsoleWindow()

HWND CreateConsoleWindow ( IN LPCTSTR lpFileName  OPTIONAL,
int  nCmdShow 
)

Definition at line 572 of file console.c.

Referenced by _tWinMain().

574 {
575  HWND hWndConsole;
577 
578  hWndConsole = CreateWindowEx(WS_EX_WINDOWEDGE,
580  NULL,
586  NULL,
587  NULL,
588  hAppInstance,
589  (PVOID)FileName);
590 
591  if (hWndConsole != NULL)
592  {
593  ShowWindow(hWndConsole, nCmdShow);
594  }
595 
596  return hWndConsole;
597 }
#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:52
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define CreateWindowEx
Definition: winuser.h:5621
#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:3011
HINSTANCE hAppInstance
Definition: mmc.c:23

◆ CreateNewConsoleTitle()

static LPTSTR CreateNewConsoleTitle ( VOID  )
static

Definition at line 71 of file console.c.

Referenced by CreateNewMDIChild().

72 {
74 
77  &lpTitle,
78  ++NewConsoleCount) == 0)
79  {
80  lpTitle = NULL;
81  }
82 
83  return lpTitle;
84 }
#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:55
TCHAR lpTitle[80]
Definition: ctm.c:67
HINSTANCE hAppInstance
Definition: mmc.c:23

◆ CreateNewMDIChild()

HWND CreateNewMDIChild ( PCONSOLE_MAINFRAME_WND  Info,
HWND  hwndMDIClient 
)

Definition at line 87 of file console.c.

Referenced by FrameOnCommand().

89 {
91  HWND hChild;
92 
94  mcs.szClass = szMMCChildFrm;
96  mcs.x = mcs.cx = CW_USEDEFAULT;
97  mcs.y = mcs.cy = CW_USEDEFAULT;
99 
100  hChild = (HWND)SendMessage(hwndMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs);
101  if (hChild)
102  {
103  Info->nConsoleCount++;
104  }
105 
106  return hChild;
107 }
static LPTSTR CreateNewConsoleTitle(VOID)
Definition: console.c:71
static HTREEITEM hChild
Definition: treeview.c:381
HANDLE HWND
Definition: compat.h:13
LONG_PTR LPARAM
Definition: windef.h:208
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
#define MDIS_ALLCHILDSTYLES
Definition: winuser.h:253
#define GetModuleHandle
Definition: winbase.h:3641
static const TCHAR szMMCChildFrm[]
Definition: console.c:53
#define WM_MDICREATE
Definition: winuser.h:1788
#define SendMessage
Definition: winuser.h:5709
static struct myctx * mcs
Definition: adnstest.c:53

◆ DoSaveFile()

static BOOL DoSaveFile ( HWND  hWnd,
PCONSOLE_CHILDFRM_WND  pChildInfo 
)
static

Definition at line 205 of file console.c.

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

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

◆ DoSaveFileAs()

static BOOL DoSaveFileAs ( HWND  hWnd,
PCONSOLE_CHILDFRM_WND  pChildInfo 
)
static

Definition at line 222 of file console.c.

Referenced by DoSaveFile(), FrameOnSaveAs(), and SetFileName().

225 {
226  OPENFILENAME saveas;
228 
229  DPRINT1("pChildInfo %p\n", pChildInfo);
230  DPRINT1("FileName %S\n", pChildInfo->pFileName);
231 
232  ZeroMemory(&saveas, sizeof(saveas));
233 
234  if (pChildInfo->pFileName != NULL)
235  {
236  _tcscpy(szPath, pChildInfo->pFileName);
237  }
238  else
239  {
240  GetWindowText(pChildInfo->hwnd, szPath, MAX_PATH);
241  _tcscat(szPath, TEXT(".msc"));
242  }
243 
244  saveas.lStructSize = sizeof(OPENFILENAME);
245  saveas.hwndOwner = hWnd;
246  saveas.hInstance = hAppInstance;
247  saveas.lpstrFilter = L"MSC Files\0*.msc\0";
248  saveas.lpstrFile = szPath;
249  saveas.nMaxFile = MAX_PATH;
251  saveas.lpstrDefExt = L"msc";
252 
253  if (GetSaveFileName(&saveas))
254  {
255  /* HACK: Because in ROS, Save-As boxes don't check the validity
256  * of file names and thus, here, szPath can be invalid !! We only
257  * see its validity when we call DoSaveFile()... */
258  SetFileName(pChildInfo, szPath);
259 
260  if (DoSaveFile(hWnd, pChildInfo))
261  {
262 // UpdateWindowCaption();
263  return TRUE;
264  }
265  else
266  {
267  SetFileName(pChildInfo, NULL);
268  return FALSE;
269  }
270  }
271  else
272  {
273  return FALSE;
274  }
275 }
#define TRUE
Definition: types.h:120
HWND hwndOwner
Definition: commdlg.h:330
HWND hWnd
Definition: settings.c:17
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
#define ZeroMemory
Definition: winbase.h:1635
LPCSTR lpstrDefExt
Definition: commdlg.h:345
#define GetWindowText
Definition: winuser.h:5664
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:177
char TCHAR
Definition: xmlstorage.h:189
#define MAX_PATH
Definition: compat.h:26
DWORD lStructSize
Definition: commdlg.h:329
static const WCHAR L[]
Definition: oid.c:1087
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
static BOOL DoSaveFile(HWND hWnd, PCONSOLE_CHILDFRM_WND pChildInfo)
Definition: console.c:205
#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
_TCHAR * _tcscat(_TCHAR *s, const _TCHAR *append)
Definition: tcscat.h:8
HINSTANCE hAppInstance
Definition: mmc.c:23
DWORD Flags
Definition: commdlg.h:342

◆ FrameOnCommand()

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

Definition at line 305 of file console.c.

Referenced by ConsoleMainFrameWndProc().

309 {
311  HWND hChild;
312 
313  Info = (PCONSOLE_MAINFRAME_WND)GetWindowLongPtr(hwnd, 0);
314 
315  switch (LOWORD(wParam))
316  {
317  case IDM_FILE_NEW:
319  SetMenu(Info->hwnd,
320  Info->hMenuConsoleLarge);
321  break;
322 
323  case IDM_FILE_SAVE:
324  FrameOnSave(hwnd);
325  break;
326 
327  case IDM_FILE_SAVEAS:
328  FrameOnSaveAs(hwnd);
329  break;
330 
331  case IDM_FILE_EXIT:
332  PostMessage(hwnd, WM_CLOSE, 0, 0);
333  break;
334 
335  default:
337  {
338  DefFrameProc(hwnd, hwndMDIClient, uMsg, wParam, lParam);
339  }
340  else
341  {
342  hChild = (HWND)SendMessage(hwndMDIClient, WM_MDIGETACTIVE, 0, 0);
343  if (hChild)
344  {
345  SendMessage(hChild, WM_COMMAND, wParam, lParam);
346  }
347  }
348  break;
349  }
350 }
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:292
HANDLE HWND
Definition: compat.h:13
#define IDM_FILE_NEW
Definition: resource.h:11
static BOOL FrameOnSave(HWND hWnd)
Definition: console.c:278
WPARAM wParam
Definition: combotst.c:138
struct TraceInfo Info
#define DefFrameProc
Definition: ros2win.h:32
#define PostMessage
Definition: winuser.h:5698
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:1797
#define WM_COMMAND
Definition: winuser.h:1716
#define IDM_FILE_SAVEAS
Definition: resource.h:14
#define SendMessage
Definition: winuser.h:5709
#define GetWindowLongPtr
Definition: treelist.c:73
HWND CreateNewMDIChild(PCONSOLE_MAINFRAME_WND Info, HWND hwndMDIClient)
Definition: console.c:87
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

◆ FrameOnCreate()

static LRESULT FrameOnCreate ( HWND  hwnd,
LPARAM  lParam 
)
static

Definition at line 111 of file console.c.

Referenced by ConsoleMainFrameWndProc().

113 {
115  CLIENTCREATESTRUCT ccs;
116  LPCTSTR lpFileName = (LPCTSTR)(((LPCREATESTRUCT)lParam)->lpCreateParams);
117 
118  Info = HeapAlloc(hAppHeap,
120  sizeof(CONSOLE_MAINFRAME_WND));
121  if (Info == NULL)
122  return -1;
123 
124  Info->hwnd = hwnd;
125 
126  SetWindowLongPtr(hwnd,
127  0,
128  (LONG_PTR)Info);
129 
132 
135 
136  if (lpFileName == NULL)
137  {
138  /* FIXME */
139  Info->AppAuthorMode = TRUE;
140 // Info->lpConsoleTitle = TEXT("ReactOS Management Console");
141  }
142  else
143  {
144  Info->AppAuthorMode = TRUE;
145 // Info->lpConsoleTitle = CreateNewConsoleTitle();
146  }
147 
148  SetMenu(Info->hwnd,
149  Info->hMenuConsoleSmall);
150 
151  SetWindowText(Info->hwnd, TEXT("ReactOS Management Console"));
152 
153  ccs.hWindowMenu = GetSubMenu(Info->hMenuConsoleLarge, 1);
155 
156  /* Create the MDI client window */
158  L"MDICLIENT",
159  (LPCTSTR)NULL,
165  hwnd,
166  (HMENU)0xCAC,
167  hAppInstance,
168  (LPVOID)&ccs);
169 
171 
172  return 0;
173 }
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:5621
#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:1087
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:5683
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define SetWindowText
Definition: winuser.h:5723
#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:3011
HINSTANCE hAppInstance
Definition: mmc.c:23

◆ FrameOnSave()

static BOOL FrameOnSave ( HWND  hWnd)
static

Definition at line 278 of file console.c.

Referenced by FrameOnCommand().

280 {
281  PCONSOLE_CHILDFRM_WND pChildInfo;
282 
283  pChildInfo = GetActiveChildInfo();
284  if (pChildInfo == NULL)
285  return FALSE;
286 
287  return DoSaveFile(hWnd, pChildInfo);
288 }
PCONSOLE_CHILDFRM_WND GetActiveChildInfo(VOID)
Definition: console.c:58
smooth NULL
Definition: ftsmooth.c:416
static BOOL DoSaveFile(HWND hWnd, PCONSOLE_CHILDFRM_WND pChildInfo)
Definition: console.c:205

◆ FrameOnSaveAs()

static BOOL FrameOnSaveAs ( HWND  hWnd)
static

Definition at line 292 of file console.c.

Referenced by FrameOnCommand().

294 {
295  PCONSOLE_CHILDFRM_WND pChildInfo;
296 
297  pChildInfo = GetActiveChildInfo();
298  if (pChildInfo == NULL)
299  return FALSE;
300 
301  return DoSaveFileAs(hWnd, pChildInfo);
302 }
PCONSOLE_CHILDFRM_WND GetActiveChildInfo(VOID)
Definition: console.c:58
smooth NULL
Definition: ftsmooth.c:416
static BOOL DoSaveFileAs(HWND hWnd, PCONSOLE_CHILDFRM_WND pChildInfo)
Definition: console.c:222

◆ FrameOnSize()

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

Definition at line 354 of file console.c.

Referenced by ConsoleMainFrameWndProc().

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

◆ GetActiveChildInfo()

PCONSOLE_CHILDFRM_WND GetActiveChildInfo ( VOID  )

Definition at line 58 of file console.c.

Referenced by FrameOnSave(), and FrameOnSaveAs().

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

◆ RegisterMMCWndClasses()

BOOL RegisterMMCWndClasses ( VOID  )

Definition at line 513 of file console.c.

Referenced by _tWinMain().

514 {
515  WNDCLASSEX wc = {0};
516  BOOL Ret;
517 
518  /* Register the MMCMainFrame window class */
519  wc.cbSize = sizeof(WNDCLASSEX);
520  wc.style = 0;
522  wc.cbClsExtra = 0;
523  wc.cbWndExtra = sizeof(PCONSOLE_MAINFRAME_WND);
524  wc.hInstance = hAppInstance;
527  wc.hCursor = LoadCursor(NULL,
529  wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
530  wc.lpszMenuName = NULL;
532 
533  Ret = (RegisterClassEx(&wc) != (ATOM)0);
534 
535  if (Ret)
536  {
537  /* Register the MMCChildFrm window class */
538  wc.cbSize = sizeof(WNDCLASSEX);
539  wc.style = CS_HREDRAW | CS_VREDRAW;
541  wc.cbClsExtra = 0;
542  wc.cbWndExtra = sizeof(PCONSOLE_CHILDFRM_WND);
543  wc.hInstance = hAppInstance;
546  wc.hbrBackground = (HBRUSH)(COLOR_3DFACE+1);
547  wc.lpszMenuName = NULL;
550 
551  Ret = (RegisterClassEx(&wc) != (ATOM)0);
552  if (!Ret)
553  {
555  hAppInstance);
556  }
557  }
558 
559  return Ret;
560 }
UINT style
Definition: winuser.h:3155
#define MAKEINTRESOURCE
Definition: winuser.h:591
LPCSTR lpszMenuName
Definition: winuser.h:3163
#define RegisterClassEx
Definition: winuser.h:5703
struct _CONSOLE_MAINFRAME_WND * PCONSOLE_MAINFRAME_WND
HCURSOR hCursor
Definition: winuser.h:3161
WNDPROC lpfnWndProc
Definition: winuser.h:3156
LPCSTR lpszClassName
Definition: winuser.h:3164
WORD ATOM
Definition: dimm.idl:113
static const TCHAR szMMCMainFrame[]
Definition: console.c:52
static LRESULT CALLBACK ConsoleChildFrmProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: console.c:466
#define CS_HREDRAW
Definition: winuser.h:648
#define IDI_APPLICATION
Definition: winuser.h:699
HICON hIconSm
Definition: winuser.h:3165
static LRESULT CALLBACK ConsoleMainFrameWndProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: console.c:385
#define COLOR_3DFACE
Definition: winuser.h:919
HINSTANCE hInstance
Definition: winuser.h:3159
smooth NULL
Definition: ftsmooth.c:416
UINT cbSize
Definition: winuser.h:3154
struct _CONSOLE_CHILDFRM_WND * PCONSOLE_CHILDFRM_WND
HBRUSH hbrBackground
Definition: winuser.h:3162
#define CS_VREDRAW
Definition: winuser.h:653
unsigned int BOOL
Definition: ntddk_ex.h:94
int cbWndExtra
Definition: winuser.h:3158
HICON hIcon
Definition: winuser.h:3160
#define COLOR_BTNFACE
Definition: winuser.h:918
#define LoadCursor
Definition: winuser.h:5678
int cbClsExtra
Definition: winuser.h:3157
static const TCHAR szMMCChildFrm[]
Definition: console.c:53
#define IDC_ARROW
Definition: winuser.h:682
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5585
#define LoadIcon
Definition: winuser.h:5679
#define UnregisterClass
Definition: winuser.h:5727
HINSTANCE hAppInstance
Definition: mmc.c:23
#define IDI_MAINAPP
Definition: resource.h:6

◆ SetFileName()

static VOID SetFileName ( PCONSOLE_CHILDFRM_WND  Info,
PWSTR  pFileName 
)
static

Definition at line 177 of file console.c.

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

180 {
181  DPRINT1("SetFileName(&p \'%S\')\n", Info, pFileName);
182 
183  if (Info->pFileName != NULL)
184  {
185  HeapFree(GetProcessHeap(), 0, Info->pFileName);
186  Info->pFileName = NULL;
187  }
188 
189  if (pFileName != NULL)
190  {
192  0,
193  (_tcslen(pFileName) + 1) * sizeof(TCHAR));
194  if (Info->pFileName != NULL)
195  _tcscpy(Info->pFileName, pFileName);
196  }
197 }
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
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:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define DPRINT1
Definition: precomp.h:8
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ UnregisterMMCWndClasses()

VOID UnregisterMMCWndClasses ( VOID  )

Definition at line 563 of file console.c.

Referenced by _tWinMain().

564 {
566  hAppInstance);
568  hAppInstance);
569 }
static const TCHAR szMMCMainFrame[]
Definition: console.c:52
static const TCHAR szMMCChildFrm[]
Definition: console.c:53
#define UnregisterClass
Definition: winuser.h:5727
HINSTANCE hAppInstance
Definition: mmc.c:23

Variable Documentation

◆ NewConsoleCount

ULONG NewConsoleCount = 0
static

Definition at line 55 of file console.c.

Referenced by CreateNewConsoleTitle().

◆ szMMCChildFrm

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

Definition at line 53 of file console.c.

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

◆ szMMCMainFrame

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

Definition at line 52 of file console.c.

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