À¯´ÏÄÚµå ¹× ANSI À¯´ÏÄÚµå ANSI¿¡¼­¿¡ ´ëÇÑ OLE º¯È¯ ¹æ¹ý

±â¼ú ÀÚ·á: 138813 - ÀÌ ¹®¼­°¡ Àû¿ëµÇ´Â Á¦Ç° º¸±â.
¸ðµÎ È®´ë | ¸ðµÎ Ãà¼Ò

¿ä¾à

Àü´ÞµÈ ¹× 32ºñÆ® OLE API ¹× ÀÎÅÍÆäÀ̽º ¸Þ¼­µå¸¦ ÅëÇØ ¹ÞÀº ¸ðµç ¹®ÀÚ¿­À» À¯´ÏÄڵ带 »ç¿ëÇÕ´Ï´Ù. ANSI ¹®ÀÚ¿­À» OLE¿¡ Àü´ÞÇϱâ Àü¿¡ À¯´ÏÄÚµå·Î º¯È¯ÇÒ ¼ö ¹× OLE¿¡¼­ ANSI·Î ¹ÞÀº À¯´ÏÄÚµå ¹®ÀÚ¿­À» º¯È¯ÇÏ´Â µ¥ »ç¿ëÇÏ´Â ÀÀ¿ë ÇÁ·Î±×·¥ÀÌ ÇÊ¿äÇÕ´Ï´Ù. ÀÌ ¹®¼­¿¡¼­´Â ÀÌ·¯ÇÑ º¯È¯À» ¼öÇàÇÒ ¼ö ÀÖ´Â ¹æ¹ýÀ» º¸¿© ÁÝ´Ï´Ù.

Ãß°¡ Á¤º¸

Windows NT ±¸ÇöÇÏ´Â À¯´ÏÄÚµå ¶Ç´Â ¿ÍÀÌµå ¹®ÀÚ ¹× ¹®ÀÚ¿­ ¸Å°³ º¯¼ö¸¦ Win32 ÇÔ¼ö°¡ ANSI ¹öÀü. ±×·¯³ª Windows 95 À¯´ÏÄÚµå ¹öÀü ¹®ÀÚ¿­ ¸Å°³ º¯¼ö¸¦ ´ëºÎºÐÀÇ Win32 ±â´ÉÀ» ±¸ÇöÇÏÁö ¾Ê½À´Ï´Ù. ´ë½Å ÀÌ·¯ÇÑ ÇÔ¼öÀÇ ANSI ¹öÀü¸¸À» ±¸ÇöÇÕ´Ï´Ù.

ÀÌ ±ÔÄ¢ÀÇ ÁÖ¿ä ¿¹¿Ü 32ºñÆ® OLE °ÍÀÔ´Ï´Ù. 32ºñÆ® OLE API ¹× Windows NT ¹× Windows 95¿¡ ´ëÇØ ÀÎÅÍÆäÀ̽º ¸Þ¼­µå¸¦ À¯´ÏÄڵ带 ´Üµ¶À¸·Î »ç¿ëÇÕ´Ï´Ù. ÀÌ·¯ÇÑ ÇÔ¼ö´Â ANSI ¹öÀüÀÇ Windows NT ¶Ç´Â Windows 95 ±¸ÇöµÇ¾î ÀÖÁö ¾Ê½À´Ï´Ù.

Áï, Windows 95 ¹× Windows NT ¸ðµÎ ½ÇÇàÇÏ´Â µ¥ ÇÊ¿äÇÑ 32 ºñÆ® ÀÀ¿ë ÇÁ·Î±×·¥ ºñ-OLE Win32 ÇÔ¼ö ANSI ¹öÀüÀ» »ç¿ëÇØ¾ß ÇÕ´Ï´Ù Çϰí OLE¿¡ Àü´ÞµÇ±â Àü¿¡ ANSI ¹®ÀÚ¿­À» À¯´ÏÄÚµå·Î º¯È¯ÇØ¾ß ÇÕ´Ï´Ù.

Windows NT¿¡¼­ ½ÇÇàµÇ´Â 32 ºñÆ® À¯´ÏÄÚµå ÀÀ¿ë ÇÁ·Î±×·¥Àº ¸ðµç ANSI/À¯´ÏÄÚµå º¯È¯ ÇÔ¼ö¸¦ »ç¿ëÇÒ Çʿ䰡 ¾ø½À´Ï´Ù.

Win32´Â À¯´ÏÄÚµå ¹®ÀÚ¿­À» ANSI ¹× À¯´ÏÄÚµå ¹®ÀÚ¿­À» ANSI·Î º¯È¯ÇÒ MultiByteToWideChar ¹× WideCharToMultiByte Á¦°øÇÕ´Ï´Ù. ÀÌ ¹®¼­¿¡¼­´Â AnsiToUnicode ¹× ANSI/À¯´ÏÄÚµå º¯È¯¿¡ ÀÌ·¯ÇÑ ÇÔ¼ö¸¦ »ç¿ëÇÏ´Â UnicodeToAnsi Á¦°øÇÕ´Ï´Ù.
/*
 * AnsiToUnicode converts the ANSI string pszA to a Unicode string
 * and returns the Unicode string through ppszW. Space for the
 * the converted string is allocated by AnsiToUnicode.
 */ 

HRESULT __fastcall AnsiToUnicode(LPCSTR pszA, LPOLESTR* ppszW)
{

    ULONG cCharacters;
    DWORD dwError;

    // If input is null then just return the same.
    if (NULL == pszA)
    {
        *ppszW = NULL;
        return NOERROR;
    }

    // Determine number of wide characters to be allocated for the
    // Unicode string.
    cCharacters =  strlen(pszA)+1;

    // Use of the OLE allocator is required if the resultant Unicode
    // string will be passed to another COM component and if that
    // component will free it. Otherwise you can use your own allocator.
    *ppszW = (LPOLESTR) CoTaskMemAlloc(cCharacters*2);
    if (NULL == *ppszW)
        return E_OUTOFMEMORY;

    // Covert to Unicode.
    if (0 == MultiByteToWideChar(CP_ACP, 0, pszA, cCharacters,
                  *ppszW, cCharacters))
    {
        dwError = GetLastError();
        CoTaskMemFree(*ppszW);
        *ppszW = NULL;
        return HRESULT_FROM_WIN32(dwError);
    }

    return NOERROR;
/*
 * UnicodeToAnsi converts the Unicode string pszW to an ANSI string
 * and returns the ANSI string through ppszA. Space for the
 * the converted string is allocated by UnicodeToAnsi.
 */ 

HRESULT __fastcall UnicodeToAnsi(LPCOLESTR pszW, LPSTR* ppszA)
{

    ULONG cbAnsi, cCharacters;
    DWORD dwError;

    // If input is null then just return the same.
    if (pszW == NULL)
    {
        *ppszA = NULL;
        return NOERROR;
    }

    cCharacters = wcslen(pszW)+1;
    // Determine number of bytes to be allocated for ANSI string. An
    // ANSI string can have at most 2 bytes per character (for Double
    // Byte Character Strings.)
    cbAnsi = cCharacters*2;

    // Use of the OLE allocator is not required because the resultant
    // ANSI  string will never be passed to another COM component. You
    // can use your own allocator.
    *ppszA = (LPSTR) CoTaskMemAlloc(cbAnsi);
    if (NULL == *ppszA)
        return E_OUTOFMEMORY;

    // Convert to ANSI.
    if (0 == WideCharToMultiByte(CP_ACP, 0, pszW, cCharacters, *ppszA,
                  cbAnsi, NULL, NULL))
    {
        dwError = GetLastError();
        CoTaskMemFree(*ppszA);
        *ppszA = NULL;
        return HRESULT_FROM_WIN32(dwError);
    }
    return NOERROR;

}
				
»ùÇà ÀÌ·¯ÇÑ ÇÔ¼ö´Â ´ÙÀ½°ú °°ÀÌ »ç¿ëµË´Ï´Ù. CoTaskMemFree´Â CoTaskMemAlloc ¹®ÀÚ¿­À» ÇÒ´çÇÏ´Â µ¥ »ç¿ëµÈ °æ¿ì º¯È¯µÈ ¹®ÀÚ¿­À» È®º¸ÇÒ ¼ö ÀÖ½À´Ï´Ù. ´Ù¸¥ OLE ±¸¼º out-¸Å°³ º¯¼ö·Î¼­ ÅëÇØ ¹ÝȯµÇ¸é ÇØ´ç ±¸¼º ¿ä¼Ò¿¡ ¹®ÀÚ¿­À» È®º¸ ´ã´çÇϱ⠶§¹®¿¡ º¯È¯µÈ ¹®ÀÚ¿­À» ÇØÁ¦ÇØ¾ß ÇÏ´ÂÁö ¾Ê½À´Ï´Ù. LPOLESTRÀº À¯´ÏÄÚµå ¹®ÀÚ¿­¿¡ ´ëÇÑ Æ÷ÀÎÅÍÀÔ´Ï´Ù.
// The following code gets an ANSI filename that is specified by the
// user in the OpenFile common dialog. This file name is converted into
// a Unicode string and is passed to the OLE API CreateFileMoniker. The
// Unicode string is then freed.

OPENFILENAME ofn;
LPOLESTR pszFileNameW;
LPMONIKER pmk;
:

// Get file name from OpenFile Common Dialog. The ANSI file name will
// be placed in ofn.lpstrFile

GetOpenFileName(&ofn);
:
AnsiToUnicode(ofn.lpstrFile, &pszFileNameW);
CreateFileMoniker(pszFileNameW, &pmk);
CoTaskMemFree(pszFileNameW);

// The following code implements IOleInPlaceFrame::SetStatusText.
// The lpszStatusText string, that is received from another OLE
// component, uses Unicode. The string is converted to ANSI before it is
// passed to the ANSI version of SetWindowText. Windows 95 supports only
// the ANSI version of SetWindowText.

COleInPlaceFrame::SetStatusText(LPCOLESTR pszStatusTextW)
{

    LPSTR pszStatusTextA;
    UnicodeToAnsi(pszStatusTextW, &pszStatusTextA);
    SetWindowText(m_hwndStatus, pszStatusTextA);
    CoTaskMemFree(pszStatusTextA);

}
				
Âü°í: AnsiToUnicode ¹× UnicodeToAnsi º¯È¯µÈ ¹®ÀÚ¿­À» ÇÒ´çÇÏ´Â µ¥ »ç¿ëµÇ´Â ÇÒ´çÀÚ¿¡ ´ëÇÑ ¼³¸í. CoTaskMemAlloc (OLE ÇÒ´çÀÚ) °á°ú ¹®ÀÚ¿­À» ´Ù¸¥ OLE ±¸¼º ¿ä¼Ò·Î Àü´ÞµÉ °æ¿ì ¹× ÇØ´ç ±¸¼º ¿ä¼Ò¸¦ ¹®ÀÚ¿­¿¡ »ç¿ë °¡´ÉÇÑ °æ¿ì µ¥ ÇÊ¿äÇÕ´Ï´Ù. OLE ÀÎÅÍÆäÀ̽º ¸Þ¼­µå¿¡ ¸Å°³ º¯¼ö·Î Àü´ÞµÇ´Â ¹®ÀÚ¿­À» ÀÖ´Â ÀÌ Áï OLE ÇÒ´çÀÚ¸¦ »ç¿ëÇÒ Çʿ䰡 ¾ø½À´Ï´Ù. OLE ÇÒ´çÀÚ¸¦ »ç¿ëÇÏ¿© ¿¡¼­-out-¸Å°³ º¯¼ö·Î Àü´ÞµÈ ¶Ç´Â Out ¸Å°³ º¯¼ö¸¦ ¶Ç´Â ¿¡¼­-Out ¸Å°³ º¯¼ö¸¦ ÅëÇØ ¹ÝȯµÈ ¹®ÀÚ¿­Àº ÇÒ´çÇØ¾ß ÇÕ´Ï´Ù.

¹®ÀÚ¿­ »ó¼ö´Â À¯´ÏÄÚµå·Î ÄÄÆÄÀÏÇÒ ¶§ OLESTR ¸ÅÅ©·Î¸¦ »ç¿ëÇÏ¿© º¯È¯ÇÒ ¼ö ÀÖ½À´Ï´Ù. ¿¹¸¦ µé¾î,:
CreateFileMoniker(OLESTR("c:\\boo\\har.doc"), &pmk);
				
ANSI/À¯´ÏÄÚµå º¯È¯ ·çƾ ´Ù¸¥ ¿¹·Î´Â Visual C++ 4.0 ÄÄÆÄÀÏ·¯¿Í ÇÔ²² Á¦°øµÇ´Â Microsoft Foundation Ŭ·¡½º (MFC) ¼Ò½º Äڵ带 ãÀ» ¼ö ÀÖ½À´Ï´Ù. ÀÌ·¯ÇÑ ·çƾÀº MFC Technote 59 ¼³¸íµÇ¾î ÀÖ½À´Ï´Ù: ' MFC MBCS/À¯´ÏÄÚµå º¯È¯ ¸ÅÅ©·Î »ç¿ë '. Á¤ÀǸ¦ ¿¡ \msdev\mfc\include\afxpriv.h OLE2T, T2OLE, OLE2CT, T2COLE, A2W, W2A, A2CW, W2CA ¹× USES_CONVERSION ÀÌ·¯ÇÑ ¸ÅÅ©·Î°¡ ÀÖ½À´Ï´Ù. ¶ÇÇÑ AfxA2WHelper ¹× AfxW2AHelper \msdev\mfc\src ¹× OLE2T, T2OLE, OLE2CT ¹× T2COLE \msdev\mfc\src MFC ¼Ò½º ÄÚµåÀÇ »ç¿ëÀ» MFC ¼Ò½º Äڵ忡¼­ ÂüÁ¶ÇϽʽÿÀ. ÀÌ·¯ÇÑ ÇÔ¼ö´Â Äڵ带 À¯´ÏÄÚµå ¶Ç´Â ANSI _UNICODE Àü󸮱â Á¤ÀǸ¦ ÀÌ·ç¾îÁ³½À´Ï´Ù ¿©ºÎ¿¡ µû¶ó ÄÄÆÄÀÏÇÒ ¼ö ÀÖ½À´Ï´Ù. ¿¹¸¦ µé¾î, À§ÀÇ ¿¹¿¡¼­´Â CreateFileMoniker È£Ãâ ´ÙÀ½°ú °°Àº MFC ¸ÅÅ©·Î¸¦ ¸¸µé ¼ö ÀÖ½À´Ï´Ù:
USES_CONVERSION;
GetOpenFileName(&ofn);
CreateFileMoniker(T2OLE(ofn.lpstrFile), &pmk);
				
T2OLE _UNICODE Á¤ÀÇµÈ °æ¿ì, ´ÙÀ½°ú °°ÀÌ Á¤Àǵ˴ϴÙ:
inline LPOLESTR T2OLE(LPTSTR lp) { return lp; }
				
T2OLE _UNICODE Á¤ÀǵÇÁö ¾ÊÀº °æ¿ì ´ÙÀ½°ú °°ÀÌ Á¤Àǵ˴ϴÙ:
#define T2OLE(lpa) A2W(lpa)
				
T2OLE T _UNICODE Á¤ÀǵÇÁö ¾ÊÀº °æ¿ì OLE ¹®ÀÚ¿­ (À¯´ÏÄÚµå ¹®ÀÚ¿­) ·Î º¯È¯µÇ´Â Çü½Ä ¹× _UNICODE Á¤ÀÇÇÒ ¶§ À¯´ÏÄÚµå ¹®ÀÚ¿­À» ANSI ¹®ÀÚ¿­·Î ³ªÅ¸³À´Ï´Ù. _UNICODE Á¤ÀǵÇÁö ¾ÊÀº °æ¿ì ¸¶Âù°¡Áö·Î LPTSTR _UNICODE Á¤ÀÇÇÒ ¶§ À¯´ÏÄÚµå ¹®ÀÚ¿­¿¡ ´ëÇÑ Æ÷ÀÎÅÍ·Î ANSI ¹®ÀÚ¿­¿¡ ´ëÇÑ Æ÷ÀÎÅÍ·Î Á¤Àǵ˴ϴÙ. _UNICODE°¡ Á¤ÀǵǸé T2OLE ¸ðµç º¯È¯À» ¼öÇàÇÏÁö ¾Ê½À´Ï´Ù (LPTSTR LPOLESTR ==). A2W´Â À¯´ÏÄÚµå Á¤ÀÇÇÒ ¶§ È£ÃâµË´Ï´Ù. A2W ANSI ¹®ÀÚ¿­À» À¯´ÏÄÚµå·Î ´ÙÀ½°ú °°ÀÌ º¯È¯ÇÕ´Ï´Ù:
#define A2W(lpa) (\ 
        ((LPCSTR)lpa == NULL) ? NULL : (\ 
            _convert = (strlen(lpa)+1),\ 
            AfxA2WHelper((LPWSTR) alloca(_convert*2), lpa, _convert)\ 
        )\ 

)
				
AfxA2WHelper MultiByteToWideChar »ç¿ëÇÏ¿© º¯È¯À» ¼öÇàÇÕ´Ï´Ù.

MFC º¯È¯ ¸ÅÅ©·Î¸¦ _alloca°¡ º¯È¯µÈ ¹®ÀÚ¿­ ÇÁ·Î±×·¥ ½ºÅà °ø°£À» ÇÒ´çÇÒ ¼ö ÀÖ½À´Ï´Ù. ÇÁ·Î½ÃÀú È£ÃâÀÌ ¿Ï·áµÉ ¶§ °ø°£Àº ÀÚµ¿À¸·Î ÇÒ´ç ÇØÁ¦µË´Ï´Ù. OLE OLE ÇÒ´çÀÚ¸¦ ÇÑ ±¸¼º ¿ä¼Ò¿¡ ÀÇÇØ ÇÒ´çµÈ ´ÜÃß·Î ´Ù¸¥ ÇØÁ¦µÈ ¸ðµç ¹®ÀÚ¿­À» (µ¥ÀÌÅÍ) »ç¿ëÇÒ ¼ö ÀÖ¾î¾ß ÇÕ´Ï´Ù. Áï, ¹®ÀÚ¿­À» Out ¸Å°³ º¯¼ö¸¦ ÅëÇØ Àü´ÞµÇ¸ç ¿¡¼­-Out ¸Å°³ º¯¼ö¸¦ OLE ÀÎÅÍÆäÀ̽º¸¦ »ç¿ëÇÏ¿© OLE ÇÒ´çÀÚ ÇÒ´çÇØ¾ß ÇÕ´Ï´Ù. È£ÃâÀÚ°¡ ÇØÁ¦Çϱâ À§ÇÑ ´ã´çÇϱ⠶§¹®¿¡ - ¸Å°³ º¯¼ö´Â OLE ÇÒ´çÀÚ°¡ ÇÒ´çµÉ ÇÊ¿äÇÑÁö ¾Ê½À´Ï´Ù. ´ëºÎºÐÀÇ ¿¬°á/Æ÷ÇÔ OLE ÀÎÅÍÆäÀ̽º ¹× API ¹®ÀÚ¿­À» ¸Å°³ º¯¼ö·Î Àü´ÞÇÕ´Ï´Ù. µû¶ó¼­ ´ëºÎºÐÀÇ °æ¿ì¿¡ MFC º¯È¯ ¸ÅÅ©·Î´Â »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. -out ¸Å°³ º¯¼ö¿¡ ´ëÇÑ ¶Ç´Â OLE ÇÒ´çÀÚ¸¦ »ç¿ëÇÏ¿© °ø°£À» ÇÒ´çÇÏÁö ¾Ê±â ¶§¹®¿¡ Out ¸Å°³ º¯¼ö¸¦ ÅëÇØ °ªÀ» ¹ÝȯÇϱâ À§ÇÑ MFC º¯È¯ ¸ÅÅ©·Î´Â »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù. AnsiToUnicode ¹× UnicodeToAnsi ÀÌ·¯ÇÑ °æ¿ì¿¡ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.

¾ÆÁ÷ À¯´ÏÄÚµå/ANSI º¯È¯ ·çƾ ÁýÇÕÀº ´Ù¸¥ Microsoft ½Ã½ºÅÛ ÇʱâÀå¿¡¼­ OLE Don »óÀÚ ¿­¿¡ 8¿ù 1995 Vol. 10 ¹øÈ£ 8, ÆäÀÌÁö 86 ãÀ» ¼ö ÀÖ½À´Ï´Ù. Don »óÀÚ º¯È¯µÈ À¯´ÏÄÚµå/ANSI ¹®ÀÚ¿­À» ¹ÝȯÇÏ´Â Çüº¯È¯ ¿¬»êÀÚ »ç¿ëÇÏ¿© C++ Ŭ·¡½º¸¦ Á¤ÀÇÇÕ´Ï´Ù. ÇØ´ç °³Ã¼°¡ ¹üÀ§¸¦ ¹þ¾î³¯ ¶§ ÇÒ´çµÈ °ø°£ÀÌ ÀÚµ¿À¸·Î ºñ¿öÁý´Ï´Ù. ÀÌ Å¬·¡½º´Â OLE ÇÒ´çÀÚ¸¦ »ç¿ëÇÏ¿© ÇÒ´çÇÒ ¼ö ¹× - out ¶Ç´Â Out ¸Å°³ º¯¼ö¸¦ ÅëÇØ Àü´ÞµÈ ¹®ÀÚ¿­¿¡ ´ëÇØ ÇÒ´çµÈ °ø°£À» È®º¸ÇÏ·Á¸é ¼öÁ¤ÇÒ ¼ö ÀÖ½À´Ï´Ù.

ANSI ¹®ÀÚ¿­À» À¯´ÏÄÚµå·Î º¯È¯ÇÏ´Â Don »óÀÚ ¿­ÀÇ String16, Ŭ·¡½º Áß Çϳª¸¦ µû¸¨´Ï´Ù. ´Ù¸¥ Ŭ·¡½º, ÀÌ Çϳª¿Í À¯»çÇÑ String8¿¡ ´ëÇÑ ANSI À¯´ÏÄÚµå º¯È¯¿¡ »ç¿ëµË´Ï´Ù. ÀÌÀü ¿¹Á¦¿¡¼­´Â CreateFileMoniker È£Ãâ¿¡¼­ ÀÌ Å¬·¡½º¸¦ ´ÙÀ½°ú °°ÀÌ ¸¸µé ¼ö ÀÖ½À´Ï´Ù:
GetOpenFileName(&ofn);
CreateFileMoniker(String16(ofn.lpstrFile), &pmk);
				
À§ÀÇ Äڵ带 ÀÎ String16 ÀνºÅϽº°¡ ¸¸µé¾îÁý´Ï´Ù. Ŭ·¡½ºÀÇ »ý¼ºÀÚ¿¡ ANSI ¹®ÀÚ¿­À» À¯´ÏÄÚµå·Î º¯È¯ÇÕ´Ï´Ù. ¾ð¾î ±¸ÇöÀ» È£ÃâÇÏ¿© ij½ºÆ® ¿¬»êÀÚ, ¿¬»êÀÚ const wchar_t *, CreateFileMonikerÀÇ Ã¹ ¹øÂ° ¸Å°³ º¯¼öÀÇ À¯ÇüÀÌ ¸Å°³ ÀÌ º¯¼ö¸¦ ij½ºÆÃÇØ¾ß ÇÕ´Ï´Ù. ij½ºÆ® ¿¬»êÀÚ CreateFileMoniker·Î Àü´ÞµÇ´Â À¯´ÏÄÚµå ¹®ÀÚ¿­À» ¹ÝȯÇÕ´Ï´Ù. °³Ã¼°¡ ¹üÀ§ ¹þ¾î³¯ »óŰ¡ ¶§ ¼Ò¸êÇÏ´Â °ÍÀÔ´Ï´Ù.
// String16 //////////////////////////////////////////////////////// 
// Shim class that converts both 8-bit (foreign) and
// 16-bit (native) strings to 16-bit wideness

class String16 {
public:

// native and foreign constructors
    String16(const char *p8);
    String16(const wchar_t *p16);

// non-virtual destructor (this class is concrete)

  ~String16(void);

// native conversion operator

  operator const wchar_t * (void) const;
private:

// native wideness string
    wchar_t *m_sz;
// is foreign??
    BOOL m_bIsForeign;

// protect against assignment!

  String16(const String16&);

    String16& operator=(const String16&);
};

// native constructor is a pass-through

inline String16::String16(const wchar_t *p16)
: m_sz((wchar_t *)p16), m_bIsForeign(FALSE)
{
}

// simply give out the native wideness string

inline String16::operator const wchar_t * (void) const
{
  return m_sz;
}

// foreign constructor requires allocation of a native
// string and conversion

inline String16::String16(const char *p8)
: m_bIsForeign(TRUE)
{

// calculate string length

  size_t len = strlen(p8);

// calculate required buffer size (some characters may
// already occupy 16-bits under DBCS)

  size_t size = mbstowcs(0, p8, len) + 1;

// alloc native string and convert

  if (m_sz = new wchar_t[size])

    mbstowcs(m_sz, p8, size);

}

// delete native string only if synthesized in foreign constructor

inline String16::~String16(void) {
  if (m_bIsForeign)

    delete[] m_sz;

}
				

¼Ó¼º

±â¼ú ÀÚ·á: 138813 - ¸¶Áö¸· °ËÅä: 2005³â 3¿ù 16ÀÏ ¼ö¿äÀÏ - ¼öÁ¤: 2.4
º» ¹®¼­ÀÇ Á¤º¸´Â ´ÙÀ½ÀÇ Á¦Ç°¿¡ Àû¿ëµË´Ï´Ù.
  • Microsoft OLE 4.0?À»(¸¦) ´ÙÀ½°ú ÇÔ²² »ç¿ëÇßÀ» ¶§
    • Microsoft Windows NT 3.51 ¼­ºñ½º ÆÑ 5
    • Microsoft Windows NT 4.0
    • Microsoft Windows 95
Ű¿öµå:?
kbmt kbcode kbhowto kbprogramming KB138813 KbMtko
±â°è ¹ø¿ªµÈ ¹®¼­
Áß¿ä: º» ¹®¼­´Â Àü¹® ¹ø¿ª°¡°¡ ¹ø¿ªÇÑ °ÍÀÌ ¾Æ´Ï¶ó Microsoft ±â°è ¹ø¿ª ¼ÒÇÁÆ®¿þ¾î·Î ¹ø¿ªÇÑ °ÍÀÔ´Ï´Ù. Microsoft´Â ¹ø¿ª°¡°¡ ¹ø¿ªÇÑ ¹®¼­ ¹× ±â°è ¹ø¿ªµÈ ¹®¼­¸¦ ¸ðµÎ Á¦°øÇϹǷΠMicrosoft ±â¼ú ÀÚ·á¿¡ ÀÖ´Â ¸ðµç ¹®¼­¸¦ Çѱ۷ΠÁ¢ÇÒ ¼ö ÀÖ½À´Ï´Ù. ±×·¯³ª ±â°è ¹ø¿ª ¹®¼­°¡ Ç×»ó ¿Ïº®ÇÑ °ÍÀº ¾Æ´Õ´Ï´Ù. µû¶ó¼­ ±â°è ¹ø¿ª ¹®¼­¿¡´Â ¸¶Ä¡ ¿Ü±¹ÀÎÀÌ Çѱ¹¾î·Î ¸»ÇÒ ¶§ ½Ç¼ö¸¦ ÇÏ´Â °Íó·³ ¾îÈÖ, ±¸¹® ¶Ç´Â ¹®¹ý¿¡ ¿À·ù°¡ ÀÖÀ» ¼ö ÀÖ½À´Ï´Ù. Microsoft´Â ³»¿ë»óÀÇ ¿À¿ª ¶Ç´Â Microsoft °í°´ÀÌ ÀÌ·¯ÇÑ ¿À¿ªÀ» »ç¿ëÇÔÀ¸·Î½á ¹ß»ýÇÏ´Â ºÎ Á¤È®¼º, ¿À·ù ¶Ç´Â ¼ÕÇØ¿¡ ´ëÇØ Ã¥ÀÓÀ» ÁöÁö ¾Ê½À´Ï´Ù. Microsoft´Â ÀÌ·¯ÇÑ ¹®Á¦¸¦ ÇØ°áÇϱâ À§ÇØ ±â°è ¹ø¿ª ¼ÒÇÁÆ®¿þ¾î¸¦ ÀÚÁÖ ¾÷µ¥ÀÌÆ®Çϰí ÀÖ½À´Ï´Ù.

Çǵå¹é º¸³»±â