64,646
社区成员
发帖
与我相关
我的任务
分享
#pragma comment(lib,"user32")
#pragma comment(lib,"gdi32")
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
HWND WINAPI GetConsoleWindow();
void HideTheCursor() {
CONSOLE_CURSOR_INFO cciCursor;
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
if(GetConsoleCursorInfo(hStdOut, &cciCursor)) {
cciCursor.bVisible = FALSE;
SetConsoleCursorInfo(hStdOut, &cciCursor);
}
}
void ShowTheCursor() {
CONSOLE_CURSOR_INFO cciCursor;
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
if(GetConsoleCursorInfo(hStdOut, &cciCursor)) {
cciCursor.bVisible = TRUE;
SetConsoleCursorInfo(hStdOut, &cciCursor);
}
}
int main() {
HWND hwnd;
HDC hdc;
HFONT hfont;
system("color F0");
system("cls");
HideTheCursor();
hwnd = GetConsoleWindow();
hdc = GetDC(hwnd);
hfont = CreateFont(48, 0, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0, "Arial Unicode MS");
SelectObject(hdc,hfont);
TextOutW(hdc,10,10,L"你好",2);
DeleteObject(hfont);
hfont = CreateFont(48, 0, 0, 0, 0, 0, 0, 0, JOHAB_CHARSET , 0, 0, 0, 0, "Arial Unicode MS");
SelectObject(hdc,hfont);
TextOutW(hdc,10,80,L"\xb7f0\xb7f0\xb2dd\xb2dd",4);
DeleteObject(hfont);
ReleaseDC(hwnd,hdc);
getch();
system("color 07");
system("cls");
ShowTheCursor();
return 0;
}
void class_name::someFunc(BSTR title)
{
int len = ::WideCharToMultiByte(CP_ACP,NULL,title,-1,NULL,0,NULL,NULL);
char * tmp = new char[len+1];
::memset(tmp,0,len+1);
::WideCharToMultiByte(CP_ACP ,NULL,title,-1,tmp,len+1,NULL,NULL);
//..........
delete [] tmp;
//以下..............