2 * WINDOW.C - internal command.
4 * clone from 4nt window command
7 * started - Dr.F <dfaustus@freemail.it>
14 #ifdef INCLUDE_CMD_WINDOW
25 #define A_RESTORE 0x04
32 INT
CommandWindow (LPTSTR cmd
, LPTSTR param
)
47 if (_tcsncmp (param
, _T("/?"), 2) == 0)
50 "change console window aspect\n"
52 "WINDOW [/POS[=]left,top,width,heigth]\n"
53 " [MIN|MAX|RESTORE]\n"
55 "/POS specify window placement and dimensions\n"
56 "MIN minimize the winodw\n"
57 "MAX maximize the winodw\n"
58 "RESTORE restore the window"
67 if (_tcsicmp(p
[i
],_T("min"))==0)
73 if (_tcsicmp(p
[i
],_T("max"))==0)
79 if (_tcsicmp(p
[i
],_T("restore"))==0)
85 if (_tcsnicmp(p
[i
],_T("/pos"),4)==0)
93 if(!(tmp
=_tcschr(tmp
,_T(','))))
95 error_invalid_parameter_format(p
[i
]);
100 pos
.top
=_ttoi(++tmp
);
101 if(!(tmp
=_tcschr(tmp
,_T(','))))
103 error_invalid_parameter_format(p
[i
]);
108 pos
.right
=_ttoi(++tmp
)+pos
.left
;
109 if(!(tmp
=_tcschr(tmp
,_T(','))))
111 error_invalid_parameter_format(p
[i
]);
115 pos
.bottom
=_ttoi(++tmp
)+pos
.top
;
120 if (_tcsnicmp(p
[i
],_T("/size"),5)==0)
129 error_invalid_parameter_format(p
[i
]);
136 //none of them=window title
139 error_invalid_parameter_format(p
[i
]);
144 if (p
[i
][0] ==_T('"'))
147 *_tcschr(p
[i
]+1,_T('"'))=0;
154 SetConsoleTitle(title
);
156 hWnd
=GetConsoleWindow();
158 wp
.length
=sizeof(WINDOWPLACEMENT
);
159 GetWindowPlacement(hWnd
,&wp
);
163 wp
.rcNormalPosition
= pos
;
167 wp
.showCmd
=SW_MINIMIZE
;
170 wp
.showCmd
=SW_SHOWMAXIMIZED
;
172 if(iAction
& A_RESTORE
)
173 wp
.showCmd
=SW_RESTORE
;
175 wp
.length
=sizeof(WINDOWPLACEMENT
);
176 SetWindowPlacement(hWnd
,&wp
);
181 #endif /* INCLUDE_CMD_WINDOW */