Article ID: 182220
Article Last Modified on 11/5/2003
nErr = RegOpenKey( HKEY_LOCAL_MACHINE,
L"Software\\Microsoft\\MMC\\SnapIns",
&hMmcParentKey);
Should be changed to:
nErr = RegOpenKey( HKEY_LOCAL_MACHINE,
_T("Software\\Microsoft\\MMC\\SnapIns"),
&hMmcParentKey);
The _T("") macro will be expanded to the appropriate string constant
based on the UNICODE switch.
// These are the clipboard formats that you must supply at a minimum.
// MMC.h actually defined these. You can make up your own to use for
// other reasons. You don't need any others at this time.
//
// For ANSI, convert the format labels to ANSI if UNICODE
// is not defined.
// Leave them alone if they are OK.
//
#ifndef UNICODE
//
// If you are building an ANSI project, the
// RegisterClipboardFormat strings must be ANSI. From the MMC
// headers, the strings are UNICODE and they must be converted to
// ANSI in order to register them properly.
//
// Use conditional compilation to get the job done.
//
char buffer[256];
wcstombs( buffer, CF_SNAPIN_INTERNAL,
wcslen(CF_SNAPIN_INTERNAL)+1);
s_cfInternal = RegisterClipboardFormat((LPCSTR)buffer);
wcstombs( buffer, CCF_DISPLAY_NAME, wcslen(CCF_DISPLAY_NAME)+1);
s_cfDisplayName = RegisterClipboardFormat((LPCSTR)buffer);
wcstombs( buffer, CCF_NODETYPE, wcslen(CCF_NODETYPE)+1);
s_cfNodeType = RegisterClipboardFormat((LPCSTR)buffer);
wcstombs( buffer, CCF_SNAPIN_CLASSID,
wcslen(CCF_SNAPIN_CLASSID)+1);
s_cfSnapinClsid = RegisterClipboardFormat((LPCSTR)buffer);
#else
//
// UNICODE is defined, the clipboard formats will be OK.
//
s_cfInternal = RegisterClipboardFormat( CF_SNAPIN_INTERNAL);
s_cfDisplayName = RegisterClipboardFormat(CCF_DISPLAY_NAME);
s_cfNodeType = RegisterClipboardFormat(CCF_NODETYPE);
s_cfSnapinClsid = RegisterClipboardFormat(CCF_SNAPIN_CLASSID);
#endif
Additional query words: MMC, samples, tutorial,
Keywords: kbunicode kbprb kbsnapin KB182220