win32에서 4바이트 문자 출력하는 방법을 알고 싶습니다.

익명 사용자의 이미지

wchar_t tt2[] = L"مرحباِ";
TextOutW(h_dc, 0, 0, tt2, 7);

char tt[] = "مرحباِ";
TextOutA(h_dc, 0, 20, tt, 7);

2바이트 크기 문자는 출력이 잘되는데
4바이트 크기의 문자는 출력이 안되더군요..

웹브라우저에 출력되는걸 보면 뭔가 방법이 있을것 같은데
혹시 아시는분 답변 좀 부탁드립니다..

shint의 이미지

//
해결 하시려면. 검색 하시면. 블로그에 관련된 예제 소스가 있을겁니다.
TextOutW 로 구글 검색
TextOutA 로 구글 검색

책 예제 소스 보셔도 됩니다.

이거 관련 내용은 검색하지 않았습니다.

//
대신. 각 함수와 변수에 대한. 장황한. 검색 내용을 적어봅니다.

//
TCHAR 는
UNICODE 가 #define 되어 있으면 WCHAR 이고.
다른 경우 (ANSI?) 면 CHAR (8비트==1바이트)를 사용합니다.

WCHAR 는 wchar_t 이고. 16비트 (2바이트) 입니다.

//
WCHAR
https://msdn.microsoft.com/en-us/library/gg269344(v=exchg.10).aspx

#if !defined(_NATIVE_WCHAR_T_DEFINED)
typedef unsigned short WCHAR;
#else
typedef wchar_t WCHAR;
#endif

//
char, wchar_t, char16_t, char32_t
https://msdn.microsoft.com/ko-kr/library/mt228149.aspx

//
TextOut function
https://msdn.microsoft.com/ko-kr/library/windows/desktop/dd145133(v=vs.85).aspx

Unicode and ANSI names
TextOutW (Unicode) and TextOutA (ANSI)
 
 
The TextOut function writes a character string at the specified location, using the currently selected font, background color, and text color.
Syntax
 
C++
 
BOOL TextOut(
  _In_ HDC     hdc,
  _In_ int     nXStart,
  _In_ int     nYStart,
  _In_ LPCTSTR lpString,
  _In_ int     cchString
);
 
Parameters
 
hdc [in]
A handle to the device context.
nXStart [in]
The x-coordinate, in logical coordinates, of the reference point that the system uses to align the string.
nYStart [in]
The y-coordinate, in logical coordinates, of the reference point that the system uses to align the string.
lpString [in]
A pointer to the string to be drawn. The string does not need to be zero-terminated, because cchString specifies the length of the string.
cchString [in]
The length of the string pointed to by lpString, in characters.
Return value
 
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
 
 
//
https://translate.google.co.kr/
 
TextOut 함수는 현재 선택한 글꼴, 배경색 및 텍스트 색을 사용하여 지정된 위치에 문자열을 씁니다.
통사론
 
C ++
 
BOOL TextOut (
   _In_ HDC hdc,
   _In_ int nXStart,
   _In_ int nYStart,
   _In_ LPCTSTR lpString,
   _In_ int cchString
);
 
매개 변수
 
hdc [in]
디바이스 컨텍스트 핸들.
nXStart [in]
시스템이 문자열을 정렬하는 데 사용하는 참조 점의 논리적 좌표에서의 x 좌표.
nY 시작 [in]
시스템이 문자열을 정렬하는 데 사용하는 참조 점의 논리적 좌표에서의 y 좌표입니다.
lpString [in]
가져올 문자열에 대한 포인터입니다. cchString은 문자열의 길이를 지정하기 때문에 문자열을 0으로 종료 할 필요는 없습니다.
cchString [in]
lpString이 가리키는 문자열의 길이 (문자 수).
반환 값
 
함수가 성공하면 반환 값은 0이 아닙니다.
함수가 실패하면 반환 값은 0입니다.

//
Windows Data Types
https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751

//
WCHAR
A 16-bit Unicode character. For more information, see Character Sets Used By Fonts.
This type is declared in WinNT.h as follows:
typedef wchar_t WCHAR;

//
Tchar.h의 제네릭 텍스트 매핑
https://msdn.microsoft.com/ko-kr/library/c426s321.aspx

//
TCHAR
A WCHAR if UNICODE is defined, a CHAR otherwise.
This type is declared in WinNT.h as follows:
C++

#ifdef UNICODE
typedef WCHAR TCHAR;
#else
typedef char TCHAR;
#endif

//
CHAR
An 8-bit Windows (ANSI) character. For more information, see Character Sets Used By Fonts.
This type is declared in WinNT.h as follows:
typedef char CHAR;

//
WinAPI
http://soen.kr/

----------------------------------------------------------------------------
젊음'은 모든것을 가능하게 만든다.

매일 1억명이 사용하는 프로그램을 함께 만들어보고 싶습니다.
정규 근로 시간을 지키는. 야근 없는 회사와 거래합니다.

각 분야별. 좋은 책'이나 사이트' 블로그' 링크 소개 받습니다. shintx@naver.com

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.