void Explorerplusplus::CreateFolderControls(void) { TCHAR szTemp[32]; UINT uStyle = WS_CHILD|WS_CLIPSIBLINGS|WS_CLIPCHILDREN; if(m_bShowFolders) uStyle |= WS_VISIBLE; LoadString(m_hLanguageModule,IDS_FOLDERS_WINDOW_TEXT,szTemp,SIZEOF_ARRAY(szTemp)); m_hHolder = CreateHolderWindow(m_hContainer,szTemp,uStyle); SetWindowSubclass(m_hHolder,TreeViewHolderProcStub,0,(DWORD_PTR)this); m_hTreeView = CreateTreeView(m_hHolder,WS_CHILD|WS_VISIBLE|TVS_SHOWSELALWAYS| TVS_HASBUTTONS|TVS_EDITLABELS|TVS_HASLINES|TVS_TRACKSELECT); SetWindowTheme(m_hTreeView,L"Explorer",NULL); SetWindowLongPtr(m_hTreeView,GWL_EXSTYLE,WS_EX_CLIENTEDGE); m_pMyTreeView = new CMyTreeView(m_hTreeView,m_hContainer,m_pDirMon,m_hTreeViewIconThread); /* Now, subclass the treeview again. This is needed for messages such as WM_MOUSEWHEEL, which need to be intercepted before they reach the window procedure provided by CMyTreeView. */ SetWindowSubclass(m_hTreeView,TreeViewSubclassStub,1,(DWORD_PTR)this); LoadString(m_hLanguageModule,IDS_HIDEFOLDERSPANE,szTemp,SIZEOF_ARRAY(szTemp)); m_hFoldersToolbar = CreateTabToolbar(m_hHolder,FOLDERS_TOOLBAR_CLOSE,szTemp); }
bool AeroControlBase::SubclassControl(HWND hControl) { bool bRet = false; if (!(DWORD)m_regEnableDWMFrame) return bRet; TCHAR szWndClassName[MAX_PATH] = { 0 }; if (GetClassName(hControl, szWndClassName, _countof(szWndClassName))) { if (!wcscmp(szWndClassName, L"Static")) { bRet = !!SetWindowSubclass(hControl, SubclassProc, Static, (DWORD_PTR)this); subclassedControls[hControl] = Static; } if (!wcscmp(szWndClassName, L"Button")) { bRet = !!SetWindowSubclass(hControl, SubclassProc, Button, (DWORD_PTR)this); subclassedControls[hControl] = Button; } if(!wcscmp(szWndClassName, L"msctls_progress32")) { bRet = !!SetWindowSubclass(hControl, SubclassProc, Progressbar, (DWORD_PTR)this); subclassedControls[hControl] = Progressbar; } } return bRet; }
static void Subclass(TreeCtrl* w) { BOOL ok = SetWindowSubclass(w->hwnd, TreeProc, SUBCLASS_ID, (DWORD_PTR)w); CrashIf(!ok); w->hwndSubclassId = SUBCLASS_ID; ok = SetWindowSubclass(w->parent, TreeParentProc, SUBCLASS_ID, (DWORD_PTR)w); CrashIf(!ok); w->hwndParentSubclassId = SUBCLASS_ID; }
HRESULT CALLBACK TaskDialogBootstrapCallback( _In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam, _In_ LONG_PTR dwRefData ) { PPH_SETUP_CONTEXT context = (PPH_SETUP_CONTEXT)dwRefData; switch (uMsg) { case TDN_CREATED: { context->DialogHandle = hwndDlg; // Center the window on the desktop. PhCenterWindow(hwndDlg, NULL); // Create the Taskdialog icons. TaskDialogCreateIcons(context); // Subclass the Taskdialog. SetWindowSubclass(hwndDlg, TaskDialogSubclassProc, 0, (ULONG_PTR)context); // Navigate to the first page. SetupShowUpdatingDialog(context); SendMessage(hwndDlg, WM_TASKDIALOGINIT, 0, 0); } break; } return S_OK; }
BOOL CALLBACK PropSheetProc(HWND hwnd, UINT msg, LPARAM lParam) { if (msg == PSCB_PRECREATE) { DLGTEMPLATE *pDlgTemplate = (DLGTEMPLATE*) lParam; pDlgTemplate->style |= WS_THICKFRAME; } else if (msg == PSCB_INITIALIZED) { g_cfgwnd = hwnd; SetWindowSubclass(g_cfgwnd, PropSheetWinProc, 0, 0); UpdateStrings(); // Set new icon specifically for the taskbar and Alt+Tab, without changing window icon HICON taskbar_icon = LoadImage(g_hinst, L"taskbar_icon", IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR); SendMessage(g_cfgwnd, WM_SETICON, ICON_BIG, (LPARAM)taskbar_icon); // OK button replaces Cancel button SendMessage(g_cfgwnd, PSM_CANCELTOCLOSE, 0, 0); HWND cancel = GetDlgItem(g_cfgwnd, IDCANCEL); HWND ok = GetDlgItem(g_cfgwnd, IDOK); Button_Enable(cancel, TRUE); // Re-enable to enable escape key WINDOWPLACEMENT wndpl = { sizeof(WINDOWPLACEMENT) }; GetWindowPlacement(cancel, &wndpl); SetWindowPlacement(ok, &wndpl); ShowWindow(cancel, SW_HIDE); HWND apply = GetDlgItem(g_cfgwnd, IDAPPLY); Button_SetText(apply, L""); // Remove text to remove it's shortcut (Alt+A in English) } }
void Explorerplusplus::InitializeTabs(void) { /* The tab backing will hold the tab window. */ CreateTabBacking(); if(m_bForceSameTabWidth) { TabCtrlStyles |= TCS_FIXEDWIDTH; } m_hTabCtrl = CreateTabControl(m_hTabBacking,TabCtrlStyles); /* TODO: The image list is been leaked. */ HIMAGELIST himlSmall = ImageList_Create(16,16,ILC_COLOR32|ILC_MASK,0,100); AddDefaultTabIcons(himlSmall); TabCtrl_SetImageList(m_hTabCtrl,himlSmall); /* TODO: Needs to be freed when closing. */ m_pTabContainer = new CTabContainer(m_hTabCtrl,m_pShellBrowser,this); CTabDropHandler *pTabDropHandler = new CTabDropHandler(m_hTabCtrl,m_pTabContainer); RegisterDragDrop(m_hTabCtrl,pTabDropHandler); pTabDropHandler->Release(); SetWindowSubclass(m_hTabCtrl,TabSubclassProcStub,0,reinterpret_cast<DWORD_PTR>(this)); /* Create the toolbar that will appear on the tab control. Only contains the close button used to close tabs. */ TCHAR szTabCloseTip[64]; LoadString(m_hLanguageModule,IDS_TAB_CLOSE_TIP,szTabCloseTip,SIZEOF_ARRAY(szTabCloseTip)); m_hTabWindowToolbar = CreateTabToolbar(m_hTabBacking,TABTOOLBAR_CLOSE,szTabCloseTip); }
VOID PhCreateSearchControl( _In_ HWND Parent, _In_ HWND WindowHandle, _In_opt_ PWSTR BannerText ) { PEDIT_CONTEXT context; context = (PEDIT_CONTEXT)PhAllocate(sizeof(EDIT_CONTEXT)); memset(context, 0, sizeof(EDIT_CONTEXT)); context->WindowHandle = WindowHandle; //PhpSearchInitializeTheme(context); PhpSearchInitializeImages(context); // Set initial text if (BannerText) Edit_SetCueBannerText(context->WindowHandle, BannerText); // Subclass the Edit control window procedure. SetWindowSubclass(context->WindowHandle, PhpSearchWndSubclassProc, 0, (ULONG_PTR)context); // Initialize the theme parameters. SendMessage(context->WindowHandle, WM_THEMECHANGED, 0, 0); }
void CWindowsWin32Window::_InitWindow(HINSTANCE hInst, IConfigObject const * cfg) { //_rect stores the dimensions of the client area of the window. _rect.SetX(static_cast<s16>(cfg->GetProperty("dims.x", s64{}))); _rect.SetY(static_cast<s16>(cfg->GetProperty("dims.y", s64{}))); _rect.SetWidth(static_cast<u16>(cfg->GetProperty("dims.width", s64{ 640 }))); _rect.SetHeight(static_cast<u16>(cfg->GetProperty("dims.height", s64{ 480 }))); //Need to adjust for non-client area of window for CreateWindow. RECT&& adj = _GetAdjustedRect(_rect); //convert the title to a wchar_t string std::wstring wtitle{}; _title = cfg->GetProperty("title", ""); atow(_title, wtitle); _win = CreateWindowExW(WS_EX_OVERLAPPEDWINDOW, //will either want this or options for fullscreen L"InsanityWindowClass", //Constant wtitle.c_str(), //Good candidate for Config file WS_OVERLAPPEDWINDOW, //as dwExStyle adj.left, adj.top, adj.right - adj.left, adj.bottom - adj.top, //Dimensions are another good candidate HWND_DESKTOP, //If in Config file, would need a way to specify another window NULL, //Menu can be assigned later hInst, //Constant nullptr); //Constant (unused) SetWindowSubclass(_win, WindowProc, 0, reinterpret_cast<DWORD_PTR>(this)); ShowWindow(_win, SW_SHOWDEFAULT); }
HRESULT CALLBACK TaskDialogBootstrapCallback( _In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam, _In_ LONG_PTR dwRefData ) { PPH_UPDATER_CONTEXT context = (PPH_UPDATER_CONTEXT)dwRefData; switch (uMsg) { case TDN_CREATED: { UpdateDialogHandle = context->DialogHandle = hwndDlg; // Center the update window on PH if it's visible else we center on the desktop. PhCenterWindow(hwndDlg, (IsWindowVisible(PhMainWndHandle) && !IsMinimized(PhMainWndHandle)) ? PhMainWndHandle : NULL); // Create the Taskdialog icons TaskDialogCreateIcons(context); // Subclass the Taskdialog SetWindowSubclass(hwndDlg, TaskDialogSubclassProc, 0, (ULONG_PTR)context); if (context->StartupCheck) ShowAvailableDialog(context); else ShowCheckForUpdatesDialog(context); } break; } return S_OK; }
static VOID NTAPI MainWindowShowingCallback( _In_opt_ PVOID Parameter, _In_opt_ PVOID Context ) { SetWindowSubclass(PhMainWndHandle, MainWndSubclassProc, 0, 0); }
void CManageBookmarksDialog::SetupSearchField() { HWND hEdit = GetDlgItem(m_hDlg,IDC_MANAGEBOOKMARKS_EDITSEARCH); SetWindowSubclass(hEdit,NManageBookmarksDialog::EditSearchProcStub, 0,reinterpret_cast<DWORD_PTR>(this)); SetSearchFieldDefaultState(); }
void CommonAPI::Init(HookWrapper* h) { hook = h; exePath = GetExecutablePath(); // Init logging FILE* logFile = fopen("touchenabler.log", "w"); Output2FILE::Stream() = logFile; // Init AS InitAS(); // Init Vjoy //InitVjoy(); // Init Input InitInput(); //InitTouch(); if (!SetWindowSubclass(hook->windowHandle, &WindowProcSubclass, 0, 0)) { FILE_LOG(logERROR) << "Unable to subclass HWND."; } CallScriptFunction("void OnLoad()"); }
void CContainer::CreateTabBacking(void) { m_hTabBacking = CreateWindow(WC_STATIC,EMPTY_STRING, WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SS_NOTIFY, 0,0,0,0,m_hContainer,NULL,GetModuleHandle(0),NULL); SetWindowSubclass(m_hTabBacking,TabBackingProcStub,0,(DWORD_PTR)this); }
/*-------------------------------------------------- subclassify "BaseBar" (Start Menu of IE 4 or later) ----------------------------------------------------*/ void SubclassBaseBar(void) { HWND hwnd, hwndChild; HWND hwndFound; char classname[80]; m_hwndBaseBar = NULL; if(m_hwndDV2ContHost) return; if(!m_bSubclass) return; // search hwnd = GetDesktopWindow(); hwnd = GetWindow(hwnd, GW_CHILD); hwndFound = NULL; while(hwnd) { GetClassName(hwnd, classname, 80); if(strcmp(classname, "BaseBar") == 0) { if(GetWindowThreadProcessId(hwnd, NULL) == GetCurrentThreadId()) { POINT ptParent = { 0, 0 }; RECT rcWinChild; hwndChild = GetWindow(hwnd, GW_CHILD); ClientToScreen(hwnd, &ptParent); GetWindowRect(hwndChild, &rcWinChild); if(rcWinChild.left - ptParent.x == 21) { hwndFound = hwnd; break; } else if(rcWinChild.right - rcWinChild.left == 0) { if(hwndFound == NULL || (int)hwndFound > (int)hwnd) hwndFound = hwnd; } } } hwnd = GetWindow(hwnd, GW_HWNDNEXT); } m_hwndBaseBar = hwndFound; /*{ char s[80]; wsprintf(s, "%X", m_hwndBaseBar); WriteDebug(s); }*/ if(m_hwndBaseBar == NULL) return; // if(IsSubclassed(m_hwndBaseBar)) return; m_bBaseBarSubclassed = SetWindowSubclass(m_hwndBaseBar, SubclassProcBaseBar, 0, 0); }
void NewTerrainWindow::init(HINSTANCE hInstance, HWND hParentWnd, const SubwindowDesc subwindowDesc) { initWindow(hInstance, hParentWnd, subwindowDesc, WS_POPUP | WS_CAPTION | WS_CHILD, 2 * (m_dropdownListWidth + m_itemMargin) + m_itemMargin, m_itemMargin, 7001); SetWindowSubclass(m_hWnd, newTerrainWindowMsgRouter, 0, 0); }
bool CreateEditCtrl(EditCtrl *w) { // Note: has to remember this here because when I GetWindowStyle() later on, // WS_BORDER is not set, which is a mystery, because it is being drawn. // also, WS_BORDER seems to be painted in client areay w->hasBorder = bit::IsMaskSet<DWORD>(w->dwStyle, WS_BORDER); RECT rc = w->initialPos; w->hwnd = CreateWindowExW(w->dwExStyle, WC_EDIT, L"", w->dwStyle, rc.left, rc.top, RectDx(rc), RectDy(rc), w->parent, nullptr, GetModuleHandleW(nullptr), nullptr); if (!w->hwnd) { return false; } SetFont(w, GetDefaultGuiFont()); SetWindowSubclass(w->hwnd, EditProc, 0, (DWORD_PTR)w); SetWindowSubclass(GetParent(w->hwnd), EditParentProc, 0, (DWORD_PTR)w); return true; }
void IEToolbar::subclassWindow(const HWND window) { const UINT_PTR subclassId = UINT_PTR(this); const DWORD refData = DWORD(this); const BOOL subclassingResult = SetWindowSubclass(window, subclassProcThunk, subclassId, refData); if (FALSE == subclassingResult) { throw Error("Failed to subclass site window\n"); } }
void DirectionalLightOptions::init(HINSTANCE hInstance, HWND hParentWnd, const SubwindowDesc subwindowDesc) { initWindow(hInstance, hParentWnd, subwindowDesc, WS_POPUP | WS_CAPTION | WS_CHILD, m_trackbarSize.x + 2 * m_trackbarMargin, m_trackbarMargin, 6001); SetWindowSubclass(m_hWnd, DirectionalLightOptionsMsgRouter, 0, 0); }
void TextureToolWindow::init(HINSTANCE hInstance, HWND hParentWnd, const SubwindowDesc subwindowDesc) { initWindow(hInstance, hParentWnd, subwindowDesc, WS_POPUP | WS_CAPTION | WS_CHILD, m_textureButtonsPerRow * (m_textureButtonSize + m_itemMargin) + m_itemMargin, m_itemMargin, 4001); SetWindowSubclass(m_hWnd, textureToolWindowMsgRouter, 0, 0); m_trackbarCount = 0; }
/*********************************************************************** * MakeDragList (COMCTL32.13) * * Makes a normal ListBox into a DragList by subclassing it. * * RETURNS * Success: Non-zero * Failure: Zero */ BOOL WINAPI MakeDragList (HWND hwndLB) { DRAGLISTDATA *data = Alloc(sizeof(DRAGLISTDATA)); TRACE("(%p)\n", hwndLB); if (!uDragListMessage) uDragListMessage = RegisterWindowMessageW(DRAGLISTMSGSTRINGW); return SetWindowSubclass(hwndLB, DragList_SubclassWindowProc, DRAGLIST_SUBCLASSID, (DWORD_PTR)data); }
void subclass_install(HWND hwnd) { DWORD_PTR state = 0; if(GetWindowSubclass(hwnd, fproc, 0, &state) && state) return; if(state = (DWORD_PTR)malloc(sizeof(STATE))) { memset((void*)state, 0, sizeof(STATE)); _log_("subclass_install: thread = %d, hwnd = %08X", GetCurrentThreadId(), hwnd); if(!SetWindowSubclass(hwnd, fproc, 0, state)) free((void*)state); } }
void UninstallerShortcutsListbox::connect(HWND hwndParent, HWND hwndListbox) { if (m_listbox == 0) { m_dialogbox = hwndParent; m_listbox = hwndListbox; m_tooltip.init(hwndParent, hwndListbox); SetWindowSubclass(hwndListbox, listboxSubclassProc, 0, (DWORD_PTR) this); SetWindowSubclass(hwndListbox, GdiUtils::subclassProcForListboxWithEmptyText, 0, (DWORD_PTR) m_emptyText); RegisterDragDrop(hwndListbox, this); try { append(ShortcutsDisconnector::findShortcuts()); } catch (AutoSaveException& exc) { m_lastException = exc; PostMessage(m_dialogbox, LB_EXCEPTIONTHROWN, 0, 0); } } }
INT_PTR CColorRuleDialog::OnInitDialog() { if(m_bEdit) { SetDlgItemText(m_hDlg,IDC_EDIT_DESCRIPTION,m_pColorRule->strDescription.c_str()); SetDlgItemText(m_hDlg,IDC_EDIT_FILENAMEPATTERN,m_pColorRule->strFilterPattern.c_str()); m_cfCurrentColor = m_pColorRule->rgbColour; if(m_pColorRule->caseInsensitive) CheckDlgButton(m_hDlg,IDC_CHECK_CASE_INSENSITIVE,BST_CHECKED); if(m_pColorRule->dwFilterAttributes & FILE_ATTRIBUTE_COMPRESSED) CheckDlgButton(m_hDlg,IDC_CHECK_COMPRESSED,BST_CHECKED); if(m_pColorRule->dwFilterAttributes & FILE_ATTRIBUTE_ENCRYPTED) CheckDlgButton(m_hDlg,IDC_CHECK_ENCRYPTED,BST_CHECKED); if(m_pColorRule->dwFilterAttributes & FILE_ATTRIBUTE_ARCHIVE) CheckDlgButton(m_hDlg,IDC_CHECK_ARCHIVE,BST_CHECKED); if(m_pColorRule->dwFilterAttributes & FILE_ATTRIBUTE_HIDDEN) CheckDlgButton(m_hDlg,IDC_CHECK_HIDDEN,BST_CHECKED); if(m_pColorRule->dwFilterAttributes & FILE_ATTRIBUTE_NOT_CONTENT_INDEXED) CheckDlgButton(m_hDlg,IDC_CHECK_INDEXED,BST_CHECKED); if(m_pColorRule->dwFilterAttributes & FILE_ATTRIBUTE_READONLY) CheckDlgButton(m_hDlg,IDC_CHECK_READONLY,BST_CHECKED); if(m_pColorRule->dwFilterAttributes & FILE_ATTRIBUTE_SYSTEM) CheckDlgButton(m_hDlg,IDC_CHECK_SYSTEM,BST_CHECKED); TCHAR szTemp[64]; LoadString(GetInstance(),IDS_EDITCOLORRULE, szTemp,SIZEOF_ARRAY(szTemp)); SetWindowText(m_hDlg,szTemp); } else { m_cfCurrentColor = m_pcrdps->m_cfInitialColor; } HWND hStaticColor = GetDlgItem(m_hDlg,IDC_STATIC_COLOR); SetWindowSubclass(hStaticColor,NColorRuleDialog::StaticColorProcStub,0,reinterpret_cast<DWORD_PTR>(this)); SendMessage(GetDlgItem(m_hDlg,IDC_EDIT_DESCRIPTION),EM_SETSEL,0,-1); SetFocus(GetDlgItem(m_hDlg,IDC_EDIT_DESCRIPTION)); m_pcrdps->RestoreDialogPosition(m_hDlg,false); return 0; }
void CreateTabbar(WindowInfo* win) { DWORD dwStyle = WS_CHILD | WS_CLIPSIBLINGS /*| WS_VISIBLE*/ | TCS_FOCUSNEVER | TCS_FIXEDWIDTH | TCS_FORCELABELLEFT; DWORD dwStyleEx = 0; auto h = GetModuleHandleW(nullptr); HWND hwndTabBar = CreateWindowExW(dwStyleEx, WC_TABCONTROL, L"", dwStyle, 0, 0, 0, 0, win->hwndFrame, (HMENU)IDC_TABBAR, h, nullptr); SetWindowSubclass(hwndTabBar, TabBarProc, 0, (DWORD_PTR)win); SetWindowSubclass(GetParent(hwndTabBar), TabBarParentProc, 0, (DWORD_PTR)win); SizeI tabSize = GetTabSize(win->hwndFrame); TabPainter* tp = new TabPainter(hwndTabBar, tabSize); SetWindowLongPtr(hwndTabBar, GWLP_USERDATA, (LONG_PTR)tp); SetWindowFont(hwndTabBar, GetDefaultGuiFont(), FALSE); TabCtrl_SetItemSize(hwndTabBar, tabSize.dx, tabSize.dy); win->hwndTabBar = hwndTabBar; win->tabSelectionHistory = new Vec<TabInfo*>(); }
RT_H RT_CALL ZzCreateLeftTab(RT_GUI_RECT* lpPosition, RT_H hMainWindow, RT_H hInstance, RT_H hFont) { TC_ITEM rtItem; RT_H hResult; hResult = CreateWindowEx(0, /* ExStyle. */ WC_TABCONTROL, /* Tab class name. */ _R("LeftTab"), /* Window name. */ WS_VISIBLE | WS_CHILD | /* Style. */ TCS_FIXEDWIDTH, lpPosition->nX, lpPosition->nY, /* Position. */ lpPosition->nWidth, lpPosition->nHeight, /* Size. */ hMainWindow, /* Parent Window. */ (HMENU)ZZ_RESOURCES_LEFT_TAB_CTRL_ID, /* Control id. */ hInstance, /* Application instance. */ RT_NULL); if (!hResult) goto handle_error; /* Cannot check errors. */ TabCtrl_SetItemSize(hResult, 60, ZZ_GUI_TAB_HEIGHT); /* Cannot check errors. */ SendMessage(hResult, WM_SETFONT, (WPARAM)hFont, TRUE); rtItem.mask = TCIF_TEXT | TCIF_PARAM; rtItem.pszText = ZzGetString(ZZ_STRINGS_CLIMBERS); rtItem.lParam = ZZ_RESOURCES_CLIMBERS; if (SendMessage(hResult, TCM_INSERTITEM, 1, (LPARAM)&rtItem) == -1) goto handle_error; rtItem.pszText = ZzGetString(ZZ_STRINGS_ROUTES); rtItem.lParam = ZZ_RESOURCES_ROUTES; if (SendMessage(hResult, TCM_INSERTITEM, 2, (LPARAM)&rtItem) == -1) goto handle_error; rtItem.pszText = ZzGetString(ZZ_STRINGS_GRADES); rtItem.lParam = ZZ_RESOURCES_GRADES; if (SendMessage(hResult, TCM_INSERTITEM, 3, (LPARAM)&rtItem) == -1) goto handle_error; if (!SetWindowSubclass(hResult, &ZzLeftTabSubclassProc, 0, 0)) goto handle_error; free_resources: return hResult; handle_error: if (hResult) { DestroyWindow(hResult); hResult = RT_NULL; } goto free_resources; }
VOID TbdInitializeDocks(PTOOLBAR_DOCKS TbDocks, HWND hWndParent, PVOID Context, PDOCKBAR_PARENTRESIZE ParentResizeProc) { DWORD rbStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_NOMOVEY | CCS_NOMOVEX | RBS_VARHEIGHT | RBS_AUTOSIZE; DOCK_POSITION Position; TbDocks->hParent = hWndParent; TbDocks->Context = Context; TbDocks->ParentResize = ParentResizeProc; for (Position = TOP_DOCK; Position < NO_DOCK; Position++) { switch (Position) { case LEFT_DOCK: case RIGHT_DOCK: rbStyle |= CCS_VERT; break; default: rbStyle &= ~CCS_VERT; break; } TbDocks->hRebar[Position] = CreateWindowEx(WS_EX_TOOLWINDOW, REBARCLASSNAME, NULL, rbStyle, 0, 0, 0, 0, TbDocks->hParent, NULL, hInstance, NULL); if (TbDocks->hRebar[Position] != NULL) { SetWindowSubclass(TbDocks->hRebar[Position], RebarSubclassProc, 1, (DWORD_PTR)TbDocks); } } }
void CBookmarksToolbar::InitializeToolbar() { SendMessage(m_hToolbar,TB_SETBITMAPSIZE,0,MAKELONG(16,16)); SendMessage(m_hToolbar,TB_BUTTONSTRUCTSIZE,sizeof(TBBUTTON),0); m_himl = ImageList_Create(16,16,ILC_COLOR32|ILC_MASK,0,48); HBITMAP hBitmap = LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_SHELLIMAGES)); ImageList_Add(m_himl,hBitmap,NULL); SendMessage(m_hToolbar,TB_SETIMAGELIST,0,reinterpret_cast<LPARAM>(m_himl)); DeleteObject(hBitmap); m_pbtdh = new CBookmarksToolbarDropHandler(m_hToolbar,m_AllBookmarks,m_guidBookmarksToolbar); RegisterDragDrop(m_hToolbar,m_pbtdh); SetWindowSubclass(m_hToolbar,BookmarksToolbarProcStub,SUBCLASS_ID,reinterpret_cast<DWORD_PTR>(this)); /* Also subclass the parent window, so that WM_COMMAND/WM_NOTIFY messages can be caught. */ SetWindowSubclass(GetParent(m_hToolbar),BookmarksToolbarParentProcStub,PARENT_SUBCLASS_ID, reinterpret_cast<DWORD_PTR>(this)); InsertBookmarkItems(); }
/*-------------------------------------------------- Subclassify "Desktop User Pane" window of XP Start Menu ----------------------------------------------------*/ void SubclassUserPaneXP(void) { if(!m_bSubclass) return; m_hwndDV2ContHost = FindWindow("DV2ControlHost", NULL); if(!m_hwndDV2ContHost) return; m_hwndUserPaneXP = FindWindowEx(m_hwndDV2ContHost, NULL, "Desktop User Pane", NULL); if(!m_hwndUserPaneXP) return; if(IsSubclassed(m_hwndUserPaneXP)) return; m_bUserPaneXPSubclassed = SetWindowSubclass(m_hwndUserPaneXP, SubclassProcUserPaneXP, 0, 0); }
// SingleRegWatcher INT_PTR CALLBACK SingleRegWatcher::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ switch(uMsg){ case WM_INITDIALOG: { // Create subclass of edit box function SetWindowSubclass(GetDlgItem(hWnd, IDC_REGVALUE), &EditSubclassProc, m_editSubclassID, NULL); } break; case WM_CLOSE: { RemoveWindowSubclass(GetDlgItem(hWnd, IDC_REGVALUE), &EditSubclassProc, m_editSubclassID); break; } case WM_ENABLE: EnableWindow(GetDlgItem(hWnd, IDC_REGVALUE), (BOOL)wParam); break; case H86_UPDATE_SYS_DATA: { Mutex sysMutex((void*)wParam); sys_state_ptr sysState=(sys_state_ptr)lParam; sysMutex.Lock(); nsEmulator::Emulator* e=nsEmulator::Emulator::GetInstance(); uint16 val=e->ReadReg(m_regNum); wchar_t data[5]; _itow((uint32)val, data, 16); SetDlgItemText(hWnd, IDC_REGVALUE, data); sysMutex.Unlock(); } break; case H86_USER_INPUT: { sys_state_ptr sysState=(sys_state_ptr)lParam; nsEmulator::Emulator* e=nsEmulator::Emulator::GetInstance(); wchar_t data[5]; GetDlgItemText(hWnd, IDC_REGVALUE, data, 5); uint16 val=wcstol(data, NULL, 16); e->WriteReg(m_regNum, val); } break; default: return 0; } return 0; }
RichEdit::RichEdit(HWND hControl) : wtwUpdate::ui::Control(hControl) { if (!hControl) return; memset(&_defaultCf, 0, sizeof(CHARFORMAT)); #ifndef MY_RICHEDIT_NO_OLE _pRichEditOle = NULL; SendMessage(getHwnd(), EM_GETOLEINTERFACE, 0, reinterpret_cast<LPARAM>(&_pRichEditOle)); #endif SendMessage(getHwnd(), EM_AUTOURLDETECT, TRUE, 0); LRESULT mask = SendMessage(getHwnd(), EM_GETEVENTMASK, 0, 0); SendMessage(getHwnd(), EM_SETEVENTMASK, 0, mask | ENM_LINK); _defaultCf.cbSize = sizeof(CHARFORMAT); _defaultCf.dwMask = CFM_ALL; SendMessage(getHwnd(), EM_GETCHARFORMAT, SCF_DEFAULT, reinterpret_cast<LPARAM>(&_defaultCf)); _defaultCf.dwEffects = CFE_AUTOCOLOR; wcscpy_s(_defaultCf.szFaceName, 32, L"Tahoma"); SendMessage(getHwnd(), EM_SETCHARFORMAT, SCF_DEFAULT, reinterpret_cast<LPARAM>(&_defaultCf)); SetWindowSubclass(getHwnd(), RichEdit::WndProc, 0, reinterpret_cast<DWORD_PTR>(this)); SetWindowSubclass(GetParent(getHwnd()), RichEdit::ParentWndProc, 0, reinterpret_cast<DWORD_PTR>(this)); HideCaret(getHwnd()); _scrolledDown = true; }