BOOL CWnd::SubclassDlgItem(UINT nID, CWnd* pParent) { ASSERT(pParent != NULL); ASSERT(::IsWindow(pParent->m_hWnd)); // check for normal dialog control first HWND hWndControl = ::GetDlgItem(pParent->m_hWnd, nID); if (hWndControl != NULL) return SubclassWindow(hWndControl); #ifndef _AFX_NO_OCC_SUPPORT if (pParent->m_pCtrlCont != NULL) { // normal dialog control not found COleControlSite* pSite = pParent->m_pCtrlCont->FindItem(nID); if (pSite != NULL) { ASSERT(pSite->m_hWnd != NULL); VERIFY(SubclassWindow(pSite->m_hWnd)); #ifndef _AFX_NO_OCC_SUPPORT // If the control has reparented itself (e.g., invisible control), // make sure that the CWnd gets properly wired to its control site. if (pParent->m_hWnd != ::GetParent(pSite->m_hWnd)) AttachControlSite(pParent); #endif //!_AFX_NO_OCC_SUPPORT return TRUE; } } #endif return FALSE; // control not found }
BOOL CTrayIconHooker::Init(CTrayNotifyIcon* pTrayIcon, CWindow* pNotifyWnd) #endif { //Validate our parameters ATLASSERT(pTrayIcon); //must have a valid tray notify instance #ifdef _AFX ATLASSERT(pNotifyWnd && ::IsWindow(pNotifyWnd->GetSafeHwnd())); #else ATLASSERT(pNotifyWnd && pNotifyWnd->IsWindow()); #endif //Hive away the input parameter m_pTrayIcon = pTrayIcon; //Hook the top level frame of the notify window in preference //to the notify window itself. This will ensure that we get //the taskbar created message #ifdef _AFX CWnd* pTopLevelWnd = pNotifyWnd->GetTopLevelFrame(); if (pTopLevelWnd) return SubclassWindow(pTopLevelWnd->operator HWND()); else return SubclassWindow(pNotifyWnd->GetSafeHwnd()); #else CWindow TopLevelWnd = pNotifyWnd->GetTopLevelWindow(); if (TopLevelWnd.IsWindow()) return SubclassWindow(TopLevelWnd.operator HWND()); else return SubclassWindow(pNotifyWnd->m_hWnd); #endif }
STDMETHODIMP CUpgradrToolbar::SetSite(IUnknown *pUnknownSite) { DT(TRACE_I(FS(_T("Toolbar[%08X]: SetSite(%08X)"), this, pUnknownSite))); try { if (!!pUnknownSite) { // attach the window HWND hMyWindow; CComPtr<IUnknown> site(pUnknownSite); CComQIPtr<IOleWindow> window(site); window->GetWindow(&hMyWindow); if (!hMyWindow) { TRACE_E(FS(_T("Toolbar[%08X]: Cannot retrieve toolbar base window"), this)); return E_FAIL; } SubclassWindow(hMyWindow); // get a WebBrowser reference CComQIPtr<IServiceProvider> serviceProvider(site); serviceProvider->QueryService(IID_IWebBrowserApp, IID_IWebBrowser2, (void**)&m_spWebBrowser); site->QueryInterface(IID_IInputObjectSite, (void**)&m_spSite); // create main window CreateMainWindow(); } } catch (CUpgradrRuntimeError &ex) { HandleError(ex.ErrorMessage()); return E_FAIL; } return S_OK; }
BOOL CGetFilenameControl::SubclassEdit(HWND hEdit) { //test our inputs ASSERT(this); if (!IsWindow(hEdit)) { ASSERT(FALSE); TRACE0("CGetFilenameControl::SubclassEdit -- window handle is invalid!\n"); return FALSE; } //subclass the control if (SubclassWindow(hEdit)) { //This control can only be used with a read only edit control LONG lStyle = GetWindowLong(GetSafeHwnd(), GWL_STYLE); if (!(lStyle & ES_READONLY)) { TRACE0("CGetFilenameControl::SubclassEdit -- ES_READONLY style should be set for the edit control\n"); ASSERT(FALSE); return FALSE; } return AddEditButton(); } else { TRACE0("CGetFilenameControl::SubclassEdit -- Could not subclass edit control!\n"); ASSERT(FALSE); return FALSE; } }
void CColorCombo::InitDialog(HWND hWndCtrl, bool bDefaultColors, bool bAllowOffOption) { if (!hWndCtrl) return; SubclassWindow(hWndCtrl); AddComboToList(); long lWidth = GetDroppedWidth(); long lRet = SetDroppedWidth(dtoi(2.75 * lWidth)); // Stuff the combobox with colors // Add a place holder for the Custom option (the color picker) int nItem = AddString(""); SetItemData(nItem, CLR_NONE); if (bAllowOffOption) { nItem = AddString(""); SetItemData(nItem, CLR_DEFAULT); } if (bDefaultColors) { for (int i = 0; i < NDEFAULTCOLORS; i++) { nItem = AddString(""); SetItemData(nItem, CColorCombo::m_DefaultColors[i].Color); } } }
void CMessageLoopHook::ApplyHook ( HWND hFocusWindow ) { if ( m_HookedWindowHandle == NULL && m_HookedWindowProc == NULL ) { // Save the hooked window handle. m_HookedWindowHandle = hFocusWindow; // Subclass the window procedure. m_HookedWindowProc = SubclassWindow ( hFocusWindow, ProcessMessage ); // Enable Unicode (UTF-16) characters in WM_CHAR messages SetWindowLongW ( hFocusWindow, GWL_WNDPROC, GetWindowLong ( hFocusWindow, GWL_WNDPROC ) ); // Register window class for dummy movement window WNDCLASSEX wcDummy; wcDummy.cbSize = sizeof(WNDCLASSEX); wcDummy.style = 0; wcDummy.lpfnWndProc = ProcessDummyWindowMessage; wcDummy.cbClsExtra = 0; wcDummy.cbWndExtra = 0; wcDummy.hInstance = GetModuleHandle(NULL); wcDummy.hIcon = LoadIcon(NULL, IDI_APPLICATION); wcDummy.hCursor = LoadCursor(NULL, IDC_ARROW); wcDummy.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcDummy.lpszMenuName = NULL; wcDummy.lpszClassName = "MovementDummy"; wcDummy.hIconSm = LoadIcon(NULL, IDI_APPLICATION); RegisterClassEx(&wcDummy); } }
///////////////////////////////////////////////////////// // // CRecoOutputWnd::~CRecoOutputWnd // // Destructor. // ///////////////////////////////////////////////////////// HWND CRecoOutputWnd::Create( HWND hwndParent, UINT nID ) { if (NULL == m_hWnd) { m_hRichEdit = ::LoadLibraryW(L"Riched20.dll"); if (NULL != m_hRichEdit) { // Create a richedit control HWND hwndREdit = ::CreateWindowW(RICHEDIT_CLASSW, NULL, WS_VISIBLE | WS_CHILD | WS_BORDER | ES_SUNKEN | ES_MULTILINE | ES_READONLY, 0, 0, 1, 1, hwndParent, (HMENU)nID, _Module.GetModuleInstance(), NULL ); // Subclass it and attach to this CRecoOutputWnd object if (NULL != hwndREdit) { SubclassWindow(hwndREdit); } } } return m_hWnd; }
NPBool CPlugin::init(NPWindow* pNPWindow) { OutputDebugStringA("cplugin_init"); if(pNPWindow == NULL) return false; #ifdef XP_WIN m_hWnd = (HWND)pNPWindow->window; if(m_hWnd == NULL) return false; // subclass window so we can intercept window messages and // do our drawing to it lpOldProc = SubclassWindow(m_hWnd, (WNDPROC)PluginWinProc); // associate window with our CPlugin object so we can access // it in the window procedure SetWindowLongPtr(m_hWnd, GWLP_USERDATA, (LONG_PTR)this); #endif m_Window = pNPWindow; m_bInitialized = true; return true; }
void CPageNavigator::InitDialog(HWND hWndListCtrl, HWND hWndLabel, HWND hWndPrevButton, HWND hWndNextButton) { bool bHpUI = m_pCtp->IsHpUI(); COLORREF rgbLabelText = (bHpUI ? RGB(255,255,255) : RGB(0,0,0)); COLORREF rgbLabelBackground = (bHpUI ? RGB(147,165,182) : RGB(171,170,202)); LPCSTR pFont = (bHpUI ? "Arial" : "Verdana"); bool bBold = (bHpUI ? false : true); int iSize = (bHpUI ? 14 : 12); if (hWndListCtrl) SubclassWindow(hWndListCtrl); if (hWndLabel) { m_LabelPage.InitDialog(hWndLabel); m_LabelPage.SetTextColor(rgbLabelText); m_LabelPage.SetBackgroundColor(rgbLabelBackground); m_LabelPage.SetFontName(pFont); m_LabelPage.SetFontBold(bBold); m_LabelPage.SetFontSize(iSize); } m_hWndPrevButton = hWndPrevButton; m_hWndNextButton = hWndNextButton; }
// Arthur void CStaticBase::SetEntireStatic(LPCTSTR str, COLORREF color, UINT unHeight, LPCTSTR strFontName, HWND hParent, UINT unCtrId, UINT unAlignment, UINT unThickness) { m_Font.CreateFont(unHeight, // 글자높이 0, // 글자너비 0, // 출력각도 0, // 기준 선에서의각도 unThickness, // 글자굵기 FALSE, // Italic 적용여부 FALSE, // 밑줄적용여부 FALSE, // 취소선적용여부 DEFAULT_CHARSET, // 문자셋종류 OUT_DEFAULT_PRECIS, // 출력정밀도 CLIP_DEFAULT_PRECIS, // 클리핑정밀도 DEFAULT_QUALITY, // 출력문자품질 DEFAULT_PITCH, // 글꼴Pitch strFontName // 글꼴 ); HWND hWnd = NULL; hWnd = ::GetDlgItem(hParent, unCtrId); if (hWnd) { SubclassWindow(hWnd); m_str = str; m_clr_Text = color; m_AlignText = unAlignment; } }
static BOOL WINAPI ShowWindow_Hook(HWND hWnd, int nShow) { BOOL bReturn = g_pfnShowWindow(hWnd, nShow); // This is usually called twice, once for the RGSC window, once for // "but you play offline, so you cant upload videos to social club" // - both windows we want to have // // *most* Securom errors (e.g. no disk in drive) do not use ShowWindow? if((eSocialClubWindowState == STATE_LOGIN_WINDOW || eSocialClubWindowState == STATE_WAIT_FOR_SECOND_WINDOW)) { DWORD dwWindowProc = (DWORD)GetWindowLong(hWnd, GWL_WNDPROC); // RGSC windows seem to be always in this range (if not, above is the code that I used to see where they are) // securom windows are outside of this range (or have always been for me) - e.g. 5003 (IDA running) if(dwWindowProc >= 0xFFFF0000 && dwWindowProc < 0xFFFFFFFF) { // Save the old window proc so we can call it later oldWndProc = SubclassWindow(hWnd, ProcessMessage); // set it somewhere far far away so nobody'd see it. we need it shown tho or it'll ignore window messages. or unless that's patched in the exe SetWindowPos(hWnd, NULL, 4000, 4000, 1, 1, SWP_NOSENDCHANGING | SWP_NOREDRAW | SWP_NOSIZE | SWP_NOOWNERZORDER); // We're waiting for the cry-you-arent-logged-in-window, so make sure ProcessMessage knows that. if(eSocialClubWindowState == STATE_WAIT_FOR_SECOND_WINDOW) { eSocialClubWindowState = STATE_STFU_RGSC_I_WANNA_PLAY_OFFLINE; } } } return bReturn; }
void CharStatsInit(HWND hDlg) { int i; HWND hGraph; controls_created = False; stat_points = STAT_POINTS_INITIAL; // Initialize graph controls for (i=0; i < NUM_CHAR_STATS; i++) { hGraph = GetDlgItem(hDlg, IDC_CHAR_GRAPH1 + i); lpfnDefGraphProc = (WNDPROC) GetWindowLong(hGraph, GWL_WNDPROC); SendMessage(hGraph, GRPH_COLORSET, GRAPHCOLOR_BAR, GetColor(COLOR_BAR1)); SendMessage(hGraph, GRPH_COLORSET, GRAPHCOLOR_BKGND, GetColor(COLOR_BAR3)); SendMessage(hGraph, GRPH_COLORSET, GRAPHCOLOR_SLIDERBKGND, GetSysColor(COLOR_BTNFACE)); // CTL3D color SendMessage(hGraph, GRPH_RANGESET, stats[i].min, stats[i].max); SendMessage(hGraph, GRPH_POSSET, 0, stats[i].val); stats[i].hGraph = hGraph; SubclassWindow(hGraph, StatGraphProc); } hPoints = GetDlgItem(hDlg, IDC_POINTSLEFT); SendMessage(hPoints, GRPH_COLORSET, GRAPHCOLOR_BAR, GetColor(COLOR_BAR2)); SendMessage(hPoints, GRPH_COLORSET, GRAPHCOLOR_BKGND, GetColor(COLOR_BAR3)); SendMessage(hPoints, GRPH_RANGESET, 0, STAT_POINTS_INITIAL); controls_created = True; }
/*-------------------------------------------------- undo ----------------------------------------------------*/ void EndTrayNotify(void) { if(bFillTray && hwndTrayNotify && IsWindow(hwndTrayNotify)) { SetWindowLongPtr(hwndTrayNotify, GWL_STYLE, oldStyleTrayNotify); if(oldWndProcTrayNotify) SubclassWindow(hwndTrayNotify, oldWndProcTrayNotify); SetClassLongPtr(hwndTrayNotify, GCL_STYLE, oldClassStyleTrayNotify); InvalidateRect(hwndTrayNotify, NULL, TRUE); SendMessage(hwndToolbar, WM_SYSCOLORCHANGE, 0, 0); InvalidateRect(hwndToolbar, NULL, TRUE); } if(bFlatTray && hwndTrayNotify && IsWindow(hwndTrayNotify)) { SetWindowLongPtr(hwndTrayNotify, GWL_EXSTYLE, oldExStyleTrayNotify); SetWindowPos(hwndTrayNotify, NULL, 0, 0, 0, 0, SWP_DRAWFRAME|SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER); } hwndTrayNotify = NULL; hwndToolbar = NULL; oldWndProcTrayNotify = NULL; bFillTray = bFlatTray = bSkinTray = FALSE; }
void nsPluginInstance::shut() { // subclass it back SubclassWindow(mhWnd, lpOldProc); mhWnd = NULL; mInitialized = FALSE; }
BOOL CDFVCtrl::Create(CWnd *pParent, DWORD ctrlId, UINT nIDResource, CRuntimeClass* pDocClass, CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass, DWORD Style, DWORD StyleEx) { m_pParent = pParent; SubclassWindow(m_pParent->GetDlgItem(ctrlId)->GetSafeHwnd()); m_pDocTemplate = new CDFVDocTemplate( nIDResource, pDocClass, pFrameClass, // main SDI frame window pViewClass); m_pDocTemplate->m_pParent = pParent; CRect clientRect; GetWindowRect(clientRect); m_pParent->ScreenToClient(&clientRect); m_pDocTemplate->m_Rect = clientRect; m_pDocTemplate->m_Style = Style; m_pDocTemplate->m_StyleEx = StyleEx; m_pDocTemplate->OpenDocumentFile(NULL); return TRUE; }
SubclassedWindow::SubclassedWindow(HWND hwnd) : super(hwnd) { _orgWndProc = SubclassWindow(_hwnd, SubclassedWndProc); if (!_orgWndProc) delete this; }
BOOL CScintillaWnd::Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, HWND hParent, UINT nID,HINSTANCE hInst) { HWND hWnd=CreateWindowEx(WS_EX_CLIENTEDGE, STR_SCINTILLAWND, lpszWindowName, dwStyle,rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top, hParent,(HMENU)nID,hInst,NULL); if(!hWnd) return FALSE; SubclassWindow(hWnd); InitScintillaWnd(); return TRUE; }
/*------------------------------------------------ initialize --------------------------------------------------*/ static void OnInit(HWND hDlg) { LOGFONT logfont; char s[MAX_PATH]; HFONT hfont; hfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); if(hfont) { SendDlgItemMessage(hDlg, IDC_HELPURL, WM_SETFONT, (WPARAM)hfont, 0); SendDlgItemMessage(hDlg, IDC_LANGDLL, WM_SETFONT, (WPARAM)hfont, 0); } SendDlgItemMessage(hDlg, IDC_ABOUTICON, STM_SETIMAGE, IMAGE_ICON, (LPARAM)g_hIconTClock); hfontLink = (HFONT)SendMessage(hDlg, WM_GETFONT, 0, 0); GetObject(hfontLink, sizeof(LOGFONT), &logfont); logfont.lfUnderline = 1; hfontLink = CreateFontIndirect(&logfont); SendDlgItemMessage(hDlg, IDC_MAILTO, WM_SETFONT, (WPARAM)hfontLink, 0); SendDlgItemMessage(hDlg, IDC_HOMEPAGE, WM_SETFONT, (WPARAM)hfontLink, 0); if(hCurHand == NULL) hCurHand = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_HAND)); oldLabProc = (WNDPROC)GetWindowLongPtr(GetDlgItem(hDlg, IDC_MAILTO), GWLP_WNDPROC); SubclassWindow(GetDlgItem(hDlg, IDC_MAILTO), LabLinkProc); SubclassWindow(GetDlgItem(hDlg, IDC_HOMEPAGE), LabLinkProc); //hbrback = CreateSolidBrush(GetSysColor(COLOR_3DFACE)); GetMyRegStr("", "HelpURL", s, MAX_PATH, MyString(IDS_HELPURL)); if (!s[0]) lstrcpyn(s, MyString(IDS_HELPURL), MAX_PATH); SetDlgItemText(hDlg, IDC_HELPURL, s); GetMyRegStr("", "2chHelpURL", s, MAX_PATH, MyString(IDS_HELP2CH)); if (!s[0]) lstrcpyn(s, MyString(IDS_HELP2CH), MAX_PATH); SetDlgItemText(hDlg, IDC_HELP2CH, s); GetMyRegStr("", "LangDLL", s, MAX_PATH, ""); SetDlgItemText(hDlg, IDC_LANGDLL, s); }
//----------------------------------------------------------------------------- CWindowMinMaxSubclass::CWindowMinMaxSubclass(nsISupports *window, sbIWindowMinMaxCallback *cb) : m_prevWndProc(NULL) { m_dx = m_ix = m_dy = m_iy = 0; m_window = window; m_hwnd = NativeWindowFromNode::get(window); NS_ADDREF(cb); m_callback = cb; SubclassWindow(); } // ctor
/** * コントロールを動的サブクラス化し、CWnd オブジェクトに結び付けるためにこのメンバー関数を呼び出します * @param[in] nID コントロール ID * @param[in] pParent コントロールの親 * @retval TRUE 成功 * @retval FALSE 失敗 */ BOOL CWndProc::SubclassDlgItem(UINT nID, CWndProc* pParent) { HWND hWndControl = ::GetDlgItem(pParent->m_hWnd, nID); if (hWndControl != NULL) { return SubclassWindow(hWndControl); } return FALSE; }
void CWindowWnd::Unsubclass() { ASSERT(::IsWindow(m_hWnd)); if( !::IsWindow(m_hWnd) ) return; if( !m_bSubclassed ) return; SubclassWindow(m_hWnd, m_OldWndProc); m_OldWndProc = ::DefWindowProc; m_bSubclassed = false; }
void CCombo::InitDialog(HWND hWndCtrl) { if (!hWndCtrl) return; SubclassWindow(hWndCtrl); m_bEditable = !((GetStyle() & CBS_DROPDOWNLIST) == CBS_DROPDOWNLIST); }
NPBool nsPluginInstance::init(NPWindow* aWindow) { DBG("nsPluginInstance::init\n"); if (!aWindow) { DBG("aWindow == NULL\n"); return FALSE; } _x = aWindow->x; _y = aWindow->y; _width = aWindow->width; _height = aWindow->height; _window = (HWND) aWindow->window; // Windows DIB row stride is always a multiple of 4 bytes. _rowstride = /* 24 bits */ 3 * _width; _rowstride += _rowstride % 4; memset(&_bmpInfo, 0, sizeof(BITMAPINFOHEADER)); _bmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); _bmpInfo.bmiHeader.biWidth = _width; // Negative height means first row comes first in memory. _bmpInfo.bmiHeader.biHeight = -1 * _height; _bmpInfo.bmiHeader.biPlanes = 1; _bmpInfo.bmiHeader.biBitCount = 24; _bmpInfo.bmiHeader.biCompression = BI_RGB; _bmpInfo.bmiHeader.biSizeImage = 0; _bmpInfo.bmiHeader.biXPelsPerMeter = 0; _bmpInfo.bmiHeader.biYPelsPerMeter = 0; _bmpInfo.bmiHeader.biClrUsed = 0; _bmpInfo.bmiHeader.biClrImportant = 0; HDC hDC = GetDC(_window); _hMemDC = CreateCompatibleDC(hDC); _bmp = CreateDIBSection(_hMemDC, &_bmpInfo, DIB_RGB_COLORS, (void **) &_memaddr, 0, 0); SelectObject(_hMemDC, _bmp); DBG("aWindow->type: %s (%u)\n", (aWindow->type == NPWindowTypeWindow) ? "NPWindowTypeWindow" : (aWindow->type == NPWindowTypeDrawable) ? "NPWindowTypeDrawable" : "unknown", aWindow->type); // subclass window so we can intercept window messages and // do our drawing to it _oldWndProc = SubclassWindow(_window, (WNDPROC) PluginWinProc); // associate window with our nsPluginInstance object so we can access // it in the window procedure SetWindowLong(_window, GWL_USERDATA, (LONG) this); _initialized = TRUE; return TRUE; }
HRESULT STDMETHODCALLTYPE CBrandBand::SetSite(IUnknown* pUnkSite) { CComPtr<IBrowserService> browserService; CComPtr<IOleWindow> oleWindow; CComPtr<IServiceProvider> serviceProvider; CComPtr<IProfferService> profferService; HWND parentWindow; HWND hwnd; HRESULT hResult; fSite.Release(); if (pUnkSite == NULL) { hResult = AtlUnadvise(fSite, DIID_DWebBrowserEvents, fAdviseCookie); // TODO: revoke brand band service return S_OK; } // get window handle of parent hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &fSite)); if (FAILED_UNEXPECTEDLY(hResult)) return hResult; parentWindow = NULL; hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow)); if (SUCCEEDED(hResult)) hResult = oleWindow->GetWindow(&parentWindow); if (!::IsWindow(parentWindow)) return E_FAIL; // create worker window in parent window hwnd = SHCreateWorkerWindowW(0, parentWindow, 0, WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, NULL, 0); if (hwnd == NULL) return E_FAIL; SubclassWindow(hwnd); // take advice to watch events hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider)); if (SUCCEEDED(hResult)) { hResult = serviceProvider->QueryService( SID_SBrandBand, IID_PPV_ARG(IProfferService, &profferService)); if (SUCCEEDED(hResult)) hResult = profferService->ProfferService(SID_SBrandBand, static_cast<IServiceProvider *>(this), &fProfferCookie); hResult = serviceProvider->QueryService(SID_SShellBrowser, IID_PPV_ARG(IBrowserService, &browserService)); if (SUCCEEDED(hResult)) hResult = AtlAdvise(browserService, static_cast<IDispatch *>(this), DIID_DWebBrowserEvents, &fAdviseCookie); } // ignore any hResult errors up to here - they are nonfatal hResult = S_OK; SelectImage(); return hResult; }
void CPlugin::shut() { #ifdef XP_WIN // subclass it back SubclassWindow(m_hWnd, lpOldProc); m_hWnd = NULL; #endif m_bInitialized = FALSE; }
/** * @param hwnd - splitter window handle. */ void CSplitter::Attach(HWND hwnd) { _ASSERTE(hwnd != NULL); _ASSERTE(m_hwnd == NULL); m_hwnd = hwnd; SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)this); m_pfnOldSplitterWndProc = SubclassWindow(hwnd, SplitterWndProc); ResetSplitterPos(); InvalidateRect(hwnd, NULL, TRUE); }
static BOOL initNode( HWND hwnd, SUBCLASSING *p, WNDPROC wndProc, void *pData, SUBCLASSING *pNext ) { p->wndProc = wndProc; p->pData = pData; p->pNext = pNext; p->wndProcSaved = SubclassWindow( hwnd, wndProc ); p->ref_count = 1; return 0 != p->wndProcSaved; }
BOOL CWnd::SubclassDlgItem(UINT nID, CWnd* pParent) { ASSERT(pParent != NULL); ASSERT(pParent->m_hWnd != NULL); HWND hWndControl = ::GetDlgItem(pParent->m_hWnd, nID); if (hWndControl == NULL) return FALSE; return SubclassWindow(hWndControl); }
HWND CWindowWnd::Subclass(HWND hWnd) { ASSERT(::IsWindow(hWnd)); ASSERT(m_hWnd==NULL); m_OldWndProc = SubclassWindow(hWnd, __WndProc); if( m_OldWndProc == NULL ) return NULL; m_bSubclassed = true; m_hWnd = hWnd; return m_hWnd; }
BOOL CAviCap::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, BOOL fAutoSize) { ASSERT(!GetSafeHwnd()); if(GetSafeHwnd()) { iLastError=CAP_CREATE_DUP; return FALSE; //already connected, can't connect twice! } _autosize = fAutoSize; HWND hWnd=capCreateCaptureWindow("AviCap_Basic", dwStyle, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, pParentWnd->GetSafeHwnd(), AVICAP_WINDOW_ID); if(!hWnd) { TRACE("CAviCap Window creation failed\n"); iLastError=CAP_WINCREATION_FAILED; return FALSE; } //subclass standard window SubclassWindow(hWnd); ::SetClassLong(hWnd, GCL_STYLE, ::GetClassLong(hWnd,GCL_STYLE)|CS_DBLCLKS); #ifdef ON_CONNECT_CHECK_DRIVERLIST _getDrvList(); #endif return TRUE; }