LRESULT CMainDlg::OnShell(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { CString strDebug, strTitle; CWnd* pwnd; if(::IsWindow(HWND(lParam))) { pwnd = CWnd::FromHandle(HWND(lParam)); pwnd->GetWindowText(strTitle); } switch (wParam) { case HSHELL_WINDOWCREATED: strDebug.Format("Window[%08X] - %s created!\n", lParam, strTitle); break; case HSHELL_WINDOWDESTROYED: strDebug.Format("Window[%08X] - %s destroyed!\n", lParam, strTitle); break; case HSHELL_WINDOWACTIVATED: strDebug.Format("Window[%08X] - %s activated!\n", lParam, strTitle); break; default: strDebug.Format("%08X, %08X\n", wParam, lParam); break; } Log(strDebug); return 0; }
HRESULT TblurPage::msgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_HSCROLL: if (HWND(lParam)==GetDlgItem(m_hwnd,IDC_TBR_BLUR_STRENGTH) || HWND(lParam)==GetDlgItem(m_hwnd,IDC_TBR_BLUR_TEMPSMOOTH)) { cfgSet(IDFF_blurStrength,SendDlgItemMessage(m_hwnd,IDC_TBR_BLUR_STRENGTH ,TBM_GETPOS,0,0)); cfgSet(IDFF_tempSmooth ,SendDlgItemMessage(m_hwnd,IDC_TBR_BLUR_TEMPSMOOTH,TBM_GETPOS,0,0)); blur2dlg(); return TRUE; } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_CHB_BLUR: setInter(getCheck(IDC_CHB_BLUR)); parent->drawInter(); return TRUE; } break; } return FALSE; }
//------------------------------------------------------------------------------ #pragma argsused static void MapHDDWinM_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT CodeNotify) { switch(id) { #if defined TEST_FAT1_VOST //Проверка и восстановление FAT1 на потерянные кластеры case IDC_VOST: Vost_FAT1(); //Чистка FAT1 от потерянных кластеров break; #endif case IDOK: DestroyWindow(hwnd); break; } } //------------------------------------------------------------------------------ #pragma argsused static LRESULT CALLBACK WndProc_MapHDD_W1(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) { switch(Msg) { HANDLE_MSG(hwnd, WM_PAINT, MapHDDWin1_OnPaint); default: return DefWindowProc(hwnd, Msg, wParam, lParam); } } //------------------------------------------------------------------------------ #pragma argsused static void MapHDDWinM_OnDestroy(HWND hwnd) {
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 }
HRESULT ToffsetPage::msgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_HSCROLL: if (HWND(lParam)==GetDlgItem(m_hwnd,IDC_TBR_OFFSETY_X) || HWND(lParam)==GetDlgItem(m_hwnd,IDC_TBR_OFFSETY_Y) || HWND(lParam)==GetDlgItem(m_hwnd,IDC_TBR_OFFSETUV_X) || HWND(lParam)==GetDlgItem(m_hwnd,IDC_TBR_OFFSETUV_Y)) { cfgSet(IDFF_offsetY_X,SendDlgItemMessage(m_hwnd,IDC_TBR_OFFSETY_X ,TBM_GETPOS,0,0)); cfgSet(IDFF_offsetY_Y,SendDlgItemMessage(m_hwnd,IDC_TBR_OFFSETY_Y ,TBM_GETPOS,0,0)); cfgSet(IDFF_offsetU_X,SendDlgItemMessage(m_hwnd,IDC_TBR_OFFSETUV_X,TBM_GETPOS,0,0)); cfgSet(IDFF_offsetU_Y,SendDlgItemMessage(m_hwnd,IDC_TBR_OFFSETUV_Y,TBM_GETPOS,0,0)); cfgSet(IDFF_offsetV_X,SendDlgItemMessage(m_hwnd,IDC_TBR_OFFSETUV_X,TBM_GETPOS,0,0)); cfgSet(IDFF_offsetV_Y,SendDlgItemMessage(m_hwnd,IDC_TBR_OFFSETUV_Y,TBM_GETPOS,0,0)); offset2dlg(); return TRUE; } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_CHB_OFFSET: cfgSet(IDFF_isOffset,getCheck(IDC_CHB_OFFSET)); parent->drawInter(); return TRUE; } break; } return FALSE; }
static LRESULT CALLBACK WndProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) { switch(Msg) { case WM_CTLCOLORSTATIC: if(HWND(lParam) == hNumSel || HWND(lParam) == hSizeSel) { SetTextColor((HDC)wParam, RGB(0, 0, 200)); SetBkColor((HDC)wParam, FonLTGRAY); return (BOOL)FonBrush; } if(HWND(lParam) == hPrShift) { SetTextColor((HDC)wParam, RGB(255, 255, 255)); // SetBkColor((HDC)wParam, FonLTGRAY); SetBkColor((HDC)wParam, RGB(180,0,0)); return (BOOL)FonBrush; } if(HWND(lParam) == hSizeHDD) { SetTextColor((HDC)wParam, RGB(0, 80, 0)); SetBkColor((HDC)wParam, FonLTGRAY); return (BOOL)FonBrush; } return TRUE; HANDLE_MSG(hwnd, WM_CREATE, M_Win_OnCreate); HANDLE_MSG(hwnd, WM_CLOSE, M_Win_OnClose); HANDLE_MSG(hwnd, WM_DESTROY, M_Win_OnDestroy); // HANDLE_MSG(hwnd, WM_PAINT, Decod_OnPaint); HANDLE_MSG(hwnd, WM_COMMAND, M_Win_OnCommand); HANDLE_MSG(hwnd, WM_NOTIFY, M_Win_OnNotify); HANDLE_MSG(hwnd, WM_SIZE, M_Win_Size); //Изменение размеров окна HANDLE_MSG(hwnd, WM_WINDOWPOSCHANGING, NoPosChanged); //Изменение положения окна default: return DefWindowProc(hwnd, Msg, wParam, lParam); } }
HRESULT TpictPropPage::msgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_HSCROLL: if (HWND(lParam)==GetDlgItem(m_hwnd,IDC_TBR_LUMGAIN) || HWND(lParam)==GetDlgItem(m_hwnd,IDC_TBR_LUMOFFSET) || HWND(lParam)==GetDlgItem(m_hwnd,IDC_TBR_GAMMA)) { cfgSet(IDFF_lumGain,writeLumGain(SendDlgItemMessage(m_hwnd,IDC_TBR_LUMGAIN,TBM_GETPOS,0,0))); cfgSet(IDFF_lumOffset,writeLumOffset(SendDlgItemMessage(m_hwnd,IDC_TBR_LUMOFFSET,TBM_GETPOS,0,0))-256); cfgSet(IDFF_gammaCorrection,writeGamma(SendDlgItemMessage(m_hwnd,IDC_TBR_GAMMA,TBM_GETPOS,0,0))); return TRUE; } else if (HWND(lParam)==GetDlgItem(m_hwnd,IDC_TBR_HUE) || HWND(lParam)==GetDlgItem(m_hwnd,IDC_TBR_SATURATION)) { cfgSet(IDFF_hue,writeHue(SendDlgItemMessage(m_hwnd,IDC_TBR_HUE,TBM_GETPOS,0,0))); cfgSet(IDFF_saturation,writeSaturation(SendDlgItemMessage(m_hwnd,IDC_TBR_SATURATION,TBM_GETPOS,0,0))); return TRUE; } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_CHB_PICTPROP: setInter(getCheck(IDC_CHB_PICTPROP)); parent->drawInter(); return TRUE; } break; } return FALSE; }
bool CPasswordDialog::OnInit() { #ifdef LANG LangSetWindowText(HWND(*this), 0x02000B00); LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0])); #endif _passwordControl.Attach(GetItem(IDC_EDIT_PASSWORD)); _passwordControl.SetText(Password); _passwordControl.SetPasswordChar(TEXT('*')); return CModalDialog::OnInit(); }
bool CPasswordDialog::OnInit() { #ifdef LANG LangSetWindowText(HWND(*this), 0x02000B00); LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0])); #endif _passwordControl.Attach(GetItem(IDC_EDIT_PASSWORD)); CheckButton(IDC_CHECK_PASSWORD_SHOW, ShowPassword); SetTextSpec(); return CModalDialog::OnInit(); }
BOOL CTrayNotifyIcon::SetNotificationWnd(CWindow* pNotifyWnd) #endif { //Validate our parameters ATLASSERT(pNotifyWnd && ::IsWindow(pNotifyWnd->operator HWND())); if (!m_bCreated) return FALSE; //Call the Shell_NotifyIcon function m_pNotificationWnd = pNotifyWnd; m_NotifyIconData.hWnd = pNotifyWnd->operator HWND(); m_NotifyIconData.uFlags = 0; return Shell_NotifyIcon(NIM_MODIFY, reinterpret_cast<PNOTIFYICONDATA>(&m_NotifyIconData)); }
bool CListViewDialog::OnInit() { #ifdef LANG LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0])); #endif _listView.Attach(GetItem(IDC_LISTVIEW_LIST)); if (ReadSingleClick()) _listView.SetExtendedListViewStyle(LVS_EX_ONECLICKACTIVATE | LVS_EX_TRACKSELECT); SetText(Title); LVCOLUMN columnInfo; columnInfo.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM; columnInfo.fmt = LVCFMT_LEFT; columnInfo.iSubItem = 0; columnInfo.cx = 200; _listView.InsertColumn(0, &columnInfo); for (int i = 0; i < Strings.Size(); i++) _listView.InsertItem(i, Strings[i]); if (Strings.Size() > 0) _listView.SetItemState_FocusedSelected(0); _listView.SetColumnWidthAuto(0); StringsWereChanged = false; NormalizeSize(); return CModalDialog::OnInit(); }
LRESULT CALLBACK Interpreter::CbtFilterHook(int code, WPARAM wParam, LPARAM lParam) { // Looking for HCBT_CREATEWND, just pass others on... if (code == HCBT_CREATEWND) { //ASSERT(lParam != NULL); //LPCREATESTRUCT lpcs = ((LPCBT_CREATEWND)lParam)->lpcs; //ASSERT(lpcs != NULL); OTE* underConstruction = m_oteUnderConstruction; if (!underConstruction->isNil()) { // Nil this out as soon as possible m_oteUnderConstruction = Pointers.Nil; underConstruction->countDown(); ASSERT(wParam != NULL); // should be non-NULL HWND // set m_bDlgCreate to TRUE if it is a dialog box // (this controls what kind of subclassing is done later) //pThreadState->m_bDlgCreate = (lpcs->lpszClass == WC_DIALOG); // Pass to Smalltalk for subclassing (catch unwind failures so not thrown out) subclassWindow(underConstruction, HWND(wParam)); } } return ::CallNextHookEx(hHookOldCbtFilter, code, wParam, lParam); }
// /// Returns the callback. If the window exists, the handle of the window is returned. // uint32 TMci::GetCallback() const { if (Window) return uint32(HWND(*Window)); return 0; }
LRESULT CUIDialog::OnWindowsEnumNotify( WPARAM wparam, LPARAM ) { HWND hWnd = HWND( wparam ); // 判断是本窗口的子窗口. if ( GetSafeHwnd() == ::GetParent( hWnd ) ) { // 判断是不是menu_worker CString strClassName; ::GetClassName( hWnd, strClassName.GetBuffer( 100 ), 100 ); strClassName.ReleaseBuffer(); if ( strClassName == _T("menu_worker") ) { // 添加到menu记录中. this->m_tMenuWorkerWndList.push_back( hWnd ); if ( this->HasCmd( FS_ShowMenuBar ) ) { // 显示出来会盖住菜单,所以这里暂时不显示. // ::ShowWindow( hWnd, SW_SHOW ); } else if( this->HasCmd( FS_HideMenuBar ) ) { ::ShowWindow( hWnd, SW_HIDE ); } } } return TRUE; }
static BOOL CALLBACK Dlg_Warning(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam) { switch(Message) { case WM_INITDIALOG: CenterDlg(hDlg, -80); //Центрирование окна диалога в главном окне SetWindowText(hDlg, (Lan+36)->msg); //Вывели новый заголовок OutNameDlg(hDlg, IDC_STATICTEXT1, LPSTR(lParam)); //Усечение имени файла SetDlgItemText(hDlg, IDC_STATICTEXT2, (Lan+65)->msg); SetDlgItemText(hDlg, IDC_REWRITE, (Lan+66)->msg); SetDlgItemText(hDlg, IDC_NEW, (Lan+67)->msg); SetDlgItemText(hDlg, IDCANCEL, (Lan+68)->msg); return TRUE; case WM_CTLCOLORSTATIC: if(GetDlgCtrlID(HWND(lParam)) == IDC_STATICTEXT2) { SetTextColor((HDC)wParam, RGB(255, 0, 0)); SetBkColor((HDC)wParam, FonLTGRAY); return (BOOL)FonBrush; } return TRUE; case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_REWRITE: case IDC_NEW: case IDCANCEL: EndDialog(hDlg, LOWORD(wParam)); //Вернули один из трех кодов return TRUE; } break; } return FALSE; }
MenuBar(Component* component) : Menu(new MenuAdapter(::CreateMenu())), _component(component) { if (component != App::getInstance()) throw UserInterfaceException("Only the App component can currently have a MenuBar."); ::SetMenu(HWND(component->getAdapter()->getHandle()), HMENU(getAdapter()->getHandle())); }
/*! * Enables Blur behind on a Widget. * * \a enable tells if the blur should be enabled or not */ bool QtDWM::enableBlurBehindWindow(QWidget *widget, bool enable) { Q_UNUSED(enable); Q_ASSERT(widget); bool result = false; #ifdef Q_OS_WIN if (resolveLibs()) { DWM_BLURBEHIND bb = {0, 0, 0, 0}; HRESULT hr = S_OK; bb.fEnable = enable; bb.dwFlags = DWM_BB_ENABLE; bb.hRgnBlur = NULL; widget->setAttribute(Qt::WA_TranslucentBackground, enable); widget->setAttribute(Qt::WA_NoSystemBackground, enable); hr = pDwmEnableBlurBehindWindow(HWND(widget->winId()), &bb); if (SUCCEEDED(hr)) { result = true; windowNotifier()->addWidget(widget, new BlurBehindManager(widget, &bb)); } } #else Q_UNUSED(widget); Q_UNUSED(enable); #endif return result; }
/*! * ExtendFrameIntoClientArea. * * This controls the rendering of the frame inside the window. * Note that passing margins of -1 (the default value) will completely * remove the frame from the window. * * \note you should not call enableBlurBehindWindow before calling * this functions * * \a enable tells if the blur should be enabled or not */ bool QtDWM::extendFrameIntoClientArea(QWidget *widget, int left, int top, int right, int bottom) { Q_ASSERT(widget); bool result = false; #ifdef Q_OS_WIN if (resolveLibs()) { QLibrary dwmLib(QString::fromUtf8("dwmapi")); HRESULT hr = S_OK; MARGINS m = {left, top, right, bottom}; hr = pDwmExtendFrameIntoClientArea(HWND(widget->winId()), &m); if (SUCCEEDED(hr)) { result = true; windowNotifier()->addWidget(widget, new ExtendedFrameManager(widget, &m)); } widget->setAttribute(Qt::WA_TranslucentBackground, result); } #else Q_UNUSED(widget); Q_UNUSED(left); Q_UNUSED(top); Q_UNUSED(right); Q_UNUSED(bottom); #endif return result; }
void CFramelessWindow::setResizeable(bool resizeable) { bool visible = isVisible(); m_bResizeable = resizeable; if (m_bResizeable){ setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint); // setWindowFlag(Qt::WindowMaximizeButtonHint); //此行代码可以带回Aero效果,同时也带回了标题栏和边框,在nativeEvent()会再次去掉标题栏 // //this line will get titlebar/thick frame/Aero back, which is exactly what we want //we will get rid of titlebar and thick frame again in nativeEvent() later HWND hwnd = (HWND)this->winId(); DWORD style = ::GetWindowLong(hwnd, GWL_STYLE); ::SetWindowLong(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_THICKFRAME | WS_CAPTION); }else{ setWindowFlags(windowFlags() & ~Qt::WindowMaximizeButtonHint); // setWindowFlag(Qt::WindowMaximizeButtonHint,false); HWND hwnd = (HWND)this->winId(); DWORD style = ::GetWindowLong(hwnd, GWL_STYLE); ::SetWindowLong(hwnd, GWL_STYLE, style & ~WS_MAXIMIZEBOX & ~WS_CAPTION); } //保留一个像素的边框宽度,否则系统不会绘制边框阴影 // //we better left 1 piexl width of border untouch, so OS can draw nice shadow around it const MARGINS shadow = { 1, 1, 1, 1 }; DwmExtendFrameIntoClientArea(HWND(winId()), &shadow); setVisible(visible); }
BOOL CTDLFilterDlg::OnToolTipNotify(UINT /*id*/, NMHDR* pNMHDR, LRESULT* /*pResult*/) { // Get the tooltip structure. TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR; // Actually the idFrom holds Control's handle. UINT CtrlHandle = pNMHDR->idFrom; // Check once again that the idFrom holds handle itself. if (pTTT->uFlags & TTF_IDISHWND) { static CString sTooltip; sTooltip.Empty(); // Get the control's ID. UINT nID = ::GetDlgCtrlID( HWND( CtrlHandle )); switch( nID ) { case IDC_CATEGORYFILTERCOMBO: sTooltip = m_cbCategoryFilter.GetTooltip(); break; case IDC_ALLOCTOFILTERCOMBO: sTooltip = m_cbAllocToFilter.GetTooltip(); break; case IDC_STATUSFILTERCOMBO: sTooltip = m_cbStatusFilter.GetTooltip(); break; case IDC_ALLOCBYFILTERCOMBO: sTooltip = m_cbAllocByFilter.GetTooltip(); break; case IDC_VERSIONFILTERCOMBO: sTooltip = m_cbVersionFilter.GetTooltip(); break; case IDC_TAGFILTERCOMBO: sTooltip = m_cbTagFilter.GetTooltip(); break; case IDC_OPTIONFILTERCOMBO: sTooltip = m_cbOptions.GetTooltip(); break; } if (!sTooltip.IsEmpty()) { // Set the tooltip text. ::SendMessage(pNMHDR->hwndFrom, TTM_SETMAXTIPWIDTH, 0, 300); pTTT->lpszText = (LPTSTR)(LPCTSTR)sTooltip; return TRUE; } } // Not handled. return FALSE; }
bool CCoherentHUDViewListener::RaycastGeometry( const Vec3& origin, const Vec3& dir, float& outDist, int& outViewX, int& outViewY ) { if ( !m_pView ) { return false; } // Get the mouse position and check if it's over a solid pixel, // ignoring the input ray. POINT cursorPos; ::GetCursorPos( &cursorPos ); ::ScreenToClient( HWND( gEnv->pRenderer->GetHWND() ), &cursorPos ); // When using shared textures you should issue the query at the beginning // of the frame and fetch as late as possible for optimal performance. // Since the current state of the plugin supports only shared memory transport, // issuing a query and immediately fetching causes no performance penalty. m_pView->IssueMouseOnUIQuery( cursorPos.x / ( float )m_pView->GetWidth(), cursorPos.y / ( float )m_pView->GetHeight() ); m_pView->FetchMouseOnUIQuery(); if ( m_pView->IsMouseOnView() ) { outDist = 0; outViewX = cursorPos.x; outViewY = cursorPos.y; return true; } return false; }
bool CLangPage::OnInit() { LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0])); _langCombo.Attach(GetItem(IDC_LANG_COMBO_LANG)); UString s = NWindows::MyLoadStringW(IDS_LANG_ENGLISH) + NativeLangString(NWindows::MyLoadStringW(IDS_LANG_NATIVE)); int index = (int)_langCombo.AddString(s); _langCombo.SetItemData(index, _paths.Size()); _paths.Add(L"-"); _langCombo.SetCurSel(0); CObjectVector<CLangEx> langs; LoadLangs(langs); for (int i = 0; i < langs.Size(); i++) { const CLangEx &lang = langs[i]; UString name, nationalName; if (!lang.Lang.GetMessage(0, name)) name = lang.ShortName; if (lang.Lang.GetMessage(1, nationalName) && !nationalName.IsEmpty()) name += NativeLangString(nationalName); index = (int)_langCombo.AddString(name); _langCombo.SetItemData(index, _paths.Size()); _paths.Add(lang.ShortName); if (g_LangID.CompareNoCase(lang.ShortName) == 0) _langCombo.SetCurSel(index); } return CPropertyPage::OnInit(); }
bool CListViewDialog::OnInit() { #ifdef LANG LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0])); #endif _listView.Attach(GetItem(IDC_LISTVIEW_LIST)); SetText(Title); LVCOLUMN columnInfo; columnInfo.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM; columnInfo.fmt = LVCFMT_LEFT; columnInfo.iSubItem = 0; columnInfo.cx = 1000; _listView.InsertColumn(0, &columnInfo); for(int i = 0; i < Strings.Size(); i++) { LVITEMW item; item.mask = LVIF_TEXT; item.iItem = i; item.pszText = (LPWSTR)(LPCWSTR)Strings[i]; item.iSubItem = 0; _listView.InsertItem(&item); } if (Strings.Size() > 0) _listView.SetItemState(0, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED); StringsWereChanged = false; return CModalDialog::OnInit(); }
void TThread::Msg::send() { Msg *msg = clone(); #ifdef WIN32 /* Non viene utilizzato PostThreadMessage perche' se l'applicazione si trova in un modal loop (esempio MessageBox) oppure si sta facendo move o resize di una finestra i messaggi non giungono al message loop. http://support.microsoft.com/default.aspx?scid=KB;EN-US;q183116& */ /* BOOL rc = PostThreadMessage( getMainThreadId(), // thread identifier WM_THREAD_NOTIFICATION, // message WPARAM(msg), // first message parameter 0); // second message parameter */ PostMessage(HWND(getMainShellHandle()), WM_THREAD_NOTIFICATION, WPARAM(msg), 0); #else XClientMessageEvent clientMsg; clientMsg.type = ClientMessage; clientMsg.window = TheMainWindow; clientMsg.format = 32; clientMsg.message_type = Msg::MsgId(); clientMsg.data.l[0] = (long)msg; // Status status = XSendEvent(TheDisplay, TheMainWindow, 0, NoEventMask, (XEvent *)&clientMsg); XFlush(TheDisplay); #endif }
// Entry INT APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PTSTR ptzCmdLine, INT iCmdShow) { // Active previous instance HWND hWnd = FindWindow(STR_AppName, NULL); if (hWnd) { ShowWindow(hWnd, SW_SHOW); SetForegroundWindow(HWND(UINT_PTR(hWnd) | 0x00000001)); return 0; } // Init library CoInitializeEx(NULL, COINIT_MULTITHREADED); InitCommonControls(); #ifdef WINCE SHInitExtraControls(); #endif // Set basic information g_hInst = hInstance; g_ptzAppName = TStrGet(IDS_AppName); // Run the main window CAppWnd aw; aw.Run(ptzCmdLine, iCmdShow); // Free library CoUninitialize(); return 0; }
// // Fill the given window with all the errors // void ErrorsFill(void *hwnd) { HWND hlist = HWND(hwnd); // Add columns to listview LV_COLUMN column; column.mask = LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH; column.cx = LOG_COLUMN_WIDTH_TYPESHORT; column.pszText = ""; column.iSubItem = 0; ListView_InsertColumn(hlist, 0, &column); column.mask = LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH; column.cx = LOG_COLUMN_WIDTH_LABELNAME; column.pszText = "Class"; column.iSubItem = 1; ListView_InsertColumn(hlist, 2, &column); column.mask = LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH; column.cx = LOG_COLUMN_WIDTH_MESSAGE; column.pszText = "Message"; column.iSubItem = 2; ListView_InsertColumn(hlist, 3, &column); ListView_SetBkColor(hlist, RGB(0, 0, 0)); ListView_SetTextBkColor(hlist, RGB(0, 0, 0)); ListView_SetTextColor(hlist, RGB(191, 191, 0)); // Change the listviews font HFONT hfont; LOGFONT logfont; Utils::Memset(&logfont, 0x00, sizeof (LOGFONT)); logfont.lfHeight = -11; logfont.lfWeight = 400; logfont.lfOutPrecision = 3; logfont.lfClipPrecision = 2; logfont.lfQuality = 1; logfont.lfPitchAndFamily = 42; strcpy(logfont.lfFaceName, "Lucida Console"); hfont = CreateFontIndirect(&logfont); SendMessage(hlist, WM_SETFONT, (WPARAM) hfont, 0); // Add all of the items to the list view control U32 i = 0; while (i < numErrors) { LV_ITEM lvi; lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM | LVIF_STATE; lvi.state = 0; lvi.stateMask = 0; lvi.pszText = LPSTR_TEXTCALLBACK; lvi.iImage = 0; lvi.iItem = ListView_GetItemCount(hlist); lvi.iSubItem = 0; lvi.lParam = (LPARAM) &errorItems[i]; ListView_InsertItem(hlist, &lvi); i++; } numErrors = 0; }
void CMDITabs::OnSelChange(NMHDR* pNMHDR, LRESULT* pResult) { TCITEM item; item.mask = TCIF_PARAM; GetItem(GetCurSel(), &item); ::BringWindowToTop(HWND(item.lParam)); *pResult = 0; }
WIN32WindowBase::WIN32WindowBase(void) : Inherited(), _sfHwnd (HWND(0)), _sfHdc (HDC(0)), _sfHglrc (HGLRC(0)), _sfDummy0 (Int32(0)) { }
void test1() { HWND hWnd = HWND(0x00010412); HWND hAncestorWnd = GetAncestor(hWnd, GA_ROOTOWNER); CString strDebug; strDebug.Format("hWnd = %08X, hAncestorWnd = %08X\n", hWnd, hAncestorWnd); g_pMainWin->Log(strDebug); }
// // Destructor of 'RichEdit PrintOut' - Flushes any cached formatting // information // TRichEditPrintout::~TRichEditPrintout() { // Flush cached format information // if (FlushCache) { CHECK(HWND(RichEdit)); RichEdit.FormatRange(); } }