WinConsole.h File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <Winuser.h>

Include dependency graph for WinConsole.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define _WIN32_WINNT   0x0500
#define NameConsole   "Console"

Functions

void RenameConsole (void)
void CreateScilabConsole (BOOL ShowBanner)
void CloseScilabConsole (void)
void UpdateConsoleColors (void)
void SaveConsoleColors (void)
void RestoreConsoleColors (void)
void SetWindowMode (BOOL ON)
BOOL IsWindowInterface ()
int FindFreeScilexNumber (void)
void HideScilex (void)
void ShowScilex (void)
void SwitchConsole (void)
int GetConsoleState (void)
void SetConsoleState (int state)


Define Documentation

#define _WIN32_WINNT   0x0500

Definition at line 6 of file WinConsole.h.

#define NameConsole   "Console"

Definition at line 16 of file WinConsole.h.

Referenced by CreateScilabConsole(), and RenameConsole().


Function Documentation

void CloseScilabConsole ( void   ) 

Definition at line 78 of file WinConsole.c.

Referenced by Windows_Main().

00079 {
00080         fclose(stdout);
00081         fclose(stderr);
00082         FreeConsole();
00083 }

Here is the caller graph for this function:

void CreateScilabConsole ( BOOL  ShowBanner  ) 

int FindFreeScilexNumber ( void   ) 

Definition at line 138 of file WinConsole.c.

References MAX_PATH, NULL, SCI_VERSION_STRING, and UINT.

Referenced by CreateScilabConsole().

00139 {
00140         HWND hScilexN=NULL;
00141         int Number_of_Scilex=0;
00142         char NameScilex[MAX_PATH];
00143 
00144         wsprintf(NameScilex,"%s (%d)",SCI_VERSION_STRING,Number_of_Scilex);
00145         hScilexN=FindWindow(NULL,NameScilex);
00146         while ( hScilexN )
00147         {
00148                 UINT NbChar=0;
00149                 char FileName[MAX_PATH+1];
00150                 strcpy(FileName,"");
00151 
00152                 NbChar=GetWindowModuleFileName(hScilexN,FileName,MAX_PATH);
00153                 
00154                 if (NbChar>0)
00155                 {
00156                         Number_of_Scilex++;
00157                         wsprintf(NameScilex,"%s (%d)",SCI_VERSION_STRING,Number_of_Scilex);
00158                         hScilexN=FindWindow(NULL,NameScilex);
00159                 }
00160                 else
00161                 {
00162                         hScilexN=NULL;
00163                 }
00164         }
00165 
00166         return Number_of_Scilex;
00167 }

Here is the caller graph for this function:

int GetConsoleState ( void   ) 

Definition at line 219 of file WinConsole.c.

References Windows_Console_State.

Referenced by C2F(), and SwitchConsole().

00220 {
00221         return Windows_Console_State;
00222 }

Here is the caller graph for this function:

void HideScilex ( void   ) 

Definition at line 170 of file WinConsole.c.

References NULL.

Referenced by C2F(), CreateScilabConsole(), SwitchConsole(), and Windows_Main().

00171 {
00172         HWND hScilex=NULL;
00173         hScilex=GetConsoleWindow();
00174         if (hScilex)
00175         {
00176                 ShowWindow(hScilex,SW_HIDE);    
00177         }
00178 }

Here is the caller graph for this function:

BOOL IsWindowInterface (  ) 

Definition at line 127 of file WinConsole.c.

00128 {
00129         return WindowMode;
00130 }

void RenameConsole ( void   ) 

Definition at line 17 of file WinConsole.c.

References FALSE, MAX_PATH, NameConsole, NULL, SCI_VERSION_STRING, and ScilexConsoleName.

Referenced by Console_Main().

00018 {
00019         HMENU hmenuConsole = NULL;
00020         char CurrentConsoleName[MAX_PATH];
00021         char CurrentConsoleNameTmp[MAX_PATH];
00022 
00023         GetConsoleTitle(CurrentConsoleName,MAX_PATH);
00024         strncpy(CurrentConsoleNameTmp,CurrentConsoleName,strlen(NameConsole));
00025         CurrentConsoleNameTmp[strlen(NameConsole)]='\0';
00026 
00027         if ( strcmp(CurrentConsoleNameTmp,NameConsole) != 0)     
00028         {
00029                 wsprintf(ScilexConsoleName,"%s %s",NameConsole,SCI_VERSION_STRING);
00030                 SetConsoleTitle(ScilexConsoleName);
00031         }
00032 
00033         // Desactive croix dans la console
00034         hmenuConsole=GetSystemMenu(GetConsoleWindow(), FALSE);
00035         DeleteMenu(hmenuConsole, SC_CLOSE, MF_BYCOMMAND);
00036 
00037 }

Here is the caller graph for this function:

void RestoreConsoleColors ( void   ) 

Definition at line 110 of file WinConsole.c.

References csbiInfoSave.

Referenced by TerminateGUI().

00111 {
00112         HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
00113         COORD Coord;
00114         DWORD cWritten;
00115 
00116         Coord.X=0;
00117         Coord.Y=0;
00118 
00119         FillConsoleOutputAttribute( hConsole,
00120                                                                 csbiInfoSave.wAttributes,
00121                                                                 csbiInfoSave.dwSize.X*csbiInfoSave.dwSize.Y,
00122                                                                 Coord,
00123                                                                 &cWritten);
00124         SetConsoleTextAttribute(hConsole,csbiInfoSave.wAttributes);
00125 }

Here is the caller graph for this function:

void SaveConsoleColors ( void   ) 

Definition at line 105 of file WinConsole.c.

References csbiInfoSave.

Referenced by Console_Main().

00106 {
00107         GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbiInfoSave); 
00108 }

Here is the caller graph for this function:

void SetConsoleState ( int  state  ) 

Definition at line 224 of file WinConsole.c.

References Windows_Console_State.

Referenced by C2F(), and SwitchConsole().

00225 {
00226         Windows_Console_State=state;
00227 }

Here is the caller graph for this function:

void SetWindowMode ( BOOL  ON  ) 

Definition at line 214 of file WinConsole.c.

References WindowMode.

Referenced by Console_Main(), and Windows_Main().

00215 {
00216           WindowMode=ON;
00217 }

Here is the caller graph for this function:

void ShowScilex ( void   ) 

Definition at line 181 of file WinConsole.c.

References NULL.

Referenced by C2F(), and SwitchConsole().

00182 {
00183   HWND hScilex=NULL;
00184   hScilex=GetConsoleWindow();
00185   if (hScilex)
00186   {
00187         ShowWindow(hScilex,SW_SHOWNOACTIVATE);
00188   }
00189 }

Here is the caller graph for this function:

void SwitchConsole ( void   ) 

Definition at line 191 of file WinConsole.c.

00192 {
00193         switch (GetConsoleState())
00194         {
00195                 /* La fenetre etait cachée , on la restaure */
00196                 case 0:
00197                 {
00198                         ShowScilex();
00199                         SetConsoleState(1);
00200                         SetConsoleTitle(ScilexConsoleName);
00201                 }
00202                 break;
00203                 /* La fenetre etait apparente , on la cache */ 
00204                 case 1:
00205                 {
00206                         HideScilex();
00207                         SetConsoleState(0);
00208                         SetConsoleTitle(ScilexConsoleName);
00209                 }
00210                 break;
00211         }
00212 }

void UpdateConsoleColors ( void   ) 

Definition at line 85 of file WinConsole.c.

References csbiInfoSave.

Referenced by Console_Main().

00086 {
00087           HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
00088           COORD Coord;
00089           DWORD cWritten;
00090 
00091           Coord.X=0;
00092           Coord.Y=0;
00093          
00094           FillConsoleOutputAttribute( hConsole,
00095                                                                   BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED|BACKGROUND_INTENSITY,
00096                                                                   csbiInfoSave.dwSize.X*csbiInfoSave.dwSize.Y,
00097                                                                   Coord,
00098                                                                   &cWritten); 
00099 
00100 
00101           SetConsoleTextAttribute(hConsole,BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED|BACKGROUND_INTENSITY);
00102  
00103 }

Here is the caller graph for this function:


Generated on Sun Mar 4 15:59:09 2007 for Scilab [trunk] by  doxygen 1.5.1