本文整理汇总了C++中GetConsoleOutputCP函数的典型用法代码示例。如果您正苦于以下问题:C++ GetConsoleOutputCP函数的具体用法?C++ GetConsoleOutputCP怎么用?C++ GetConsoleOutputCP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetConsoleOutputCP函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: print_string
static void print_string(const WCHAR *string)
{
DWORD count, ret, len, lena;
char *buf;
if(wshInteractive) {
static const WCHAR windows_script_hostW[] =
{'W','i','n','d','o','w','s',' ','S','c','r','i','p','t',' ','H','o','s','t',0};
MessageBoxW(NULL, string, windows_script_hostW, MB_OK);
return;
}
len = strlenW(string);
ret = WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), string, len, &count, NULL);
if(ret) {
static const WCHAR crnlW[] = {'\r','\n'};
WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), crnlW, sizeof(crnlW)/sizeof(*crnlW), &count, NULL);
return;
}
lena = WideCharToMultiByte(GetConsoleOutputCP(), 0, string, len, NULL, 0, NULL, NULL);
buf = heap_alloc(len);
if(!buf)
return;
WideCharToMultiByte(GetConsoleOutputCP(), 0, string, len, buf, lena, NULL, NULL);
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), buf, lena, &count, FALSE);
heap_free(buf);
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), "\r\n", 2, &count, FALSE);
}
开发者ID:AlexSteel,项目名称:wine,代码行数:30,代码来源:host.c
示例2: output_write
static int output_write(const WCHAR* str, int len)
{
DWORD ret, count;
ret = WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), str, len, &count, NULL);
if (!ret)
{
DWORD lenA;
char* strA;
/* On Windows WriteConsoleW() fails if the output is redirected. So fall
* back to WriteFile(), assuming the console encoding is still the right
* one in that case.
*/
lenA = WideCharToMultiByte(GetConsoleOutputCP(), 0, str, len,
NULL, 0, NULL, NULL);
strA = HeapAlloc(GetProcessHeap(), 0, lenA);
if (!strA)
return 0;
WideCharToMultiByte(GetConsoleOutputCP(), 0, str, len, strA, lenA,
NULL, NULL);
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), strA, len, &count, FALSE);
HeapFree(GetProcessHeap(), 0, strA);
}
return count;
}
开发者ID:aragaer,项目名称:wine,代码行数:26,代码来源:net.c
示例3: output
/**
Output given message to stdout without formatting.
*/
static void output(const WCHAR *message)
{
DWORD count;
DWORD res;
int wlen = strlenW(message);
if (!wlen) return;
res = WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), message, wlen, &count, NULL);
/* If writing to console fails, assume its file
i/o so convert to OEM codepage and output */
if (!res)
{
DWORD len;
char *mesA;
/* Convert to OEM, then output */
len = WideCharToMultiByte( GetConsoleOutputCP(), 0, message, wlen, NULL, 0, NULL, NULL );
mesA = HeapAlloc(GetProcessHeap(), 0, len*sizeof(char));
if (!mesA) return;
WideCharToMultiByte( GetConsoleOutputCP(), 0, message, wlen, mesA, len, NULL, NULL );
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), mesA, len, &count, FALSE);
HeapFree(GetProcessHeap(), 0, mesA);
}
}
开发者ID:bilboed,项目名称:wine,代码行数:28,代码来源:start.c
示例4: taskkill_vprintfW
static int taskkill_vprintfW(const WCHAR *msg, __ms_va_list va_args)
{
int wlen;
DWORD count, ret;
WCHAR msg_buffer[8192];
wlen = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, msg, 0, 0, msg_buffer,
sizeof(msg_buffer)/sizeof(*msg_buffer), &va_args);
ret = WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), msg_buffer, wlen, &count, NULL);
if (!ret)
{
DWORD len;
char *msgA;
/* On Windows WriteConsoleW() fails if the output is redirected. So fall
* back to WriteFile(), assuming the console encoding is still the right
* one in that case.
*/
len = WideCharToMultiByte(GetConsoleOutputCP(), 0, msg_buffer, wlen,
NULL, 0, NULL, NULL);
msgA = HeapAlloc(GetProcessHeap(), 0, len);
if (!msgA)
return 0;
WideCharToMultiByte(GetConsoleOutputCP(), 0, msg_buffer, wlen, msgA, len,
NULL, NULL);
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), msgA, len, &count, FALSE);
HeapFree(GetProcessHeap(), 0, msgA);
}
return count;
}
开发者ID:klickverbot,项目名称:wine,代码行数:33,代码来源:taskkill.c
示例5: hb_gt_cgi_Init
static void hb_gt_cgi_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFilenoStdout, HB_FHANDLE hFilenoStderr )
{
PHB_GTCGI pGTCGI;
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_cgi_Init(%p,%p,%p,%p)", pGT, ( void * ) ( HB_PTRDIFF ) hFilenoStdin, ( void * ) ( HB_PTRDIFF ) hFilenoStdout, ( void * ) ( HB_PTRDIFF ) hFilenoStderr ) );
pGTCGI = ( PHB_GTCGI ) hb_xgrab( sizeof( HB_GTCGI ) );
memset( pGTCGI, 0, sizeof( HB_GTCGI ) );
HB_GTLOCAL( pGT ) = pGTCGI;
pGTCGI->hStdout = hFilenoStdout;
#if defined( HB_OS_WIN ) && ! defined( HB_OS_WIN_CE )
if( IsValidCodePage( CP_UTF8 ) )
{
pGTCGI->uiOldCP = GetConsoleOutputCP();
SetConsoleOutputCP( CP_UTF8 );
HB_GTSELF_SETDISPCP( pGT, "UTF8", NULL, HB_FALSE );
}
#endif
pGTCGI->szCrLf = hb_strdup( hb_conNewLine() );
pGTCGI->nCrLf = strlen( pGTCGI->szCrLf );
hb_fsSetDevMode( pGTCGI->hStdout, FD_BINARY );
HB_GTSUPER_INIT( pGT, hFilenoStdin, hFilenoStdout, hFilenoStderr );
HB_GTSELF_SETFLAG( pGT, HB_GTI_STDOUTCON, HB_TRUE );
}
开发者ID:Rossine,项目名称:harbour-core,代码行数:29,代码来源:gtcgi.c
示例6: my_putsCA
// Console, ANSI
VOID my_putsCA( HANDLE h, LPCTSTR s )
{
DWORD n1, n2;
DWORD len = 0;
LPSTR p;
#ifdef UNICODE
UINT cp = GetConsoleOutputCP();
if( ( len = WideCharToMultiByte( cp, 0, s, -1, NULL, 0, NULL, NULL ) ) == 0 ) return;
if( ( p = (LPSTR)LocalAlloc( LMEM_FIXED, len ) ) == NULL ) return;
len = WideCharToMultiByte( cp, 0, s, -1, p, len, NULL, NULL );
#else
size_t n;
p = (LPTSTR)s;
if( StringCbLength( p, 4096, &n ) != S_OK ) len = 0;
else len = n;
#endif
n1 = len ? len -1 : 0;
while( n1 ){
if( !WriteFile( h, p, n1, &n2, NULL ) ) break;
n1 -= n2;
}
#ifdef UNICODE
LocalFree( p );
#endif
}
开发者ID:hasegawayosuke,项目名称:prehash,代码行数:29,代码来源:prehash.c
示例7: setup_console
/**
* Prepare console on program initialization: change console font codepage
* according to program options and hide cursor.
*/
void setup_console(void)
{
HANDLE hOut;
CONSOLE_CURSOR_INFO cci;
int cp = (opt.flags&OPT_UTF8 ? CP_UTF8 : opt.flags&OPT_ANSI ? GetACP() : GetOEMCP());
rhash_data.saved_console_codepage = -1;
/* note: we are using numbers 1 = _fileno(stdout), 2 = _fileno(stderr) */
/* cause _fileno() is undefined, when compiling as strict ansi C. */
if(cp > 0 && IsValidCodePage(cp) && (isatty(1) || isatty(2)) )
{
rhash_data.saved_console_codepage = GetConsoleOutputCP();
SetConsoleOutputCP(cp);
setlocale(LC_CTYPE, opt.flags&OPT_UTF8 ? "C" :
opt.flags&OPT_ANSI ? ".ACP" : ".OCP");
rsh_exit = rhash_exit;
}
if((opt.flags & OPT_PERCENTS) != 0) {
hOut = GetStdHandle(STD_ERROR_HANDLE);
if(hOut != INVALID_HANDLE_VALUE) {
/* store current cursor size and visibility flag */
GetConsoleCursorInfo(hOut, &cci);
rhash_data.saved_cursor_size = (cci.bVisible ? cci.dwSize : 0);
/* now hide cursor */
cci.bVisible = 0;
SetConsoleCursorInfo(hOut, &cci); /* hide cursor */
}
}
}
开发者ID:alexander-politov,项目名称:rhash-sdk,代码行数:35,代码来源:win_utils.c
示例8: console_vprintf
/*
* The console output format should be set to UTF-8, however in XP and Vista this breaks batch file processing.
* Attempting to restore on exit fails to restore if the program is terminated by the user.
* Solution - set the output format each printf.
*/
void console_vprintf(const char *fmt, va_list ap)
{
UINT cp = GetConsoleOutputCP();
SetConsoleOutputCP(CP_UTF8);
vprintf(fmt, ap);
SetConsoleOutputCP(cp);
}
开发者ID:BOTCrusher,项目名称:sagetv,代码行数:12,代码来源:hdhomerun_os_windows.c
示例9: kull_m_output_init
void kull_m_output_init()
{
previousStdOut = _setmode(_fileno(stdout), _O_U8TEXT);
previousStdErr = _setmode(_fileno(stderr), _O_U8TEXT);
previousConsoleOutput = GetConsoleOutputCP();
SetConsoleOutputCP(CP_UTF8);
}
开发者ID:smile921,项目名称:ocker,代码行数:7,代码来源:kull_m_output.c
示例10: _Py_device_encoding
PyObject *
_Py_device_encoding(int fd)
{
#if defined(MS_WINDOWS)
UINT cp;
#endif
if (!_PyVerify_fd(fd) || !isatty(fd)) {
Py_RETURN_NONE;
}
#if defined(MS_WINDOWS)
if (fd == 0)
cp = GetConsoleCP();
else if (fd == 1 || fd == 2)
cp = GetConsoleOutputCP();
else
cp = 0;
/* GetConsoleCP() and GetConsoleOutputCP() return 0 if the application
has no console */
if (cp != 0)
return PyUnicode_FromFormat("cp%u", (unsigned int)cp);
#elif defined(CODESET)
{
char *codeset = nl_langinfo(CODESET);
if (codeset != NULL && codeset[0] != 0)
return PyUnicode_FromString(codeset);
}
#endif
Py_RETURN_NONE;
}
开发者ID:CIBC-Internal,项目名称:python,代码行数:29,代码来源:fileutils.c
示例11: oem_to_utf8
/* Windows console (cmd.exe) input to utf8 */
static char* oem_to_utf8(char *instring)
{
char * out;
wchar_t *winput, *wp;
size_t len;
const char *p;
int cv;
unsigned int consolecp;
consolecp = GetConsoleOutputCP();
/* Convert input string to wide chars. */
len = strlen(instring) + 1;
cv = MultiByteToWideChar(consolecp, 0, instring, len, NULL, 0);
winput = (wchar_t*) malloc(cv * sizeof(wchar_t));
cv = MultiByteToWideChar(consolecp, 0, instring, len, winput, cv);
/* Convert wide chars to utf8. */
cv = WideCharToMultiByte(CP_UTF8, 0, winput, len, NULL, 0, NULL, NULL);
out = (char*) malloc(cv);
cv = WideCharToMultiByte(CP_UTF8, 0, winput, len, out, cv, NULL, NULL);
free(winput);
return out;
}
开发者ID:lagleki,项目名称:jorne,代码行数:27,代码来源:link-parser.c
示例12: OnReadConsoleInputA
BOOL WINAPI OnReadConsoleInputA(HANDLE hConsoleInput, PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsRead)
{
//typedef BOOL (WINAPI* OnReadConsoleInputA_t)(HANDLE hConsoleInput, PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsRead);
SUPPRESSORIGINALSHOWCALL;
ORIGINAL_KRNL(ReadConsoleInputA);
//if (gpFarInfo && bMainThread)
// TouchReadPeekConsoleInputs(0);
BOOL lbRc = FALSE;
#if defined(_DEBUG)
#if 1
UINT nCp = GetConsoleCP();
UINT nOutCp = GetConsoleOutputCP();
UINT nOemCp = GetOEMCP();
UINT nAnsiCp = GetACP();
#endif
#endif
// To minimize startup duration and possible problems
// hook server will start on first 'user interaction'
CheckHookServer();
if (ph && ph->PreCallBack)
{
SETARGS4(&lbRc,hConsoleInput,lpBuffer,nLength,lpNumberOfEventsRead);
// Если функция возвращает FALSE - реальное чтение не будет вызвано
if (!ph->PreCallBack(&args))
return lbRc;
}
CESERVER_CONSOLE_APP_MAPPING* pAppMap = NULL;
PreReadConsoleInput(hConsoleInput, rcif_Ansi|rcif_LLInput, &pAppMap);
//#ifdef USE_INPUT_SEMAPHORE
//DWORD nSemaphore = ghConInSemaphore ? WaitForSingleObject(ghConInSemaphore, INSEMTIMEOUT_READ) : 1;
//_ASSERTE(nSemaphore<=1);
//#endif
lbRc = F(ReadConsoleInputA)(hConsoleInput, lpBuffer, nLength, lpNumberOfEventsRead);
PostReadConsoleInput(hConsoleInput, rcif_Ansi|rcif_LLInput, pAppMap);
//#ifdef USE_INPUT_SEMAPHORE
//if ((nSemaphore == WAIT_OBJECT_0) && ghConInSemaphore) ReleaseSemaphore(ghConInSemaphore, 1, NULL);
//#endif
if (ph && ph->PostCallBack)
{
SETARGS4(&lbRc,hConsoleInput,lpBuffer,nLength,lpNumberOfEventsRead);
ph->PostCallBack(&args);
}
if (lbRc && lpNumberOfEventsRead && *lpNumberOfEventsRead && lpBuffer)
{
OnPeekReadConsoleInput('R', 'A', hConsoleInput, lpBuffer, *lpNumberOfEventsRead);
}
return lbRc;
}
开发者ID:qyqx,项目名称:ConEmu,代码行数:60,代码来源:hkConsoleInput.cpp
示例13: sizeof
void WindowManager::setup() {
//Set console font
CONSOLE_FONT_INFOEX lpConsoleCurrentFontEx;
lpConsoleCurrentFontEx.cbSize = sizeof(CONSOLE_FONT_INFOEX);
lpConsoleCurrentFontEx.dwFontSize.X = 12;
lpConsoleCurrentFontEx.dwFontSize.Y = 12;
lpConsoleCurrentFontEx.FontWeight = 700;
lpConsoleCurrentFontEx.nFont = 1;
lpConsoleCurrentFontEx.FontFamily = FF_DONTCARE;
lstrcpyW(lpConsoleCurrentFontEx.FaceName, L"Lucida Console");
SetCurrentConsoleFontEx ( GetStdHandle(STD_OUTPUT_HANDLE), false, &lpConsoleCurrentFontEx );
//get handles and create screen buffers
mStdHandle = GetStdHandle(STD_OUTPUT_HANDLE);
mConsoleA = Console::createConsoleOutput();
mConsoleB = Console::createConsoleOutput();
mSwitch = true;
CONSOLE_SCREEN_BUFFER_INFO info;
if (GetConsoleScreenBufferInfo(mStdHandle, &info) != 0) {
mCurrentSize.X = (info.srWindow.Right - info.srWindow.Left) + 1;
mCurrentSize.Y = (info.srWindow.Bottom - info.srWindow.Top) + 1;
} else {
mCurrentSize.X = 80;
mCurrentSize.Y = 25;
}
//get current codepage and set new one, unicode
mOldCodePage = GetConsoleOutputCP();
SetConsoleOutputCP(CP_UTF8);
}
开发者ID:dutt,项目名称:sects,代码行数:31,代码来源:windowmgr.cpp
示例14: qse_main
int qse_main (int argc, qse_achar_t* argv[])
{
int x;
#if defined(_WIN32)
char locale[100];
UINT codepage = GetConsoleOutputCP();
if (codepage == CP_UTF8)
{
/*SetConsoleOUtputCP (CP_UTF8);*/
qse_setdflcmgrbyid (QSE_CMGR_UTF8);
}
else
{
sprintf (locale, ".%u", (unsigned int)codepage);
setlocale (LC_ALL, locale);
/*qse_setdflcmgrbyid (QSE_CMGR_SLMB);*/
}
#else
setlocale (LC_ALL, "");
/*qse_setdflcmgrbyid (QSE_CMGR_SLMB);*/
#endif
qse_openstdsios ();
x = qse_runmain (argc, argv, test_main);
qse_closestdsios ();
return x;
}
开发者ID:DeadZen,项目名称:qse,代码行数:26,代码来源:uri01.c
示例15: php_win32_cp_get_enc
PW32CP const struct php_win32_cp *php_win32_cp_do_setup(const char *enc)
{/*{{{*/
if (!enc) {
enc = php_win32_cp_get_enc();
}
cur_cp = php_win32_cp_get_by_enc(enc);
if (!orig_cp) {
orig_cp = php_win32_cp_get_by_id(GetACP());
}
if (!strcmp(sapi_module.name, "cli")) {
if (!orig_in_cp) {
orig_in_cp = php_win32_cp_get_by_id(GetConsoleCP());
if (!orig_in_cp) {
orig_in_cp = orig_cp;
}
}
if (!orig_out_cp) {
orig_out_cp = php_win32_cp_get_by_id(GetConsoleOutputCP());
if (!orig_out_cp) {
orig_out_cp = orig_cp;
}
}
php_win32_cp_cli_io_setup();
}
return cur_cp;
}/*}}}*/
开发者ID:robocoder,项目名称:php-src,代码行数:28,代码来源:codepage.c
示例16: init_ti
static void init_ti(void)
{
CONSOLE_SCREEN_BUFFER_INFO info;
int i;
UINT acp;
if (ti_flag) return;
ti_flag = 1;
for (i = 0; i<2; ++i)
{
if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info)) break;
if (i) return;
FreeConsole();
AllocConsole();
}
ti.normattr = info.wAttributes;
ti.winright = info.dwSize.X;
ti.winbottom = info.dwSize.Y;
ti.screenwidth = info.dwSize.X;
ti.screenheight = info.dwSize.Y;
ti.curx = info.dwCursorPosition.X + 1;
ti.cury = info.dwCursorPosition.Y + 1;
ti.attribute = info.wAttributes;
acp = GetACP();
if (GetConsoleOutputCP() != acp)
{
SetConsoleOutputCP(acp);
SetConsoleCP(acp);
}
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), ENABLE_WINDOW_INPUT | ENABLE_MOUSE_INPUT | ENABLE_ECHO_INPUT);
}
开发者ID:Aterwik111,项目名称:PP,代码行数:30,代码来源:conio2.cpp
示例17: ShowConsoleStatus
int ShowConsoleStatus()
{
DWORD dwKbdDelay;
DWORD dwKbdSpeed;
CONSOLE_SCREEN_BUFFER_INFO ConsoleScreenBufferInfo;
HANDLE hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
wprintf(L"\nStatus for device CON:\n");
wprintf(L"-----------------------\n");
if (GetConsoleScreenBufferInfo(hConsoleOutput, &ConsoleScreenBufferInfo))
{
wprintf(L" Lines: %d\n", ConsoleScreenBufferInfo.dwSize.Y);
wprintf(L" Columns: %d\n", ConsoleScreenBufferInfo.dwSize.X);
}
if (SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, &dwKbdDelay, 0))
{
wprintf(L" Keyboard delay: %ld\n", dwKbdDelay);
}
if (SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &dwKbdSpeed, 0))
{
wprintf(L" Keyboard rate: %ld\n", dwKbdSpeed);
}
wprintf(L" Code page: %d\n", GetConsoleOutputCP());
return 0;
}
开发者ID:GYGit,项目名称:reactos,代码行数:25,代码来源:mode.c
示例18: _wprintf
void _wprintf(LPCWSTR asBuffer)
{
if (!asBuffer) return;
int nAllLen = lstrlenW(asBuffer);
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD dwWritten = 0;
if (!IsOutputRedirected())
{
WriteConsoleW(hOut, asBuffer, nAllLen, &dwWritten, 0);
}
else
{
UINT cp = GetConsoleOutputCP();
int cchMax = WideCharToMultiByte(cp, 0, asBuffer, -1, NULL, 0, NULL, NULL) + 1;
char* pszOem = (cchMax > 1) ? (char*)malloc(cchMax) : NULL;
if (pszOem)
{
int nWrite = WideCharToMultiByte(cp, 0, asBuffer, -1, pszOem, cchMax, NULL, NULL);
if (nWrite > 1)
{
// Don't write terminating '\0' to redirected output
WriteFile(hOut, pszOem, nWrite-1, &dwWritten, 0);
}
free(pszOem);
}
}
}
开发者ID:BigVal71,项目名称:ConEmu,代码行数:29,代码来源:ConEmuC.cpp
示例19: output_write
static void __cdecl output_write(UINT id, ...)
{
WCHAR fmt[1024];
__ms_va_list va_args;
WCHAR *str;
DWORD len, nOut, ret;
if (Silent) return;
if (!LoadStringW(GetModuleHandleW(NULL), id, fmt, sizeof(fmt)/sizeof(fmt[0])))
{
WINE_FIXME("LoadString failed with %d\n", GetLastError());
return;
}
__ms_va_start(va_args, id);
SetLastError(NO_ERROR);
len = FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ALLOCATE_BUFFER,
fmt, 0, 0, (LPWSTR)&str, 0, &va_args);
__ms_va_end(va_args);
if (len == 0 && GetLastError() != NO_ERROR)
{
WINE_FIXME("Could not format string: le=%u, fmt=%s\n", GetLastError(), wine_dbgstr_w(fmt));
return;
}
ret = WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), str, len, &nOut, NULL);
/* WriteConsole fails if its output is redirected to a file.
* If this occurs, we should use an OEM codepage and call WriteFile.
*/
if (!ret)
{
DWORD lenA;
char *strA;
lenA = WideCharToMultiByte(GetConsoleOutputCP(), 0, str, len, NULL, 0, NULL, NULL);
strA = HeapAlloc(GetProcessHeap(), 0, lenA);
if (strA)
{
WideCharToMultiByte(GetConsoleOutputCP(), 0, str, len, strA, lenA, NULL, NULL);
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), strA, lenA, &nOut, FALSE);
HeapFree(GetProcessHeap(), 0, strA);
}
}
LocalFree(str);
}
开发者ID:karolherbst,项目名称:wine,代码行数:47,代码来源:regsvr32.c
示例20: _init_console_info
static void _init_console_info(void)
{
DWORD scrnmode, len;
HKEY reghnd;
int i;
console_info.Hwnd = _find_console_handle();
console_info.Length = sizeof(console_info);
GetConsoleMode(pdc_con_in, &scrnmode);
console_info.QuickEdit = !!(scrnmode & 0x0040);
console_info.InsertMode = !!(scrnmode & 0x0020);
console_info.FullScreen = FALSE;
console_info.AutoPosition = 0x10000;
console_info.ScreenColors = SP->orig_back << 4 | SP->orig_fore;
console_info.PopupColors = 0xf5;
console_info.HistoryNoDup = FALSE;
console_info.HistoryBufferSize = 50;
console_info.NumberOfHistoryBuffers = 4;
console_info.CodePage = GetConsoleOutputCP();
RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Console"), 0,
KEY_QUERY_VALUE, ®hnd);
len = sizeof(DWORD);
/* Default color table */
for (i = 0; i < 16; i++)
{
char tname[13];
sprintf(tname, "ColorTable%02d", i);
RegQueryValueExA(reghnd, tname, NULL, NULL,
(LPBYTE)(&(console_info.ColorTable[i])), &len);
}
/* Font info */
RegQueryValueEx(reghnd, TEXT("FontSize"), NULL, NULL,
(LPBYTE)(&console_info.FontSize), &len);
RegQueryValueEx(reghnd, TEXT("FontFamily"), NULL, NULL,
(LPBYTE)(&console_info.FontFamily), &len);
RegQueryValueEx(reghnd, TEXT("FontWeight"), NULL, NULL,
(LPBYTE)(&console_info.FontWeight), &len);
len = sizeof(WCHAR) * 32;
RegQueryValueExW(reghnd, L"FaceName", NULL, NULL,
(LPBYTE)(console_info.FaceName), &len);
RegCloseKey(reghnd);
}
开发者ID:wmcbrine,项目名称:PDCurses,代码行数:55,代码来源:pdcscrn.c
注:本文中的GetConsoleOutputCP函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论