本文整理汇总了C++中IsWindow函数的典型用法代码示例。如果您正苦于以下问题:C++ IsWindow函数的具体用法?C++ IsWindow怎么用?C++ IsWindow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsWindow函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BaseBar_WindowProc
//.........这里部分代码省略.........
GetWindowRect(hwnd, &rcWindow);
MapWindowPoints(NULL, hwnd, (LPPOINT)&rcWindow, 2);
OffsetRect(&rcClient, -rcWindow.left, -rcWindow.top);
OffsetRect(&rcWindow, -rcWindow.left, -rcWindow.top);
ExcludeClipRect(hdc, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
FillRect(hdc, &rcWindow, (HBRUSH)GetSysColorBrush(COLOR_BTNFACE));
ReleaseDC(hwnd, hdc);
}
return (TRUE);
case BCM_SETCLIENTWND:
{
REBARBANDINFO rbBand;
ZeroMemory(&rbBand, sizeof(REBARBANDINFO));
rbBand.cbSize = sizeof(REBARBANDINFO);
rbBand.fMask = RBBIM_CHILDSIZE | RBBIM_CHILD;
rbBand.cyIntegral = 1;
rbBand.cyMaxChild = -1;
rbBand.hwndChild = (HWND)lParam;
return (SendMessage(lpbi->hwndRebar, RB_SETBANDINFO, 0, (LPARAM)&rbBand));
}
case BCM_GETCLIENTWND:
{
REBARBANDINFO rbBand;
ZeroMemory(&rbBand, sizeof(REBARBANDINFO));
rbBand.cbSize = sizeof(REBARBANDINFO);
rbBand.fMask = RBBIM_CHILD;
SendMessage(lpbi->hwndRebar, RB_GETBANDINFO, 0, (LPARAM)&rbBand);
return (LRESULT)((IsWindow(rbBand.hwndChild) ? rbBand.hwndChild : NULL));
}
case BCM_SETIMAGELIST:
{
REBARINFO rbi;
HIMAGELIST hilOld = BandCtrl_GetImageList(hwnd);
rbi.cbSize = sizeof(REBARINFO);
rbi.fMask = RBIM_IMAGELIST;
rbi.himl = (HIMAGELIST)lParam;
if (!SendMessage(lpbi->hwndRebar, RB_SETBARINFO, 0, (LPARAM) &rbi))
return ((LRESULT)NULL);
return ((LRESULT)hilOld);
}
case BCM_GETIMAGELIST:
{
REBARINFO rbi;
rbi.cbSize = sizeof(REBARINFO);
rbi.fMask = RBIM_IMAGELIST;
rbi.himl = 0;
if (!SendMessage(lpbi->hwndRebar, RB_GETBARINFO, 0, (LPARAM) &rbi))
return ((LRESULT)NULL);
return ((LRESULT)rbi.himl);
}
case BCM_SETTITLEIMAGE:
{
REBARBANDINFO rbBand;
示例2: ASSERT
CME_CODE CEdit::RegisterLanguage( LPCTSTR pszName, CM_LANGUAGE *pLang )
{
ASSERT( pszName );
if ( !pLang )
{
// caller did not supply a language definition. See if this
// is a stock language for which we have a definition.
static struct _StockLang {
CM_LANGUAGE *pLang;
LPCTSTR pszName;
} Languages[] = { { &g_LangCPP, CMLANG_CPP },
{ &g_LangPascal, CMLANG_PASCAL },
{ &g_LangBasic, CMLANG_BASIC },
{ &g_LangSQL, CMLANG_SQL },
{ &g_LangJava, CMLANG_JAVA },
{ &g_LangHTML, CMLANG_HTML },
{ &g_LangXML, CMLANG_XML } };
for ( int i = 0; i < ARRAY_SIZE( Languages ); i++ )
{
_StockLang *pLangCurr = Languages + i;
if ( _tcsicmp( pLangCurr->pszName, pszName ) == 0 )
{
pLang = pLangCurr->pLang;
break;
}
}
}
ASSERT( pLang );
if ( !pLang )
{
return CME_BADARGUMENT;
}
// make sure the same language is not registered twice
BOOL bDupe = FALSE;
for ( int i = 0; i < g_nLanguageCount; i++ )
{
if ( _tcsicmp( g_pLanguages[ i ]->m_szName, pszName ) == 0 )
{
bDupe = TRUE;
break;
}
}
if ( bDupe )
{
delete g_pLanguages[ i ];
g_pLanguages[ i ] = new CLanguage( pszName, pLang );
// 'flash' the controls that have this language
for ( int nWnd = 0; nWnd < g_nhWndCount; nWnd++ )
{
HWND hWnd = CEdit::g_phWnds[ nWnd ];
ASSERT( IsWindow( hWnd ) );
TCHAR szLang[ CM_MAX_LANGUAGE_NAME ];
CM_GetLanguage( hWnd, szLang );
if ( _tcsicmp( szLang, pszName ) == 0 )
{
// language in use -- re-establish the new language
CM_SetLanguage( hWnd, NULL );
CM_SetLanguage( hWnd, pszName );
}
}
}
else
{
g_pLanguages = g_pLanguages ? ( CLanguage ** ) realloc( g_pLanguages, ( g_nLanguageCount + 1 ) * sizeof( CLanguage * ) ) :
( CLanguage ** ) malloc( sizeof( CLanguage * ) );
g_pLanguages[ g_nLanguageCount++ ] = new CLanguage( pszName, pLang );
}
return CME_SUCCESS;
}
示例3: lRunMainLoop
//.........这里部分代码省略.........
ULW = (typeof(ULW))ULWstub;
attr &= ~WS_EX_LAYERED;
if (flgs & COM_OPAQ)
opts = ULW_OPAQUE;
}
RegisterClassEx(&wndc);
hwnd = CreateWindowEx(attr, wndc.lpszClassName, 0, WS_POPUP | WS_VISIBLE,
0, 0, 0, 0, 0, 0, wndc.hInstance, engd);
data[0] = (intptr_t)hwnd;
mwdc = GetDC(hwnd);
if (EBW) {
comp = FALSE;
ICE = (typeof(ICE))GetProcAddress(hdwm, "DwmIsCompositionEnabled");
/// if there`s DWM, there absolutely have to be layered windows
SLW = (typeof(SLW))GetProcAddress(husr, "SetLayeredWindowAttributes");
ICE(&comp);
attr = GetVersion();
/// major 6 minor 1 is Win7; in newer versions ICE() is lying to us
if (!comp && (MAKEWORD(HIBYTE(attr), LOBYTE(attr)) <= 0x0601))
EBW = 0;
else {
/// does nothing visible to the window,
/// but enables input transparency!
SLW(hwnd, 0x000000, 0xFF, 2 /** 2 == LWA_ALPHA **/);
EBW(hwnd, &blur);
}
}
if (flgs & COM_RGPU) {
ppfd.iLayerType = PFD_MAIN_PLANE;
SetPixelFormat(mwdc, ChoosePixelFormat(mwdc, &ppfd), &ppfd);
wglMakeCurrent(mwdc, mwrc = wglCreateContext(mwdc));
}
/// "+1" is a dirty hack to not let Windows consider us fullscreen if OGL
/// is active: all sorts of weird things happen to fullscreen OGL windows
/// when they are DWM + layered, at least on Intel HD 3000 + Vista / Win7
SetWindowPos(hwnd, 0, mpos.x, mpos.y, dims.cx, dims.cy + ((EBW)? 1 : 0),
SWP_NOZORDER | SWP_NOACTIVATE);
lShowMainWindow(engd, flgs & COM_SHOW);
while (data[0]) {
if (PeekMessage(&pmsg, 0, 0, 0, PM_REMOVE)) {
TranslateMessage(&pmsg);
DispatchMessage(&pmsg);
continue;
}
GetCursorPos(&cpos);
ScreenToClient(hwnd, &cpos);
attr = ((GetActiveWindow() == hwnd)? UFR_MOUS : 0)
| ((GetAsyncKeyState(VK_LBUTTON))? UFR_LBTN : 0)
| ((GetAsyncKeyState(VK_MBUTTON))? UFR_MBTN : 0)
| ((GetAsyncKeyState(VK_RBUTTON))? UFR_RBTN : 0)
| ((GetAsyncKeyState(VK_UP ))? UFR_PL1W : 0)
| ((GetAsyncKeyState(VK_DOWN ))? UFR_PL1S : 0)
| ((GetAsyncKeyState(VK_LEFT ))? UFR_PL1A : 0)
| ((GetAsyncKeyState(VK_RIGHT ))? UFR_PL1D : 0)
| ((GetAsyncKeyState('W' ))? UFR_PL2W : 0)
| ((GetAsyncKeyState('S' ))? UFR_PL2S : 0)
| ((GetAsyncKeyState('A' ))? UFR_PL2A : 0)
| ((GetAsyncKeyState('D' ))? UFR_PL2D : 0);
attr = cPrepareFrame(engd, cpos.x, cpos.y, attr);
if (attr & PFR_SKIP)
Sleep(1);
if (!IsWindow(hwnd))
break;
if (attr & PFR_HALT)
continue;
if (~flgs & COM_RGPU)
BitBlt(devc, 0, 0, dims.cx, dims.cy, mwdc, 0, 0, BLACKNESS);
cOutputFrame(engd, !EBW);
if (!EBW)
ULW(hwnd, mwdc, &mpos, &dims, devc, &zpos, 0, bfun, opts);
else {
if (flgs & COM_RGPU)
SwapBuffers(mwdc);
else
BitBlt(mwdc, 0, 0, dims.cx, dims.cy, devc, 0, 0, SRCCOPY);
SetWindowLongPtr(hwnd, GWL_EXSTYLE, (attr & PFR_PICK)? EXT_ATTR :
WS_EX_TRANSPARENT | EXT_ATTR);
}
}
cDeallocFrame(engd, !EBW);
if (flgs & COM_RGPU) {
wglMakeCurrent(0, 0);
wglDeleteContext(mwrc);
}
KillTimer(hwnd, 1);
ReleaseDC(hwnd, mwdc);
DestroyWindow(hwnd);
DeleteDC(mwdc);
DeleteDC(devc);
DeleteObject(hdib);
DeleteObject(blur.hRgnBlur);
/// mandatory: we are a library, not an application
UnregisterClass(wndc.lpszClassName, wndc.hInstance);
/// finally, we need to purge the message queue, as it may be reused,
/// and nobody wants garbage messages for windows that are long gone
while (PeekMessage(&pmsg, 0, 0, 0, PM_REMOVE));
FreeLibrary(husr);
FreeLibrary(hdwm);
}
示例4: __declspec
void __declspec(dllexport) show(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop)
{
TCHAR fn[MAX_PATH];
TCHAR temp[64];
TCHAR *sleep=temp;
EXDLL_INIT();
popstring(sleep);
popstring(fn);
sleep_val=0;
while (*sleep >= _T('0') && *sleep <= _T('9'))
{
sleep_val*=10;
sleep_val+=*sleep++-_T('0');
}
if (fn[0] && sleep_val>0)
{
MSG msg;
TCHAR classname[4]=_T("_sp");
static WNDCLASS wc;
wc.lpfnWndProc = WndProc;
wc.hInstance = g_hInstance;
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
wc.lpszClassName = classname;
if (RegisterClass(&wc))
{
TCHAR fn2[MAX_PATH];
lstrcpy(fn2,fn);
lstrcat(fn,_T(".bmp"));
lstrcat(fn2,_T(".wav"));
g_hbm=LoadImage(NULL,fn,IMAGE_BITMAP,0,0,LR_CREATEDIBSECTION|LR_LOADFROMFILE);
if (g_hbm)
{
HWND myWnd;
PlaySound(fn2,NULL,SND_ASYNC|SND_FILENAME|SND_NODEFAULT);
myWnd = CreateWindowEx(WS_EX_TOOLWINDOW,classname,classname,
0,0,0,0,0,(HWND)hwndParent,NULL,g_hInstance,NULL);
while (IsWindow(myWnd) && GetMessage(&msg,myWnd,0,0))
{
DispatchMessage(&msg);
}
// Stop currently playing wave, we want to exit
PlaySound(0,0,0);
DeleteObject(g_hbm);
UnregisterClass(classname, g_hInstance);
}
}
}
wsprintf(temp,_T("%d"),g_rv);
pushstring(temp);
}
示例5: SendWordToServer
static void SendWordToServer()
{
DWORD_PTR SendMsgAnswer;
DWORD flags;
LRESULT lr;
if( !IsWindow( GlobalData->ServerWND ) )
return;
// Ask for needing to retrieve word - WPARAM = 1
lr = SendMessageTimeout(GlobalData->ServerWND, WM_MY_SHOW_TRANSLATION, 1, 0, SMTO_ABORTIFHUNG, MOUSEOVER_INTERVAL, &SendMsgAnswer);
if( lr == 0 || SendMsgAnswer == 0) //No answer or no needing
return;
flags = SendMsgAnswer;
if (hGetWordLib == 0 && ( flags & GD_FLAG_METHOD_STANDARD ) ) {
hGetWordLib = LoadLibraryW(GlobalData->LibName);
if (hGetWordLib) {
GetWordProc = (GetWordProc_t)GetProcAddress(hGetWordLib, "__gdGetWord");
}
else {
hGetWordLib = INVALID_HANDLE_VALUE;
}
}
GlobalData->CurMod.MatchedWord[0] = 0;
GlobalData->CurMod.WordLen = 0;
GlobalData->CurMod.BeginPos = 0;
if( ( flags & GD_FLAG_METHOD_GD_MESSAGE ) != 0 && uGdAskMessage != 0 ) {
int n;
gds.dwSize = sizeof(gds);
gds.cwData = Buffer;
gds.dwMaxLength = sizeof(Buffer) / sizeof(Buffer[0]);
Buffer[0] = 0;
gds.hWnd = GlobalData->LastWND;
gds.Pt = GlobalData->LastPt;
lr = SendMessageTimeout(gds.hWnd, uGdAskMessage, 0, (LPARAM)&gds, SMTO_ABORTIFHUNG, REQUEST_MESSAGE_INTERVAL, &SendMsgAnswer);
if(lr != 0 && SendMsgAnswer != 0) {
n = WideCharToMultiByte(CP_UTF8, 0, gds.cwData, lstrlenW(gds.cwData), GlobalData->CurMod.MatchedWord, sizeof(GlobalData->CurMod.MatchedWord) - 1, 0, 0);
GlobalData->CurMod.MatchedWord[n] = 0;
GlobalData->CurMod.WordLen = n;
GlobalData->CurMod.BeginPos = 0;
if(n > 0) {
if( IsWindow( GlobalData->ServerWND ) ) {
#ifdef __WIN64
GlobalData32->LastWND = HandleToLong( GlobalData->LastWND );
GlobalData32->CurMod.WordLen = n;
GlobalData32->CurMod.BeginPos = 0;
lstrcpyn( GlobalData32->CurMod.MatchedWord, GlobalData->CurMod.MatchedWord, sizeof( GlobalData32->CurMod.MatchedWord ) );
#endif
SendMessageTimeout(GlobalData->ServerWND, WM_MY_SHOW_TRANSLATION, 0, 0, SMTO_ABORTIFHUNG, MOUSEOVER_INTERVAL, &SendMsgAnswer);
}
}
return;
}
}
if( ( flags & GD_FLAG_METHOD_STANDARD ) != 0 && GetWordProc != 0 ) {
GlobalData->CurMod.WND = GlobalData->LastWND;
GlobalData->CurMod.Pt = GlobalData->LastPt;
GetWordProc(&(GlobalData->CurMod));
if (GlobalData->CurMod.WordLen > 0) {
if( IsWindow( GlobalData->ServerWND ) ) {
#ifdef __WIN64
GlobalData32->LastWND = HandleToLong( GlobalData->LastWND );
GlobalData32->CurMod.WordLen = GlobalData->CurMod.WordLen;
GlobalData32->CurMod.BeginPos = GlobalData->CurMod.BeginPos;
lstrcpyn( GlobalData32->CurMod.MatchedWord, GlobalData->CurMod.MatchedWord, sizeof( GlobalData32->CurMod.MatchedWord ) );
#endif
SendMessageTimeout(GlobalData->ServerWND, WM_MY_SHOW_TRANSLATION, 0, 0, SMTO_ABORTIFHUNG, MOUSEOVER_INTERVAL, &SendMsgAnswer);
}
return;
}
}
if( ( flags & GD_FLAG_METHOD_IACCESSIBLEEX ) != 0 ) {
getWordByAccEx( GlobalData->LastPt );
if (GlobalData->CurMod.WordLen > 0 ) {
if( IsWindow( GlobalData->ServerWND ) ) {
#ifdef __WIN64
GlobalData32->LastWND = HandleToLong( GlobalData->LastWND );
GlobalData32->CurMod.WordLen = GlobalData->CurMod.WordLen;
GlobalData32->CurMod.BeginPos = GlobalData->CurMod.BeginPos;
lstrcpyn( GlobalData32->CurMod.MatchedWord, GlobalData->CurMod.MatchedWord, sizeof( GlobalData32->CurMod.MatchedWord ) );
#endif
SendMessageTimeout(GlobalData->ServerWND, WM_MY_SHOW_TRANSLATION, 0, 0, SMTO_ABORTIFHUNG, MOUSEOVER_INTERVAL, &SendMsgAnswer);
}
return;
}
}
if( ( flags & GD_FLAG_METHOD_UI_AUTOMATION ) != 0 && IsWindow( GlobalData->ServerWND ) ) {
#ifdef __WIN64
GlobalData32->CurMod.MatchedWord[0] = 0;
GlobalData32->CurMod.WordLen = 0;
GlobalData32->CurMod.BeginPos = 0;
//.........这里部分代码省略.........
示例6: OnSize
void CPageFileTypes::OnSize(UINT nType, int cx, int cy)
{
if (IsWindow(tree)) tree.MoveWindow(0, 0, cx, cy);
}
示例7: return
bool CAutoConnector::IsConnected()
{
return ((_attached_hwnd != NULL) && IsWindow(_attached_hwnd));
}
示例8: RichUtil_Proc
static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
TRichUtil *ru;
EnterCriticalSection(&csRich);
ru = rlist_find(slist, hwnd);
LeaveCriticalSection(&csRich);
switch(msg) {
case WM_THEMECHANGED:
case WM_STYLECHANGED:
{
RichUtil_ClearUglyBorder(ru);
break;
}
case WM_NCPAINT:
{
LRESULT ret = CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
if (ru->hasUglyBorder&&MyIsThemeActive()) {
HANDLE hTheme = MyOpenThemeData(ru->hwnd, L"EDIT");
if (hTheme) {
RECT rcBorder;
RECT rcClient;
int nState;
HDC hdc = GetWindowDC(ru->hwnd);
GetWindowRect(hwnd, &rcBorder);
rcBorder.right -= rcBorder.left; rcBorder.bottom -= rcBorder.top;
rcBorder.left = rcBorder.top = 0;
CopyRect(&rcClient, &rcBorder);
rcClient.left += ru->rect.left;
rcClient.top += ru->rect.top;
rcClient.right -= ru->rect.right;
rcClient.bottom -= ru->rect.bottom;
ExcludeClipRect(hdc, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
if(MyIsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, ETS_NORMAL))
MyDrawThemeParentBackground(hwnd, hdc, &rcBorder);
if(!IsWindowEnabled(hwnd))
nState = ETS_DISABLED;
else if(SendMessage(hwnd, EM_GETOPTIONS, 0, 0) & ECO_READONLY)
nState = ETS_READONLY;
else nState = ETS_NORMAL;
MyDrawThemeBackground(hTheme, hdc, EP_EDITTEXT, nState, &rcBorder, NULL);
MyCloseThemeData(hTheme);
ReleaseDC(hwnd, hdc);
return 0;
}
}
return ret;
}
case WM_NCCALCSIZE:
{
LRESULT ret = CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
NCCALCSIZE_PARAMS *ncsParam = (NCCALCSIZE_PARAMS*)lParam;
if (ru->hasUglyBorder&&MyIsThemeActive()) {
HANDLE hTheme = MyOpenThemeData(hwnd, L"EDIT");
if (hTheme) {
RECT rcClient;
HDC hdc = GetDC(GetParent(hwnd));
ZeroMemory(&rcClient, sizeof(RECT));
if(MyGetThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &ncsParam->rgrc[0], &rcClient) == S_OK) {
ru->rect.left = rcClient.left-ncsParam->rgrc[0].left;
ru->rect.top = rcClient.top-ncsParam->rgrc[0].top;
ru->rect.right = ncsParam->rgrc[0].right-rcClient.right;
ru->rect.bottom = ncsParam->rgrc[0].bottom-rcClient.bottom;
CopyRect(&ncsParam->rgrc[0], &rcClient);
MyCloseThemeData(hTheme);
ReleaseDC(GetParent(hwnd), hdc);
return WVR_REDRAW;
}
ReleaseDC(GetParent(hwnd), hdc);
MyCloseThemeData(hTheme);
}
}
return ret;
}
case WM_ENABLE:
RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE|RDW_NOCHILDREN|RDW_UPDATENOW|RDW_FRAME);
break;
case WM_DESTROY:
{
LRESULT ret = CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
if(IsWindow(hwnd)) {
if((WNDPROC)GetWindowLongPtr(hwnd, GWLP_WNDPROC) == &RichUtil_Proc)
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)ru->origProc);
}
EnterCriticalSection(&csRich);
slist = rlist_remove(slist, ru);
LeaveCriticalSection(&csRich);
if (ru) free(ru);
return ret;
}
}
return CallWindowProc(ru->origProc, hwnd, msg, wParam, lParam);
}
示例9: startwin_idle
int startwin_idle(void *v)
{
if (!startupdlg || !IsWindow(startupdlg)) return 0;
if (IsDialogMessage(startupdlg, (MSG*)v)) return 1;
return 0;
}
示例10: return
bool DisplayWGL::isValidNativeWindow(EGLNativeWindowType window) const
{
return (IsWindow(window) == TRUE);
}
示例11:
//---------------------------------------------------------------------
// Function: CreateRenderContext
// Description: Function to create a context in which to render to
// Parameters: hWnd = windows handle for rendering context
// name = name of the rendering context
// left = left position inside window
// top = top " " "
// width = width " " "
// height = height " " "
// bpp = bits per pixel of rendering context
// depth = Z-Buffer depth
// stencil = Z-Stencil bits
// fullscreen = whether window is full screen or not
// parent = parents rendering context if available
// Returns: TRUE, if successful
//---------------------------------------------------------------------
BOOL CDX8RenderCore::CreateRenderContext(HWND hWnd, LPCSTR name, DWORD left,
DWORD top, DWORD width, DWORD height, DWORD bpp, DWORD depth,
DWORD stencil, BOOL fullscreen, CRenderContext *parent)
{
CDX8RenderContext *newCtx;
// if parent is null then we have to have an hWnd
if (parent == NULL)
{
// we have to have a valid window
if (!IsWindow(hWnd))
{
m_LastError = ERROR_INVALID_WINDOW_HANDLE;
gLogger->Print(_T("CreateRenderContext: Invalid Window handle specified"));
return FALSE;
}
}
else
{
// if we don't have a valid window, default to parents.
if (!IsWindow(hWnd))
{
hWnd = parent->GetParentHwnd();
}
}
// create a new DX8 Render context.
newCtx = new CDX8RenderContext(m_pD3D, hWnd, name, left, top, width, height, bpp,
depth, stencil, fullscreen, parent);
if (newCtx == NULL)
{
m_LastError = ERROR_NOT_ENOUGH_MEMORY;
gLogger->Print(_T("CreateRenderContext: Out of memory allocating CDX8RenderContext"));
return FALSE;
}
if (newCtx->GetLastError() != D3D_OK)
{
gLogger->Print(_T("CreateRenderContext: Failed, see log file"));
return FALSE;
}
// top level parents get saved here
if (parent == NULL)
{
// what the hell?
DWORD nContexts = m_RenderContexts.size();
m_RenderContexts.insert(MAPHWNDRC::value_type(hWnd, newCtx));
// and save into context list
// m_RenderContexts[hWnd] = newCtx;
if (nContexts != 0)
{
return FALSE;
}
}
else
{
parent->AddChild(newCtx);
}
return TRUE;
}
示例12: AeroAutoSubclass
BOOL AeroAutoSubclass(HWND hWnd, DWORD dwFlags, DWORD dwReserved)
{
if(!hWnd || !IsWindow(hWnd) || 0L!=dwReserved)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
UINT uiRedrawMsg = RegisterWindowMessage(REDRAWSTRING);
if(!uiRedrawMsg)
return FALSE; // use the RegisterWindowMessage last error
CDwmApiImpl *pDwm = NULL;
CUxThemeAeroImpl *pUxTheme = NULL;
PAERO_SUBCLASS_WND_DATA pWndData = NULL;
DWORD dwLastError = ERROR_SUCCESS;
MARGINS marGlassInset = {-1,-1,-1,-1};
HRESULT hRes = S_OK;
bool bBufferedPaintInitialized = false;
ERROR_PARENT_AERO_SUBCLASS_WND_DATA errParentAeroData;
ZeroMemory(&errParentAeroData, sizeof(errParentAeroData));
errParentAeroData.m_dwFlags = dwFlags;
errParentAeroData.m_hWndParent = hWnd;
try
{
pDwm = new CDwmApiImpl;
}
catch (...)
{
dwLastError = ERROR_NOT_ENOUGH_MEMORY;
}
if(ERROR_SUCCESS!=dwLastError)
goto CLEANUP;
try
{
pUxTheme = new CUxThemeAeroImpl;
}
catch (...)
{
dwLastError = ERROR_NOT_ENOUGH_MEMORY;
}
if(ERROR_SUCCESS!=dwLastError)
goto CLEANUP;
pWndData = (PAERO_SUBCLASS_WND_DATA)LocalAlloc(LPTR, sizeof(AERO_SUBCLASS_WND_DATA));
if(!pWndData)
{
dwLastError = GetLastError();
goto CLEANUP;
}
if(!pDwm->Initialize())
{
dwLastError = GetLastError();
goto CLEANUP;
}
if(!pUxTheme->Initialize())
{
dwLastError = GetLastError();
goto CLEANUP;
}
if(pDwm->IsDwmCompositionEnabled() && !(dwFlags&ASC_NO_FRAME_EXTENSION))
{
///
/// we do not evaluate the return value of pDwm->DwmExtendFrameIntoClientArea, because
/// if composition is turned off in the tiny little race condition after the previous call
/// to IsDwmCompositionEnabled and before the following call to DwmExtendFrameIntoClientArea,
/// we would see DwmExtendFrameIntoClientArea fail. However, if composition is turned on again
/// aterwards, the UI can display composition again without problems:
///
pDwm->DwmExtendFrameIntoClientArea(hWnd, &marGlassInset);
}
hRes = pUxTheme->BufferedPaintInit();
if(FAILED(hRes))
{
dwLastError = hRes;
goto CLEANUP;
}
bBufferedPaintInitialized = true;
if(!SetProp(hWnd, WINDOW_DATA_STRING, pWndData))
{
dwLastError = hRes;
goto CLEANUP;
}
errParentAeroData.m_pdwError = &dwLastError;
errParentAeroData.m_pWndParentAeroData = pWndData;
pWndData->m_pDwmApiImpl = pDwm;
pWndData->m_pUxTheme = pUxTheme;
pWndData->m_uiRedrawMsg = uiRedrawMsg;
if(dwFlags&ASC_NO_FRAME_EXTENSION)
//.........这里部分代码省略.........
示例13: WndProc
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
PAERO_SUBCLASS_WND_DATA pWndData = (PAERO_SUBCLASS_WND_DATA)GetProp(hWnd, WINDOW_DATA_STRING);
ASSERT(pWndData);
ASSERT(pWndData->m_pDwmApiImpl);
WNDPROC pOldProc = pWndData->m_oldWndProc;
ASSERT(pOldProc);
BOOL bCompositionEnabled = pWndData->m_pDwmApiImpl->IsDwmCompositionEnabled();
///
/// if aero glass is turned off and if we are not in destruction code,
/// just call the original wnd proc we had prior to subclassing:
///
if(WM_COMMAND!=uMsg && WM_DWMCOMPOSITIONCHANGED!=uMsg && WM_DESTROY!=uMsg && WM_NCDESTROY!=uMsg && !bCompositionEnabled)
return CallWindowProc(pOldProc, hWnd, uMsg, wParam, lParam);
if (uMsg == pWndData->m_uiRedrawMsg)
{
HWND hControl = (HWND)lParam;
ASSERT(hControl);
ASSERT(::IsWindow(hControl));
PAERO_SUBCLASS_WND_DATA pCtrlData = (PAERO_SUBCLASS_WND_DATA)GetProp(hControl, WINDOW_DATA_STRING);
if(pCtrlData && pCtrlData->m_dwFlags & WD_IN_PAINT_CONTROL)
{
HDC hdc = GetDC(hControl);
if(hdc)
{
RECT rc;
VERIFY(GetWindowRect(hControl, &rc));
VERIFY(MapWindowPoints(NULL, hControl, (LPPOINT) &rc, 2));
PaintControl(hControl, hdc, &rc, (pCtrlData->m_dwFlags & WD_DRAW_BORDER)!=0);
VERIFY(1==ReleaseDC(hControl, hdc));
}
pCtrlData->m_dwFlags &= ~WD_IN_PAINT_CONTROL;
return 0;
}
}
switch(uMsg)
{
case WM_CTLCOLORSTATIC:
{
HWND hControl = (HWND)lParam;
ASSERT(hControl);
ASSERT(IsWindow(hControl));
PAERO_SUBCLASS_WND_DATA pCtrlData = (PAERO_SUBCLASS_WND_DATA)GetProp(hControl, WINDOW_DATA_STRING);
if(pCtrlData)
{
if(pCtrlData->m_dwFlags&WD_RETURN_BLACK_BRUSH)
return (LRESULT)GetStockObject(BLACK_BRUSH);
else if(pCtrlData->m_dwFlags&WD_RETURN_WHITE_BRUSH)
return (LRESULT)GetStockObject(WHITE_BRUSH);
else
{
pCtrlData->m_dwFlags|=WD_IN_PAINT_CONTROL;
PostMessage((HWND)lParam, pWndData->m_uiRedrawMsg, 0, NULL);
}
}
}
break;
case WM_CTLCOLOREDIT:
{
PAERO_SUBCLASS_WND_DATA pCtrlData = (PAERO_SUBCLASS_WND_DATA)GetProp((HWND)lParam, WINDOW_DATA_STRING);
if(pCtrlData)
pCtrlData->m_dwFlags|=WD_IN_PAINT_CONTROL;
PostMessage((HWND)lParam, pWndData->m_uiRedrawMsg, 0, NULL);
}
break;
case WM_PAINT:
{
if(!IsIconic(hWnd) && !(pWndData->m_dwFlags&WD_NO_FRAME_EXTEND))
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
///
/// we have to paint the *entire* client area in black, not only the
/// paint area inside ps, because otherwise we get ugly areas of white
/// if we partially move the window out of the desktop and back in again:
///
///
MARGINS marGlassInset = {-1, -1, -1, -1}; // -1 means the whole window
if(hdc && pWndData->m_pDwmApiImpl->IsDwmCompositionEnabled()
&& SUCCEEDED(pWndData->m_pDwmApiImpl->DwmExtendFrameIntoClientArea(hWnd, &marGlassInset)))
{
RECT rcClient;
VERIFY(GetClientRect(hWnd, &rcClient));
VERIFY(PatBlt(hdc, 0, 0, RECTWIDTH(rcClient), RECTHEIGHT(rcClient), BLACKNESS));
}
EndPaint(hWnd, &ps);
//.........这里部分代码省略.........
示例14: mswin_display_RIP_window
void
mswin_display_RIP_window(HWND hWnd)
{
MSG msg;
RECT rt;
PNHRIPWindow data;
HWND mapWnd;
RECT riprt;
RECT clientrect;
RECT textrect;
HFONT OldFont;
MonitorInfo monitorInfo;
win10_monitor_info(hWnd, &monitorInfo);
data = (PNHRIPWindow) GetWindowLongPtr(hWnd, GWLP_USERDATA);
data->x = (int)(RIP_OFFSET_X * monitorInfo.scale);
data->y = (int)(RIP_OFFSET_Y * monitorInfo.scale);
data->width = (int)(RIP_WIDTH * monitorInfo.scale);
data->height = (int)(RIP_HEIGHT * monitorInfo.scale);
data->graveX = (int)(RIP_GRAVE_X * monitorInfo.scale);
data->graveY = (int)(RIP_GRAVE_Y * monitorInfo.scale);
data->graveWidth = (int)(RIP_GRAVE_WIDTH * monitorInfo.scale);
data->graveHeight = (int)(RIP_GRAVE_HEIGHT * monitorInfo.scale);
GetNHApp()->hPopupWnd = hWnd;
mapWnd = mswin_hwnd_from_winid(WIN_MAP);
if (!IsWindow(mapWnd))
mapWnd = GetNHApp()->hMainWnd;
GetWindowRect(mapWnd, &rt);
GetWindowRect(hWnd, &riprt);
GetClientRect(hWnd, &clientrect);
textrect = clientrect;
textrect.top += data->y;
textrect.left += data->x;
textrect.right -= data->x;
if (data->window_text) {
HDC hdc = GetDC(hWnd);
OldFont = SelectObject(hdc, mswin_get_font(NHW_TEXT, 0, hdc, FALSE)->hFont);
DrawText(hdc, data->window_text, strlen(data->window_text), &textrect,
DT_LEFT | DT_NOPREFIX | DT_CALCRECT);
SelectObject(hdc, OldFont);
ReleaseDC(hWnd, hdc);
}
if (textrect.right - textrect.left > data->width)
clientrect.right = textrect.right + data->y - clientrect.right;
else
clientrect.right =
textrect.left + 2 * data->x + data->width - clientrect.right;
clientrect.bottom =
textrect.bottom + data->height + data->y - clientrect.bottom;
GetWindowRect(GetDlgItem(hWnd, IDOK), &textrect);
textrect.right -= textrect.left;
textrect.bottom -= textrect.top;
clientrect.bottom += textrect.bottom + data->y;
riprt.right -= riprt.left;
riprt.bottom -= riprt.top;
riprt.right += clientrect.right;
riprt.bottom += clientrect.bottom;
rt.left += (rt.right - rt.left - riprt.right) / 2;
rt.top += (rt.bottom - rt.top - riprt.bottom) / 2;
MoveWindow(hWnd, rt.left, rt.top, riprt.right, riprt.bottom, TRUE);
GetClientRect(hWnd, &clientrect);
MoveWindow(GetDlgItem(hWnd, IDOK),
(clientrect.right - clientrect.left - textrect.right) / 2,
clientrect.bottom - textrect.bottom - data->y,
textrect.right, textrect.bottom, TRUE);
ShowWindow(hWnd, SW_SHOW);
while (IsWindow(hWnd) && GetMessage(&msg, NULL, 0, 0) != 0) {
if (!IsDialogMessage(hWnd, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
GetNHApp()->hPopupWnd = NULL;
}
示例15:
/**
* name: ~CProgress
* class: CProgress
* desc: destroy the progress dialog and its data structure
* params: none
* return: nothing
**/
CProgress::~CProgress()
{
if(IsWindow(_hDlg)) DestroyWindow(_hDlg);
}