Registry¿¡ File Iconµî·ÏÇØÁÖ±â


1.¿ä¾à

ÇÁ·Î±×·¥¿¡¼­ »ç¿ëµÇ´Â ƯÁ¤ ÆÄÀÏÀÇ IconÀ» ÁöÁ¤ÇÏ´Â ¹æ¹ýÀ» ¾Ë¾Æº¸ÁÒ.


2.º»¹®

¸ÕÀú Resource¿¡ icon¸¦ Ãß°¡ÇÕ´Ï´Ù.

Registry¿¡¼­´Â Ãß°¡µÈ IconÀÇ ¹øÈ£¸¦ °¡Áö°í »ç¿ëÇϴµ¥ ¸ÇóÀ½ Ãß°¡ µÈ iconÀ» 1·Î ÇØ¼­ Â÷·Ê·Î Áõ°¡ÇØ ³ª°©´Ï´Ù. ¼¼¹øÂ°·Î Ãß°¡µÈ Icon¸¦ (3)¸¦ »ç¿ëÇÏ´Â °æ¿ì¸¦ ¿¹·Î µé¾î ¼³¸íÇÏÁÒ.


strDefaultIconCommandLine = "C:\\ActiveTutor\\ATRecorder,3"; 

strFileTypeId = "ActiveTutorFile3" 

strFileTypeName = "Active Tutor File3"; 

strFilterExt = ".atk"; 



//first register the type ID of our server 

_AfxSetRegKey(strFileTypeId, strFileTypeName); 



// IconCommandLine°ªÀ» Registry¿¡ µî·ÏÇÑ´Ù. 

strTemp.Format("%s\\DefaultIcon", strFileTypeId); 

_AfxSetRegKey(strTemp, strDefaultIconCommandLine); 



// Registry¿¡ ÆÄÀÏ µî·Ï 

LONG lSize = _MAX_PATH * 2; 

LONG lResult = ::RegQueryValue(HKEY_CLASSES_ROOT, strFilterExt, 

                               strTemp.GetBuffer(lSize), &lSize); 

strTemp.ReleaseBuffer(); 

ÀÌ·¸°Ô µî·ÏÀ» ÇØÁÖ¸é ÇÁ·Î±×·¥ÀÇ Resource»óÀÇ ¼¼¹øÂ° ¾ÆÀÌÄÜÀ» *.atk¶ó´Â ÆÄÀÏÀÇ ¾ÆÀÌÄÜÀ¸·Î »ç¿ëÇÏ°Ô µË´Ï´Ù.


3.¿¹Á¦



4.Âü°í

_AfxSetRegKey() ¶ó´Â ÇÔ¼ö´Â DocMgr.cpp À̶ó´Â °÷¿¡ ÀÖ½À´Ï´Ù. Document Manager ¶ó´Â ¶æÀÎ°Í °°³×¿ä.

¾î·µç, ¾Æ·¡ÀÇ ¼Ò½º¸¦ Ãß°¡·Î ³Ö¾îÁÖ½Ã¸é µË´Ï´Ù.

(Dialog Based ¿¡¼­~ ^^.)

---

¼Ò½º.. DocMgr.cpp ñé..


BOOL _AfxSetRegKey(LPCTSTR lpszKey, LPCTSTR lpszValue, LPCTSTR lpszValueName) 

{ 

    if (lpszValueName == NULL) 

    { 

        if (::RegSetValue(HKEY_CLASSES_ROOT, lpszKey, REG_SZ, 

            lpszValue, lstrlen(lpszValue) * sizeof(TCHAR)) != ERROR_SUCCESS) 

        { 

            TRACE1("Warning: registration database update failed for key '%s'.\n", 

                lpszKey); 

            return FALSE; 

        } 

        return TRUE; 

    } 

    else 

    { 

        HKEY hKey; 

        

        if(::RegCreateKey(HKEY_CLASSES_ROOT, lpszKey, &hKey) == ERROR_SUCCESS) 

        { 

            LONG lResult = ::RegSetValueEx(hKey, lpszValueName, 0, REG_SZ, 

                (CONST BYTE*)lpszValue, (lstrlen(lpszValue) + 1) * sizeof(TCHAR)); 

            

            if(::RegCloseKey(hKey) == ERROR_SUCCESS && lResult == ERROR_SUCCESS) 

                return TRUE; 

        } 

        TRACE1("Warning: registration database update failed for key '%s'.\n", lpszKey); 

        return FALSE; 

    } 

} 



- 2001.08.13 Smile Seo -