ウィンドウを透明に
SetLayeredWindowAttributes
#ifndef _INC_H_HELP_USER_DLL
#define _INC_H_HELP_USER_DLL
#include <WinUser.h>
////
//*******************************************************************************
// 関数名 :SetLayeredWindowAttributes
// 作成日 :’11/01/26
//*******************************************************************************
// C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinUser.h より
#ifndef LWA_COLORKEY
WINUSERAPI BOOL WINAPI SetLayeredWindowAttributes(HWND hwnd,COLORREF crKey,BYTE bAlpha,DWORD dwFlags) ;
#define LWA_COLORKEY 0x00000001
#define LWA_ALPHA 0x00000002
inline
BOOL Hlp_SetLayeredWindowAttributes (HWND hwnd,COLORREF crKey,BYTE bAlpha,DWORD dwFlags)
{
HMODULE hDll = ::LoadLibrary(_T(“User32.dll”)) ;
if (hDll == NULL) { return FALSE ; }
HRESULT (WINAPI *pfSetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD) = NULL ;
(FARPROC&)pfSetLayeredWindowAttributes = ::GetProcAddress(hDll,(“SetLayeredWindowAttributes”)) ;
BOOL res = FALSE ;
if (pfSetLayeredWindowAttributes != NULL) {
res = pfSetLayeredWindowAttributes(hwnd,crKey,bAlpha,dwFlags) ;
}
::FreeLibrary(hDll) ;
return res ;
}
#define Use_Help
#endif
////
//*******************************************************************************
// 関数名 :SetLayeredWindowAttributes
// 作成日 :’11/01/26
//*******************************************************************************
#ifndef WS_EX_LAYERED
#define WS_EX_LAYERED 0x00080000
#endif
inline
BOOL SetLayeredWindowAttributes(CWnd*wnd,COLORREF key,BYTE alpha=128,DWORD flags=LWA_COLORKEY)
{
if (wnd == NULL) { return FALSE ; }
HWND hwnd = wnd->GetSafeHwnd() ;
if (hwnd == NULL) { return FALSE ; }
BOOL result = FALSE ;
LONG exStyle=::GetWindowLong(hwnd,GWL_EXSTYLE) ;
::SetWindowLong(hwnd,GWL_EXSTYLE,exStyle|WS_EX_LAYERED) ;
#ifdef Use_Help
result = ::Hlp_SetLayeredWindowAttributes(hwnd,key,alpha,flags) ;
#else
result = ::SetLayeredWindowAttributes(hwnd,key,alpha,flags) ;
#endif
return result ;
}
#endif
MFC 6 で CHARFORMATW
SetSelectionCharFormat では,CHARFORMATA になっている様なので
CString faceName= FontFace.GetFaceName() ;
{
CHARRANGE selCR ;
m_CtrlRichEdit.GetSel(selCR) ;
{
m_CtrlRichEdit.SetSel(0,-1) ;
#ifdef _UNICODE
CHARFORMATW cf ; ::ZeroMemory(&cf,sizeof(CHARFORMATW)) ; cf.cbSize = sizeof(CHARFORMATW) ;
#else
CHARFORMAT cf ; ::ZeroMemory(&cf,sizeof(CHARFORMAT)) ; cf.cbSize = sizeof(CHARFORMAT) ;
#endif
::TcsNCpy(cf.szFaceName,LF_FACESIZE-1,faceName,LF_FACESIZE-1) ;
cf.dwMask = CFM_FACE ;
#ifdef _UNICODE
m_CtrlRichEdit.SendMessage(EM_SETCHARFORMAT,SCF_SELECTION,(LPARAM)&cf) ;
#else
m_CtrlRichEdit.SetSelectionCharFormat(cf) ;
#endif
}
m_CtrlRichEdit.SetSel(selCR) ;
}
System Volume Information フォルダ
System Volume Information フォルダへアクセスする方法
http://support.microsoft.com/kb/309531/ja
https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/309531