// !! COPIE DE ABOUT.CPP !! void CFirstInfo::OnMouseMove(UINT nFlags, CPoint point) { int id=0; CWnd* w=ChildWindowFromPoint(point); if (w) id=w->GetDlgCtrlID(); // Select switch(id) { case 0: break; case IDC_SPLASH: this->ClientToScreen(&point); w->ScreenToClient(&point); HCURSOR curs=NULL; if ( (point.y>=120) && (point.y<=140) || (point.y<=80) || (point.y>=100) && (point.y<=110) ) { curs=AfxGetApp()->LoadCursor(IDC_CURSWWW); } else { curs=AfxGetApp()->LoadStandardCursor(IDC_ARROW); } if (curs) { //if (curs != currentCurs) { SetCursor(curs); // currentCurs=curs; //} } } CDialog::OnMouseMove(nFlags, point); }
void CDragVirtualListCtrl::UpdateCursor(CPoint point) { if (ChildWindowFromPoint(point) == this) SetCursor(AfxGetApp()->LoadCursor(IDC_DRAG_SINGLE)); else SetCursor(LoadCursor(NULL, IDC_NO)); }
HWND FindHandle(DWORD dwThreadId, string wdwClass, long x, long y) { int size,cnt=0; string str; char buffer[256]={0}; HWND handle; EnumThreadWindows(dwThreadId,EnumThreadWndProc,(LPARAM) &handle); do { if (GetParent(handle)!=NULL && GetParent(handle)!=handle && GetParent(handle)!=GetDesktopWindow() ) handle = GetParent(handle); else break; } while (true); POINT Point; Point.x = x; Point.y = y; handle = ChildWindowFromPoint(handle,Point); if (handle!=NULL) { GetClassName(handle,buffer,256); if (StrCmpNI(buffer,wdwClass.c_str(),wdwClass.length())==0) { return handle; } } return 0; }
SFG_Window* fghWindowUnderCursor(SFG_Window *window) { /* Check if the current window that the mouse is over is a child window * of the window the message was sent to. Some events only sent to main window, * and when handling some messages, we need to make sure that we process * callbacks on the child window instead. This mirrors how GLUT does things. * returns either the original window or the found child. */ if (window && window->Children.First) /* This window has childs */ { HWND hwnd; SFG_Window* child_window; /* Get mouse position at time of message */ DWORD mouse_pos_dw = GetMessagePos(); POINT mouse_pos = {GET_X_LPARAM(mouse_pos_dw), GET_Y_LPARAM(mouse_pos_dw)}; ScreenToClient( window->Window.Handle, &mouse_pos ); hwnd = ChildWindowFromPoint(window->Window.Handle, mouse_pos); if (hwnd && hwnd!=window->Window.Handle) /* can be NULL if mouse outside parent by the time we get here, or can be same as parent if we didn't find a child */ { child_window = fgWindowByHandle(hwnd); if (child_window) /* Verify we got a FreeGLUT window */ { /* ChildWindowFromPoint only searches immediate children, so search again to see if actually in grandchild or further descendant */ window = fghWindowUnderCursor(child_window); } } } return window; }
void Tooltip::show(bool _visible) { visible = _visible; SendMessage(tooltip, TTM_TRACKACTIVATE, FALSE, 0); if (visible) { // WindowFromPoint ignores static controls and disabled windows. // Threrfore, we have to use ChildWindowFromPoint that does not ignore // static controls and disabled windows. HWND mouse_hwnd = WindowFromPoint(mouse_pt); HWND temp_hwnd = mouse_hwnd; if (mouse_hwnd) { POINT child_pt = mouse_pt; if (ScreenToClient(mouse_hwnd, &child_pt)) { HWND child_hwnd = ChildWindowFromPoint(mouse_hwnd, child_pt); if (child_hwnd) mouse_hwnd = child_hwnd; } TOOLINFO ti; memset(&ti, 0, sizeof(ti)); ti.cbSize = sizeof(ti); ti.hwnd = hwnd; ti.uId = (UINT)mouse_hwnd; SendMessage(tooltip, TTM_TRACKPOSITION, 0, MAKELPARAM(mouse_pt.x, mouse_pt.y)); SendMessage(tooltip, TTM_TRACKACTIVATE, TRUE, (LPARAM)&ti); } } }
void CISRSummary::OnLButtonDown(UINT nFlags, CPoint point) { if (m_pPropertySheet) m_pPropertySheet->SetToClose(0); CWnd* pWnd; if ((pWnd = ChildWindowFromPoint(point,CWP_ALL))!=NULL) { UINT index = pWnd->GetDlgCtrlID(); if ((index >= IDC_ISRSUMMARY_FIRST) && (index <= IDC_ISRSUMMARY_LAST)) { if ((index == IDC_ISRSUMMARY_COMMAND6) || (index == IDC_ISRSUMMARY_COMMAND5) || (index == IDC_ISRSUMMARY_COMMAND4) || (index == IDC_ISRSUMMARY_COMMAND3) || (index == IDC_ISRSUMMARY_COMMAND2) || (index == IDC_ISRSUMMARY_COMMAND1)) { char Text[256]; Text[0] = NULL; GetDlgItemText(index,Text,sizeof(Text)); if (strlen(Text)) { strcat(Text,"\""); memmove(&Text[2],Text,strlen(Text)+1); Text[0] = '"'; Text[1] = 'I'; _spawnl(_P_NOWAIT,m_pParent->m_szUtilFile,"MsgUtil.exe",Text,NULL); } } } } CPropertyPage::OnLButtonDown(nFlags, point); }
CChildWnd* CWindowManager::FindFromPoint(const CPoint& point) const { CPoint pt( point ); ScreenToClient( &pt ); CChildWnd* pWnd = (CChildWnd*)ChildWindowFromPoint( pt ); return ( pWnd != NULL && pWnd->IsKindOf( RUNTIME_CLASS(CChildWnd) ) ) ? pWnd : NULL; }
void SubClassHistoryCombo(HWND combo) { POINT pt; HWND editWnd; pt.x = 5; pt.y = 5; editWnd = ChildWindowFromPoint(combo, pt); SetWindowLong(combo, GWL_WNDPROC, (int)historyComboProc); SetWindowLong(editWnd, GWL_WNDPROC, (int)historyEditComboProc); }
HWND PropGetHWNDCombobox(HWND parent) { HWND rv = CreateWindow("combobox", "", WS_VISIBLE | WS_CHILD | WS_BORDER | CBS_SORT | CBS_DROPDOWN, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, parent, 0, hInstance, NULL); POINT pt; HWND h; pt.x = pt.y = 5; h = ChildWindowFromPoint(rv, pt); SubclassPropsEditWindow(h); return rv; }
void CColorBtnDlg::OnLButtonUp(UINT nFlags, CPoint point) { // See notes for OnLButtonDown. CWnd *child = ChildWindowFromPoint(point,CWP_ALL); if (child && child != this) child->SendMessage(WM_LBUTTONDOWN,0,0l); CDialog::OnLButtonUp(nFlags, point); }
int TranscriptWindow::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message) { // If the edit window is visible and the user clicks outside it, end editing if (m_edit.IsWindowVisible()) { CPoint point(::GetMessagePos()); ScreenToClient(&point); if (ChildWindowFromPoint(point) != &m_edit) m_edit.EndEdit(); } return CView::OnMouseActivate(pDesktopWnd,nHitTest,message); }
void CAboutDlg::OnLButtonDown(UINT nFlags, CPoint point) { CWnd* pWnd = ChildWindowFromPoint(point); if (pWnd == nullptr) return; if (pWnd->GetDlgCtrlID() == IDC_MAILTO) ShellExecute(nullptr, L"open", L"mailto:[email protected]", nullptr, nullptr, NULL); if (pWnd->GetDlgCtrlID() == IDC_HTTPGITHUB) ShellExecute(nullptr, L"open", L"https://github.com/jovibor/Shutdown", nullptr, nullptr, NULL); }
static GdkWindow * gdk_device_win32_window_at_position (GdkDevice *device, gint *win_x, gint *win_y, GdkModifierType *mask, gboolean get_toplevel) { GdkWindow *window; POINT point, pointc; HWND hwnd, hwndc; RECT rect; GetCursorPos (&pointc); point = pointc; hwnd = WindowFromPoint (point); if (hwnd == NULL) { window = _gdk_root; *win_x = pointc.x + _gdk_offset_x; *win_y = pointc.y + _gdk_offset_y; return window; } ScreenToClient (hwnd, &point); do { if (get_toplevel && (window = gdk_win32_handle_table_lookup (hwnd)) != NULL && GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN) break; hwndc = ChildWindowFromPoint (hwnd, point); ClientToScreen (hwnd, &point); ScreenToClient (hwndc, &point); } while (hwndc != hwnd && (hwnd = hwndc, 1)); window = gdk_win32_handle_table_lookup (hwnd); if (window && (win_x || win_y)) { GetClientRect (hwnd, &rect); *win_x = point.x - rect.left; *win_y = point.y - rect.top; } return window; }
BOOL CRoundSliderCtrl::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) { BOOL bResult = TRUE; ScreenToClient(&pt); if(ChildWindowFromPoint(pt) == this) { bResult = CSliderCtrl::OnMouseWheel(nFlags, zDelta, pt); RedrawWindow(); } return bResult; }
void CMuleSystrayDlg::OnMouseMove(UINT nFlags, CPoint point) { CWnd *pWnd = ChildWindowFromPoint(point, CWP_SKIPINVISIBLE|CWP_SKIPDISABLED); if(pWnd) { if(pWnd == this || pWnd == &m_ctrlSidebar) SetCapture(); // me, myself and i else ReleaseCapture(); // sweet child of mine } else SetCapture(); // i'm on the outside, i'm looking in ... CDialog::OnMouseMove(nFlags, point); }
void CInfoDlg::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: 在此添加消息处理程序代码和/或调用默认值 // 鼠标所在窗口 CWnd *pWnd = ChildWindowFromPoint(point); // 若单击Spy_Scan_Icon,启动扫描 if(pWnd != NULL && pWnd->GetSafeHwnd() == scan.GetSafeHwnd()) { SpyStartScanning(); } CDialogEx::OnLButtonDown(nFlags, point); }
void CDemoDescriptionDialog::OnLButtonDblClk(UINT nFlags, CPoint point) { CWnd* pWnd = ChildWindowFromPoint(point); if (pWnd != NULL) { if (pWnd->GetDlgCtrlID() == IDC_DISCOUNT_CD_CATALOG) { // Start up the discount CD catalog! ((CMainFrame*)(AfxGetMainWnd()))->DoProductCatalog(); return; } } CPmwDialog::OnLButtonDblClk(nFlags, point); }
void TZNoteBook::SelectPoint( CPoint pt ) { #ifdef DEBUG_ALL TracePoint( "TZNoteBook::SelectPoint", pt ); #endif if ( mIs_hWnd( m_hWnd ) == 0 ) return; PostMoveCtrl( ); m_bDeletable = TRUE; // mark it as deletable CWnd *pWndDlgItem = GetDlgItem( 1 ); if ( pWndDlgItem ) { // MessageBox( "TZNoteBook::SelectPoint", "Found DlgItem" ); // TraceLineX( "TZNoteBook::SelectPoint DlgItem: ", // (zLONG) pWndDlgItem->m_hWnd ); CWnd *pWndChild = ChildWindowFromPoint( pt, CWP_SKIPINVISIBLE ); if ( pWndChild ) { // TraceLineX( "TZNoteBook::SelectPoint ChildFromPt: ", // (zLONG) pWndChild->m_hWnd ); if ( pWndDlgItem->m_hWnd == pWndChild->m_hWnd ) { ClientToScreen( &pt ); pWndDlgItem->ScreenToClient( &pt ); pWndDlgItem->SendMessage( WM_LBUTTONDOWN, 0, MAKELONG( pt.x, pt.y ) ); pWndDlgItem->SendMessage( WM_LBUTTONUP, 0, MAKELONG( pt.x, pt.y ) ); return; } } } SendMessage( WM_LBUTTONDOWN, 0, MAKELONG( pt.x, pt.y ) ); SendMessage( WM_LBUTTONUP, 0, MAKELONG( pt.x, pt.y ) ); //x zSHORT nActiveTabNbr = GetActivePage( ); // TraceLineI( "TZNoteBook::Select New ActiveTab = ", nActiveTabNbr ); //xif ( nActiveTab != m_nActiveTabNbr ) //x ActivateTab( nActiveTabNbr ); // TraceLineI( "TZNoteBook::Select Activating tab IdNbr ", GetTabID( ) ); // TraceLineI( " tab number ", m_nActiveTabNbr ); // TraceLineI( " real tab number ", GetTab( ) ); }
void CColorBtnDlg::OnLButtonDown(UINT nFlags, CPoint point) { RECT r; POINT p; p.x = point.x; p.y = point.y; ClientToScreen(&p); GetWindowRect(&r); // The user clicked... if (!PtInRect(&r,p)) { // ...outside the dialog, close. EndDialog(IDCANCEL); } else { // ...inside the dialog. Since this window // has the mouse captured, its children // get no messages. So, check to see // if the click was in one of its children // and tell him. // If the user clicks inside the dialog // but not on any of the controls, // ChildWindowFromPoint returns a // pointer to the dialog. In this // case we do not resend the message // (obviously) because it would cause // a stack overflow. CWnd *child = ChildWindowFromPoint(point); if (child && child != this) child->SendMessage(WM_LBUTTONDOWN,0,0l); } CDialog::OnLButtonDown(nFlags, point); }
void CAboutDlg::OnMouseMove(UINT nFlags, CPoint point) { CWnd* pWnd = ChildWindowFromPoint(point); if (pWnd == nullptr) //mouse pointer is out of window return; if (m_fMailtoUnderline == (pWnd->GetDlgCtrlID() == IDC_MAILTO)) //is mouse pointer hovering IDC_MAILTO? { m_fMailtoUnderline = !m_fMailtoUnderline; ::InvalidateRect(GetDlgItem(IDC_MAILTO)->m_hWnd, nullptr, FALSE); SetCursor(m_fMailtoUnderline ? m_curArrow : m_curHand); } if (m_fGithubUnderline == (pWnd->GetDlgCtrlID() == IDC_HTTPGITHUB)) { m_fGithubUnderline = !m_fGithubUnderline; ::InvalidateRect(GetDlgItem(IDC_HTTPGITHUB)->m_hWnd, nullptr, FALSE); SetCursor(m_fGithubUnderline ? m_curArrow : m_curHand); } }
HWND WINAPI DoCreateComboControl(HWND hwndParent) { HWND hwndCombo; //TCITEM tie; hwndCombo=CreateWindow(_T("COMBOBOX"), NULL, WS_BORDER| WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWN /*| CBS_LOWERCASE*/ | CBS_HASSTRINGS, 0, 0, 32 /*CW_USEDEFAULT*/, CW_USEDEFAULT, hwndParent, NULL, g_hInst, NULL); POINT pt; pt.x=6; pt.y=6; HWND hWndEdit = ChildWindowFromPoint(hwndCombo, pt); WNDPROC OldEditWndProc = (WNDPROC)SetWindowLong(hWndEdit, GWL_WNDPROC, (LONG)ComboSubClassProc); SetWindowLong(hWndEdit, GWL_USERDATA, (LONG)OldEditWndProc); return hwndCombo; }
//--------------------------------------------------------------------------- int __stdcall ChooseFolder_BrowseCallbackProc(HWND Win,UINT Mess,LPARAM,LPARAM lParUser) { switch (Mess) { case BFFM_INITIALIZED: { RECT box; POINT pt; HWND TreeView; char Path[MAX_PATH+1]; int Len; // Centre dialog GetWindowRect(Win,&box); box.right-=box.left; box.bottom-=box.top; SetWindowPos(Win,0,(GetSystemMetrics(SM_CXSCREEN)/2)-(box.right/2), (GetSystemMetrics(SM_CYSCREEN)/2)-(box.bottom/2), 0,0,SWP_NOSIZE | SWP_NOZORDER); // Select passed folder strcpy(Path,(char*)lParUser); NO_SLASH(Path); Len=strlen(Path); if (Path[Len-1]==':') { Path[Len++]='\\'; Path[Len]=0; } SendMessage(Win,BFFM_SETSELECTION,TRUE,(LPARAM)Path); // Change Tree to make it work better pt.x=box.right/2; pt.y=box.bottom/2; TreeView=ChildWindowFromPoint(Win,pt); SetWindowLong(TreeView,GWL_STYLE,GetWindowLong(TreeView,GWL_STYLE) | TVS_SHOWSELALWAYS | TVS_DISABLEDRAGDROP); break; } } return 0; }
void CFirstInfo::OnLButtonDown(UINT nFlags, CPoint point) { int id=0; CWnd* w=ChildWindowFromPoint(point); if (w) id=w->GetDlgCtrlID(); // Select switch(id) { case 0: break; case IDC_SPLASH: this->ClientToScreen(&point); w->ScreenToClient(&point); if ((point.y>=100) && (point.y<=110) || (point.y<=80)) { if (!ShellExecute(NULL,"open","http://www.httrack.com","","",SW_RESTORE)) { } } break; } CDialog::OnLButtonDown(nFlags, point); }
LRESULT CALLBACK ProjectProc(HWND hwnd, UINT iMessage, WPARAM wParam, LPARAM lParam) { int i; RECT rs; NM_TREEVIEW *nm; DWINFO info; LPNMTVKEYDOWN key; PROJECTITEM *data; TVHITTESTINFO hittest; HWND win; HTREEITEM oldSel; static HCURSOR origCurs; static BOOL dragging; static BOOL inView; static HTREEITEM srcItem, dstItem; switch (iMessage) { LOGFONT lf; case WM_SYSCOMMAND: if (wParam == SC_CLOSE) SendMessage(hwnd, WM_CLOSE, 0, 0); break; // case WM_SETTEXT: // return SendMessage(hwndTab, iMessage, wParam, lParam); case WM_LBUTTONDOWN: case WM_RBUTTONDOWN: SetFocus(hwnd); break; case WM_NOTIFY: nm = (NM_TREEVIEW*)lParam; switch (nm->hdr.code) { case NM_CUSTOMDRAW: return CustomDraw(hwnd, (LPNMTVCUSTOMDRAW)nm); case N_EDITDONE: DoneRenaming(); break; case TVN_BEGINDRAG: GetCursorPos(&hittest.pt); ScreenToClient(prjTreeWindow, &hittest.pt); srcItem = TreeView_HitTest(prjTreeWindow, &hittest); data = GetItemInfo(srcItem); if (data && (data->type == PJ_FILE || data->type == PJ_FOLDER)) { dragging = TRUE; SetCapture(hwnd); origCurs = SetCursor(dragCur); inView = TRUE; } break; case TVN_KEYDOWN: key = (LPNMTVKEYDOWN)lParam; switch (key->wVKey) { case VK_INSERT: if (GetKeyState(VK_CONTROL) &0x80000000) { data = GetItemInfo(prjSelectedItem); if (data) { int msg = -1; switch (data->type) { case PJ_WS: msg = IDM_EXISTINGPROJECT; break; case PJ_PROJ: msg = IDM_NEWFOLDER; break; case PJ_FOLDER: msg = IDM_EXISTINGFILE; break; } if (msg != -1) PostMessage(hwnd, WM_COMMAND, msg, 0); } } else if (GetKeyState(VK_SHIFT) &0x80000000) { data = GetItemInfo(prjSelectedItem); if (data) { int msg = -1; switch (data->type) { case PJ_WS: msg = IDM_NEWPROJECT; break; case PJ_PROJ: msg = IDM_NEWFOLDER; break; case PJ_FOLDER: msg = IDM_NEWFILE_P; break; } if (msg != -1) PostMessage(hwnd, WM_COMMAND, msg, 0); } } else { data = GetItemInfo(prjSelectedItem); if (data && (data->type != PJ_WS)) PostMessage(hwnd, WM_COMMAND, IDM_RENAME, 0); } break; case VK_DELETE: if (!(GetKeyState(VK_CONTROL) &0x80000000) && !(GetKeyState(VK_SHIFT) &0x8000000)) { data = GetItemInfo(prjSelectedItem); if (data && (data->type == PJ_FOLDER || data->type == PJ_FILE)) PostMessage(hwnd, WM_COMMAND, IDM_REMOVE, 0); } break; case VK_RETURN: SendMessage(hwnd, WM_COMMAND, IDM_OPENFILES, 0); break; } break; case NM_DBLCLK: oldSel = prjSelectedItem; GetCursorPos(&hittest.pt); ScreenToClient(prjTreeWindow, &hittest.pt); prjSelectedItem = TreeView_HitTest(prjTreeWindow, &hittest); if (prjSelectedItem) PostMessage(hwnd, WM_COMMAND, IDM_OPENFILES, 0); prjSelectedItem = oldSel; return 0; case NM_RCLICK: GetCursorPos(&hittest.pt); ScreenToClient(prjTreeWindow, &hittest.pt); prjSelectedItem = TreeView_HitTest(prjTreeWindow, &hittest); if (prjSelectedItem) { TreeView_SelectItem(prjTreeWindow, prjSelectedItem); } CreateProjectMenu(); break; case TVN_SELCHANGED: nm = (NM_TREEVIEW*)lParam; prjSelectedItem = nm->itemNew.hItem; if (prjSelectedItem == 0) prjSelectedItem = workArea->hTreeItem; break; case TVN_ITEMEXPANDED: nm = (NM_TREEVIEW *)lParam; data = GetItemInfo(nm->itemNew.hItem); if (data) { if (data->type == PJ_FOLDER) { TV_ITEM setitem; memset(&setitem, 0, sizeof(setitem)); setitem.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE; setitem.iImage = setitem.iSelectedImage = nm->action == TVE_EXPAND ? ilfolderOpen : ilfolderClose; setitem.hItem = nm->itemNew.hItem; TreeView_SetItem(prjTreeWindow, &setitem); } if (nm->action == TVE_EXPAND) { data->expanded = TRUE; } else data->expanded = FALSE; return 0; } break; case TVN_DELETEITEM: nm = (NM_TREEVIEW *)lParam; if (nm->itemOld.hItem == prjSelectedItem) prjSelectedItem = TreeView_GetSelection(prjTreeWindow); break; } break; case WM_COMMAND: switch (LOWORD(wParam)) { case ID_TBPROFILE: if (HIWORD(wParam) == CBN_SELENDOK) { int i = SendMessage(hwndTbProfile, CB_GETCURSEL, 0 , 0); if (i != CB_ERR) { if (i == 0) { strcpy(currentProfileName, sysProfileName); } else { PROFILENAMELIST *pf = profileNames; while (pf && --i) pf = pf->next; if (pf) { strcpy(currentProfileName, pf->name); } } MarkChanged(workArea, TRUE); } } break; case ID_TBBUILDTYPE: if (HIWORD(wParam) == CBN_SELENDOK) { int i = SendMessage(hwndTbBuildType, CB_GETCURSEL, 0 , 0); if (i != CB_ERR) { profileDebugMode = i == 0 ? 1 : 0; MarkChanged(workArea, TRUE); } } break; case IDM_RESETPROFILECOMBOS: { HWND htemp; PROFILENAMELIST *pf; int selected,n; int count; POINT pt; pf = profileNames; selected = 0; count = 0; SendMessage(hwndTbProfile, CB_RESETCONTENT, 0, 0); SendMessage(hwndTbProfile, CB_ADDSTRING, 0, (LPARAM)sysProfileName); while (pf) { count++; if (!strcmp(pf->name,currentProfileName)) selected = count; SendMessage(hwndTbProfile, CB_ADDSTRING, 0, (LPARAM)pf->name); pf = pf->next; } SendMessage(hwndTbProfile, CB_SETCURSEL, selected, 0); SendMessage(hwndTbBuildType, CB_RESETCONTENT, 0, 0); SendMessage(hwndTbBuildType, CB_ADDSTRING, 0, (LPARAM)"Debug"); SendMessage(hwndTbBuildType, CB_ADDSTRING, 0, (LPARAM)"Release"); SendMessage(hwndTbBuildType, CB_SETCURSEL, profileDebugMode ? 0 : 1, 0); pt.x = 5; pt.y = 5; htemp = ChildWindowFromPoint(hwndTbProfile, pt); SendMessage(htemp, EM_SETREADONLY, 1, 0); htemp = ChildWindowFromPoint(hwndTbBuildType, pt); SendMessage(htemp, EM_SETREADONLY, 1, 0); EnableWindow(hwndTbProfile, TRUE); EnableWindow(hwndTbBuildType, TRUE); break; } case IDM_IMPORT_CWS: ImportProject(FALSE); break; case IDM_IMPORT_CTG: ImportProject(TRUE); break; case IDM_DOSWINDOW: { DosWindow(activeProject ? activeProject->realName : NULL, NULL, NULL, NULL, NULL); } break; case IDM_MAKEWINDOW: { char exec[MAX_PATH]; sprintf(exec, "%s\\bin\\imake.exe", szInstallPath); DosWindow(activeProject ? activeProject->realName : NULL, exec, "", "Custom Make", "Make Is Complete."); } break; case IDM_RUN: SaveWorkArea(workArea); dbgRebuildMain(wParam); break; case IDM_SETACTIVEPROJECT: ProjectSetActive(); break; case IDM_NEWFILE_P: ProjectNewFile(); PostMessage(hwndFrame, WM_REDRAWTOOLBAR, 0, 0); break; case IDM_EXISTINGFILE: ProjectExistingFile(); PostMessage(hwndFrame, WM_REDRAWTOOLBAR, 0, 0); break; case IDM_NEWPROJECT: ProjectNewProject(); PostMessage(hwndFrame, WM_REDRAWTOOLBAR, 0, 0); break; case IDM_EXISTINGPROJECT: ProjectExistingProject(); PostMessage(hwndFrame, WM_REDRAWTOOLBAR, 0, 0); break ; case IDM_REMOVE: ProjectRemove(); PostMessage(hwndFrame, WM_REDRAWTOOLBAR, 0, 0); break; case IDM_RENAME: ProjectRename(); break; case IDM_NEWFOLDER: ProjectNewFolder(); PostMessage(hwndFrame, WM_REDRAWTOOLBAR, 0, 0); break; case IDM_NEWWS: if (uState != notDebugging) { if (ExtendedMessageBox("WorkArea", MB_OKCANCEL, "This action requires the debugger to be stopped.") != IDOK) { break; } abortDebug(); } SelectWindow(DID_PROJWND); ProjectNewWorkArea(); break; case IDM_OPENWS: if (uState != notDebugging) { if (ExtendedMessageBox("WorkArea", MB_OKCANCEL, "This action requires the debugger to be stopped.") != IDOK) { break; } abortDebug(); } SelectWindow(DID_PROJWND); ProjectExistingWorkArea(); break; case IDM_CLOSEWS: if (making) break; if (uState != notDebugging) { if (ExtendedMessageBox("WorkArea", MB_OKCANCEL, "This action requires the debugger to be stopped.") != IDOK) { break; } abortDebug(); } CloseWorkArea(); break; case IDM_SAVEWS: SaveAllProjects(workArea, TRUE); break; case IDM_COMPILEFILEFROMTREE: { PROJECTITEM *data = GetItemInfo(prjSelectedItem); if (data && data->type == PJ_FILE) { unlink(data->outputName); Maker(data, TRUE); } } break; case IDM_COMPILEFILE: win = (HWND)SendMessage(hwndClient, WM_MDIGETACTIVE, 0, 0); if (IsWindow(win) && IsEditWindow(win)) { HTREEITEM item = FindItemByWind(win); PROJECTITEM *data = GetItemInfo(item); if (data) { unlink(data->outputName); Maker(data, TRUE); } } break; case IDM_GENMAKE: if (workArea && workArea->children) { genMakeFile(workArea); } else { ExtendedMessageBox("Makefile Generation", MB_SETFOREGROUND | MB_SYSTEMMODAL, "You need at least one project to generate a make file"); } break; case IDM_MAKE: if (HIWORD(wParam)) if (GetKeyState(VK_CONTROL) &0x80000000) SendMessage(hwnd, WM_COMMAND, IDM_COMPILEFILE, 0); else if (GetKeyState(VK_SHIFT) &0x80000000) Maker(activeProject, FALSE); else Maker(workArea, FALSE); else Maker(workArea, FALSE); break; case IDM_MAKE_RIGHTCLICK: if (HIWORD(wParam)) if (GetKeyState(VK_CONTROL) &0x80000000) SendMessage(hwnd, WM_COMMAND, IDM_COMPILEFILE, 0); else if (GetKeyState(VK_SHIFT) &0x80000000) Maker(activeProject, FALSE); else Maker(workArea, FALSE); else { if (prjSelectedItem) { PROJECTITEM *data = GetItemInfo(prjSelectedItem); if (data) { Maker(data, FALSE); break; } } Maker(workArea, FALSE); } break; case IDM_BUILDALL: Maker(workArea, TRUE); break; case IDM_BUILDALL_RIGHTCLICK: if (prjSelectedItem) { PROJECTITEM *data = GetItemInfo(prjSelectedItem); if (data) { Maker(data, TRUE); break; } } Maker(workArea, TRUE); break; case IDM_BUILDSELECTED: Maker(activeProject, FALSE); break; case IDM_STOPBUILD: StopBuild(); break; case IDM_CALCULATEDEPENDS: CalculateProjectDepends(GetItemInfo(prjSelectedItem)); break; case IDM_RUNNODEBUG: { SaveWorkArea(workArea); RunProgram(activeProject); break; } case IDM_SELECTPROFILE: SelectProfileDialog(); break; case IDM_ACTIVEPROJECTPROPERTIES: if (activeProject) prjSelectedItem = activeProject->hTreeItem; // fall through case IDM_PROJECTPROPERTIES: data = GetItemInfo(prjSelectedItem); ShowBuildProperties(data); break; case IDM_PROJECTDEPENDS: data = GetItemInfo(prjSelectedItem); EditProjectDependencies(data); break; case IDM_OPENFILES: data = GetItemInfo(prjSelectedItem); if (data) if (data->type == PJ_FILE) { if (strlen(data->realName) >= 3 && !stricmp(data->realName + strlen(data->realName) -3, ".rc")) { NavigateToResource(data); } else { strcpy(info.dwName, data->realName); strcpy(info.dwTitle, data->displayName); info.dwLineNo = - 1; info.logMRU = FALSE; info.newFile = FALSE; CreateDrawWindow(&info, TRUE); } } break; case IDM_CLOSE: SendMessage(hwnd, WM_CLOSE, 0, 0); break; default: return DefWindowProc(hwnd, iMessage, wParam, lParam); } break; case WM_LBUTTONUP: if (dragging) { SetCursor(origCurs); ReleaseCapture(); dragging = FALSE; TreeView_SelectDropTarget(prjTreeWindow, NULL); if (inView && dstItem != srcItem && srcItem && dstItem) { DragTo(dstItem, srcItem); } } break; case WM_MOUSEMOVE: if (dragging) { hittest.pt.x = (long)(short)LOWORD(lParam); hittest.pt.y = (long)(short)HIWORD(lParam); dstItem = TreeView_HitTest(prjTreeWindow, &hittest); if (dstItem && dstItem != srcItem) { PROJECTITEM *srcData = GetItemInfo(srcItem); data = GetItemInfo(dstItem); if (srcData && data) { PROJECTITEM *p = data->parent; while (p) if (p == srcData) break; else p = p->parent; if (p) { if (inView) { inView = FALSE; SetCursor(noCur); TreeView_SelectDropTarget(prjTreeWindow, NULL); } break; } } if (data && (data->type == PJ_PROJ || data->type == PJ_FOLDER)) { if (!inView) { inView = TRUE; SetCursor(dragCur); } TreeView_SelectDropTarget(prjTreeWindow, dstItem); } else { if (inView) { inView = FALSE; SetCursor(noCur); TreeView_SelectDropTarget(prjTreeWindow, NULL); } } } else { if (inView) { inView = FALSE; SetCursor(noCur); TreeView_SelectDropTarget(prjTreeWindow, NULL); } } } break; case WM_SETFOCUS: PostMessage(hwndFrame, WM_REDRAWTOOLBAR, 0, 0); SetFocus(prjTreeWindow); break; case WM_CREATE: hwndProject = hwnd; GetClientRect(hwnd, &rs); treeViewSelected = 0; dragCur = LoadCursor(hInstance, "ID_DRAGCUR"); noCur = LoadCursor(hInstance, "ID_NODRAGCUR"); folderClose = LoadBitmap(hInstance, "ID_FOLDERCLOSE"); folderOpen = LoadBitmap(hInstance, "ID_FOLDEROPEN"); treeIml = ImageList_Create(16, 16, ILC_COLOR24, IL_IMAGECOUNT+2, 0); mainIml = LoadBitmap(hInstance, "ID_FILES"); ChangeBitmapColor(mainIml, 0xffffff, RetrieveSysColor(COLOR_WINDOW)); ImageList_Add(treeIml, mainIml, NULL); ilfolderClose = ImageList_Add(treeIml, folderClose, 0); ilfolderOpen = ImageList_Add(treeIml, folderOpen, 0); DeleteObject(folderClose); DeleteObject(folderOpen); DeleteObject(mainIml); prjTreeWindow = CreateWindowEx(0, sztreeDoubleBufferName, "", WS_VISIBLE | WS_CHILD | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS | TVS_TRACKSELECT, 0, 0, rs.right, rs.bottom, hwnd, (HMENU)ID_TREEVIEW, hInstance, NULL); TreeView_SetImageList(prjTreeWindow, treeIml, TVSIL_NORMAL); lf = systemDialogFont; projFont = CreateFontIndirect(&lf); lf.lfItalic = TRUE; italicProjFont = CreateFontIndirect(&lf); lf.lfItalic = FALSE; lf.lfWeight = FW_BOLD; boldProjFont = CreateFontIndirect(&lf); SendMessage(prjTreeWindow, WM_SETFONT, (WPARAM)boldProjFont, 0); return 0; case WM_CLOSE: SaveAllProjects(workArea, FALSE); break; case WM_DESTROY: FreeSubTree(workArea, FALSE); DestroyWindow(prjTreeWindow); DeleteObject(projFont); DeleteObject(boldProjFont); DeleteObject(italicProjFont); DestroyCursor(dragCur); DestroyCursor(noCur); hwndProject = 0; break; case WM_SIZE: MoveWindow(prjTreeWindow, 0, 0, LOWORD(lParam), HIWORD(lParam), 0); break; default: break; } return DefWindowProc(hwnd, iMessage, wParam, lParam); }
static void gdk_device_win32_query_state (GdkDevice *device, GdkWindow *window, GdkWindow **root_window, GdkWindow **child_window, gdouble *root_x, gdouble *root_y, gdouble *win_x, gdouble *win_y, GdkModifierType *mask) { POINT point; HWND hwnd, hwndc; hwnd = GDK_WINDOW_HWND (window); GetCursorPos (&point); if (root_x) *root_x = point.x; if (root_y) *root_y = point.y; ScreenToClient (hwnd, &point); if (win_x) *win_x = point.x; if (win_y) *win_y = point.y; if (window == _gdk_root) { if (win_x) *win_x += _gdk_offset_x; if (win_y) *win_y += _gdk_offset_y; if (root_x) *root_x += _gdk_offset_x; if (root_y) *root_y += _gdk_offset_y; } if (child_window) { hwndc = ChildWindowFromPoint (hwnd, point); if (hwndc && hwndc != hwnd) *child_window = gdk_win32_handle_table_lookup (hwndc); else *child_window = NULL; /* Direct child unknown to gdk */ } if (root_window) { GdkScreen *screen; screen = gdk_window_get_screen (window); *root_window = gdk_screen_get_root_window (screen); } if (mask) *mask = get_current_mask (); }
LRESULT __stdcall PlayerPanel::PanelWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { switch(Msg) { case WM_COMMAND: { /* Forward message to parent */ return SendMessage(GetParent(hWnd), WM_COMMAND, wParam, lParam); } case WM_CONTEXTMENU: { /* Show menu */ PlayerPanel* Panel = (PlayerPanel*)GetWindowLong(hWnd, GWL_USERDATA); if (Panel != NULL) { TrackPopupMenu(Panel->PlayerMenu, TPM_LEFTALIGN, LOWORD(lParam), HIWORD(lParam), 0, hWnd, NULL); } return 0; } case WM_CREATE: { CREATESTRUCT* Params = (CREATESTRUCT*)lParam; PlayerPanel* Panel = (PlayerPanel*)(Params->lpCreateParams); SetWindowLong(hWnd, GWL_USERDATA, (LPARAM)Panel); return 0; } case WM_ERASEBKGND: { return 1; } case WM_PAINT: { PlayerPanel* Panel = (PlayerPanel*)GetWindowLong(hWnd, GWL_USERDATA); if (Panel != NULL) { Panel->Paint(); } return 0; } case WM_SIZE: { PlayerPanel* Panel = (PlayerPanel*)GetWindowLong(hWnd, GWL_USERDATA); if (Panel != NULL) { if (LOWORD(lParam) != Panel->Width || HIWORD(lParam) != Panel->Height) Panel->UpdateSize((short)LOWORD(lParam), (short)HIWORD(lParam)); } return 0; } case WM_THEMECHANGED: { ApplyThemeToCustomButton(hWnd); return 0; } case WM_UNINITMENUPOPUP: { PlayerPanel* Panel = (PlayerPanel*)GetWindowLong(hWnd, GWL_USERDATA); if (Panel != NULL && Panel->PlayerButton != NULL) { POINT Pos; GetCursorPos(&Pos); RECT R; GetWindowRect(hWnd, &R); Pos.x = Pos.x-R.left; Pos.y = Pos.y-R.top; if (ChildWindowFromPoint(hWnd,Pos) != Panel->PlayerButton) { /* Set button status to none */ SetWindowLong(Panel->PlayerButton, GWL_USERDATA, 0); InvalidateRect(Panel->PlayerButton, NULL, TRUE); } } return 0; } } return DefWindowProc(hWnd,Msg,wParam,lParam); }
/**************************************************************************** * * FUNCTION: AboutDlgProc * * PURPOSE: Processes messages for "About" dialog box * ****************************************************************************/ BOOL CALLBACK AboutDlgProc( HWND hDlg, UINT message, UINT wParam, LONG lParam ) { RECT parentRc, childRc; static HWND hLink; static BOOL underline_link; static HFONT hFontNormal = NULL; static HFONT hFontUnderline = NULL; static HCURSOR hHandCursor = NULL; static HCURSOR hRegularCursor; LOGFONT logfont; switch ( message ) { case WM_INITDIALOG: GetWindowRect( GetParent(hDlg), &parentRc ); GetWindowRect( hDlg, &childRc ); parentRc.left += 70; parentRc.top += 60; MoveWindow( hDlg, parentRc.left, parentRc.top, childRc.right - childRc.left, childRc.bottom - childRc.top, TRUE ); underline_link = TRUE; hLink = GetDlgItem( hDlg, IDC_LINK ); // get link fonts hFontNormal = GetStockObject(DEFAULT_GUI_FONT); GetObject( hFontNormal, sizeof logfont, &logfont); logfont.lfUnderline = TRUE; hFontUnderline = CreateFontIndirect( &logfont ); // get hand hHandCursor = LoadCursor( hInst, TEXT("HAND") ); hRegularCursor = LoadCursor( NULL, IDC_ARROW ); return TRUE; case WM_CTLCOLORSTATIC: if ( (HWND)lParam == hLink ) { HDC hdc = (HDC)wParam; SetBkMode( hdc, TRANSPARENT ); if ( GetSysColorBrush(26/*COLOR_HOTLIGHT*/) ) SetTextColor( hdc, GetSysColor(26/*COLOR_HOTLIGHT*/) ); else SetTextColor( hdc, RGB(0,0,255) ); SelectObject( hdc, underline_link ? hFontUnderline : hFontNormal ); return (LONG)GetSysColorBrush( COLOR_BTNFACE ); } break; case WM_MOUSEMOVE: { POINT pt = { LOWORD(lParam), HIWORD(lParam) }; HWND hChild = ChildWindowFromPoint( hDlg, pt ); if ( underline_link == (hChild == hLink) ) { underline_link = !underline_link; InvalidateRect( hLink, NULL, FALSE ); } if ( underline_link ) SetCursor( hRegularCursor ); else SetCursor( hHandCursor ); break; } case WM_LBUTTONDOWN: { POINT pt = { LOWORD(lParam), HIWORD(lParam) }; HWND hChild = ChildWindowFromPoint( hDlg, pt ); if ( hChild == hLink ) { ShellExecute( hDlg, TEXT("open"), TEXT("http://www.sysinternals.com"), NULL, NULL, SW_SHOWNORMAL ); } break; } case WM_COMMAND: switch ( wParam ) { case IDOK: case IDCANCEL: EndDialog( hDlg, 0 ); return TRUE; } break; case WM_CLOSE: EndDialog( hDlg, 0 ); return TRUE; default: break; } return FALSE; }
LRESULT CALLBACK Main_WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam) { switch (uMessage) { case WM_NCCREATE: SHGetMalloc(&g_pMalloc); break; case WM_CREATE: { HIMAGELIST himlLarge; HIMAGELIST himlSmall; HWND hwndTree; HWND hwndList; g_uPosition = 0; //get the system image lists himlLarge = Main_CreateImageList(TRUE); himlSmall = Main_CreateImageList(FALSE); // create the TreeView control hwndTree = Tree_Create(g_hInst, hWnd, himlSmall); // create the ListView control hwndList = List_Create(g_hInst, hWnd, himlLarge, himlSmall); //initialize the TreeView control Tree_Init(hwndTree); SetFocus(hwndTree); } break; case WM_NOTIFY: { LPNMHDR pnmh = (LPNMHDR) lParam; switch(pnmh->idFrom) { case IDC_TREEVIEW: return Tree_Notify(hWnd, lParam); case IDC_LISTVIEW: return List_Notify(hWnd, lParam); } } return 0; case WM_SIZE: { Main_SizeChildren(hWnd); } break; case WM_LBUTTONDOWN: SetCapture(hWnd); return 0; case WM_LBUTTONUP: ReleaseCapture(); return 0; case WM_MOUSEMOVE: //if the left button is down if(GetKeyState(VK_LBUTTON) & 0x8000) { RECT rc; GetClientRect(hWnd, &rc); //don't do anything if we are already at the minimum size if((g_uPosition == MIN_SIZE) && (LOWORD(lParam) <= MIN_SIZE)) break; //don't do anything if we are already at the maximum size if(((rc.right - g_uPosition) == MIN_SIZE) && (LOWORD(lParam) >= g_uPosition)) break; g_uPosition = LOWORD(lParam); //check for min and max if(g_uPosition < MIN_SIZE) g_uPosition = MIN_SIZE; if((rc.right - g_uPosition) < MIN_SIZE) g_uPosition = rc.right - MIN_SIZE; Main_SizeChildren(hWnd); } break; case WM_COMMAND: return Main_OnCommand(hWnd, wParam, lParam); case WM_DESTROY: //tell the list to release its current folder List_ReleaseCurrentFolder(); PostQuitMessage(0); break; case WM_NCDESTROY: g_pMalloc->Release(); g_pMalloc = NULL; break; case WM_SYSCOLORCHANGE: { HBRUSH hbr = GetSysColorBrush(COLOR_3DFACE); hbr = (HBRUSH)SetClassLongPtr(hWnd, GCLP_HBRBACKGROUND, (LONG_PTR)hbr); if(hbr) DeleteObject(hbr); } break; case WM_INITMENUPOPUP: Main_UpdateMenu(hWnd, (HMENU)wParam); //fall through case WM_DRAWITEM: case WM_MENUCHAR: case WM_MEASUREITEM: if(g_pcm2) { g_pcm2->HandleMenuMsg(uMessage, wParam, lParam); } break; case WM_CONTEXTMENU: { POINT ptScreen; POINT ptClient; ptScreen.x = GET_X_LPARAM(lParam); ptScreen.y = GET_Y_LPARAM(lParam); ptClient = ptScreen; ScreenToClient(hWnd, &ptClient); HWND hwndOver = ChildWindowFromPoint(hWnd, ptClient); if(GetDlgItem(hWnd, IDC_TREEVIEW) == hwndOver) { Tree_DoContextMenu(hwndOver, &ptScreen); } else if(GetDlgItem(hWnd, IDC_LISTVIEW) == hwndOver) { List_DoContextMenu(hwndOver, &ptScreen); } } break; default: break; } return DefWindowProc(hWnd, uMessage, wParam, lParam); }
bool CConEmuInside::TurnExplorerTipPane(wchar_t (&szAddMsg)[128]) { bool bRepeat = false; int nBtn = IDCANCEL; DWORD_PTR nRc; LRESULT lSendRc; if (gnOsVer < 0x600) { // WinXP, Win2k3 nBtn = IDYES; // MessageBox(L"Tip pane is not found in Explorer window!\nThis pane is required for 'ConEmu Inside' mode.\nDo you want to show this pane?", MB_ICONQUESTION|MB_YESNO); if (nBtn == IDYES) { #if 0 HWND hWorker = GetDlgItem(mh_InsideParentRoot, 0xA005); #ifdef _DEBUG if (hWorker) { HWND hReBar = FindWindowEx(hWorker, NULL, L"ReBarWindow32", NULL); if (hReBar) { POINT pt = {4,4}; HWND hTool = ChildWindowFromPoint(hReBar, pt); if (hTool) { //TBBUTTON tb = {}; //lSendRc = SendMessageTimeout(mh_InsideParentRoot, TB_GETBUTTON, 2, (LPARAM)&tb, SMTO_NOTIMEOUTIFNOTHUNG, 500, &nRc); //if (tb.idCommand) //{ // NMTOOLBAR nm = {{hTool, 0, TBN_DROPDOWN}, 32896/*tb.idCommand*/}; // lSendRc = SendMessageTimeout(mh_InsideParentRoot, WM_NOTIFY, 0, (LPARAM)&nm, SMTO_NOTIMEOUTIFNOTHUNG, 500, &nRc); //} lSendRc = SendMessageTimeout(mh_InsideParentRoot, WM_COMMAND, 32896, 0, SMTO_NOTIMEOUTIFNOTHUNG, 500, &nRc); } } } // There is no way to force "Tip pane" in WinXP // if popup menu "View -> Explorer bar" was not _shown_ at least once // In that case, Explorer ignores WM_COMMAND(41536) and does not reveal tip pane. HMENU hMenu1 = GetMenu(mh_InsideParentRoot), hMenu2 = NULL, hMenu3 = NULL; if (hMenu1) { hMenu2 = GetSubMenu(hMenu1, 2); //if (!hMenu2) //{ // lSendRc = SendMessageTimeout(mh_InsideParentRoot, WM_MENUSELECT, MAKELONG(2,MF_POPUP), (LPARAM)hMenu1, SMTO_NOTIMEOUTIFNOTHUNG, 1500, &nRc); // hMenu2 = GetSubMenu(hMenu1, 2); //} if (hMenu2) { hMenu3 = GetSubMenu(hMenu2, 2); } } #endif #endif //INPUT keys[4] = {INPUT_KEYBOARD,INPUT_KEYBOARD,INPUT_KEYBOARD,INPUT_KEYBOARD}; //keys[0].ki.wVk = VK_F10; keys[0].ki.dwFlags = 0; //keys[0].ki.wScan = MapVirtualKey(VK_F10,MAPVK_VK_TO_VSC); //keys[1].ki.wVk = VK_F10; keys[1].ki.dwFlags = KEYEVENTF_KEYUP; //keys[0].ki.wScan = MapVirtualKey(VK_F10,MAPVK_VK_TO_VSC); //keys[1].ki.wVk = 'V'; //keys[2].ki.wVk = 'E'; //keys[3].ki.wVk = 'T'; //LRESULT lSentRc = 0; //SetForegroundWindow(mh_InsideParentRoot); //LRESULT lSentRc = SendInput(2/*countof(keys)*/, keys, sizeof(keys[0])); //lSentRc = SendMessageTimeout(mh_InsideParentRoot, WM_SYSKEYUP, 'V', 0, SMTO_NOTIMEOUTIFNOTHUNG, 5000, &nRc); lSendRc = SendMessageTimeout(mh_InsideParentRoot, WM_COMMAND, EMID_TIPOFDAY/*41536*/, 0, SMTO_NOTIMEOUTIFNOTHUNG, 5000, &nRc); UNREFERENCED_PARAMETER(lSendRc); mb_InsidePaneWasForced = true; // Подготовим сообщение если не удастся wcscpy_c(szAddMsg, L"Forcing Explorer to show Tip pane failed.\nShow pane yourself and recall ConEmu.\n\n"); } } if (nBtn == IDYES) { // Первая проверка mh_InsideParentWND = mh_InsideParentRel = NULL; m_InsideIntegration = ii_Auto; InsideFindShellView(mh_InsideParentRoot); if (mh_InsideParentWND && mh_InsideParentRel) { bRepeat = true; goto wrap; } // Если не нашли - задержка и повторная проверка Sleep(500); mh_InsideParentWND = mh_InsideParentRel = NULL; m_InsideIntegration = ii_Auto; InsideFindShellView(mh_InsideParentRoot); if (mh_InsideParentWND && mh_InsideParentRel) { bRepeat = true; goto wrap; } // Last chance - try to post key sequence "F10 Left Left Down Down Down Left" // This will opens popup menu containing "Tip of the day" menuitem // "Esc Esc Esc" it and post {WM_COMMAND,EMID_TIPOFDAY} again WORD vkPostKeys[] = {VK_ESCAPE, VK_ESCAPE, VK_ESCAPE, VK_RIGHT, VK_RIGHT, VK_RIGHT, VK_DOWN, VK_DOWN, VK_DOWN, VK_RIGHT, VK_ESCAPE, VK_ESCAPE, VK_ESCAPE, 0}; // Go if (SendVkKeySequence(mh_InsideParentRoot, vkPostKeys)) { // Try again (Tip of the day) lSendRc = SendMessageTimeout(mh_InsideParentRoot, WM_COMMAND, EMID_TIPOFDAY/*41536*/, 0, SMTO_NOTIMEOUTIFNOTHUNG, 5000, &nRc); // Wait and check again Sleep(500); mh_InsideParentWND = mh_InsideParentRel = NULL; m_InsideIntegration = ii_Auto; InsideFindShellView(mh_InsideParentRoot); if (mh_InsideParentWND && mh_InsideParentRel) { bRepeat = true; goto wrap; } } } wrap: if (bRepeat) { mb_TipPaneWasShown = true; } return bRepeat; }
LRESULT splitter_window_impl::on_message(HWND wnd, UINT msg, WPARAM wp, LPARAM lp) { switch (msg) { case WM_NCCREATE: m_wnd = wnd; g_instances.add_item(this); break; case WM_CREATE: if (!g_count++) { g_font_menu_horizontal = uCreateMenuFont(); g_font_menu_vertical = uCreateMenuFont(true); } refresh_children(); break; case WM_DESTROY: destroy_children(); if (!--g_count) { g_font_menu_horizontal.release(); g_font_menu_vertical.release(); } break; case WM_NCDESTROY: g_instances.remove_item(this); m_wnd = NULL; break; case WM_SHOWWINDOW: if (wp == TRUE && lp == 0) { unsigned n, count = m_panels.get_count(); for (n = 0; n<count; n++) { ShowWindow(m_panels[n]->m_wnd_child, SW_SHOWNORMAL); ShowWindow(m_panels[n]->m_wnd, SW_SHOWNORMAL); } RedrawWindow(wnd, 0, 0, RDW_UPDATENOW | RDW_ALLCHILDREN); } break; case WM_WINDOWPOSCHANGED: { LPWINDOWPOS lpwp = (LPWINDOWPOS)lp; if (!(lpwp->flags & SWP_NOSIZE)) { on_size_changed(lpwp->cx, lpwp->cy); } } break; /*case WM_SIZE: on_size_changed(LOWORD(lp), HIWORD(lp)); break;*/ case WM_GETMINMAXINFO: { LPMINMAXINFO lpmmi = (LPMINMAXINFO)lp; lpmmi->ptMinTrackSize.y = 0; lpmmi->ptMinTrackSize.x = 0; lpmmi->ptMaxTrackSize.y = get_orientation() == vertical ? 0 : MAXLONG; lpmmi->ptMaxTrackSize.x = get_orientation() == horizontal ? 0 : MAXLONG; unsigned n, count = m_panels.get_count(); bool b_found = false; for (n = 0; n<count; n++) { MINMAXINFO mmi; memset(&mmi, 0, sizeof(MINMAXINFO)); mmi.ptMaxTrackSize.x = MAXLONG; mmi.ptMaxTrackSize.y = MAXLONG; if (m_panels[n]->m_wnd_child) { b_found = true; unsigned divider_size = get_panel_divider_size(n); unsigned caption_height = m_panels[n]->m_show_caption ? g_get_caption_size() : 0; if (m_panels[n]->m_hidden) { if (get_orientation() == horizontal) { if (m_panels[n]->m_caption_orientation == vertical) { mmi.ptMinTrackSize.x = caption_height; mmi.ptMaxTrackSize.x = caption_height; } } else { if (m_panels[n]->m_caption_orientation == horizontal) { mmi.ptMinTrackSize.y = caption_height; mmi.ptMaxTrackSize.y = caption_height; } } } else { SendMessage(m_panels[n]->m_wnd_child, WM_GETMINMAXINFO, 0, (LPARAM)&mmi); if (caption_height) { if (m_panels[n]->m_caption_orientation == horizontal) { mmi.ptMinTrackSize.y += caption_height; if (mmi.ptMaxTrackSize.y < MAXLONG - (long)caption_height) mmi.ptMaxTrackSize.y += caption_height; else mmi.ptMaxTrackSize.y = MAXLONG; } else { mmi.ptMinTrackSize.x += caption_height; if (mmi.ptMaxTrackSize.x < MAXLONG - (long)caption_height) mmi.ptMaxTrackSize.x += caption_height; else mmi.ptMaxTrackSize.x = MAXLONG; } } } if (m_panels[n]->m_show_toggle_area && !m_panels[n]->m_autohide) { mmi.ptMinTrackSize.x++; if (mmi.ptMaxTrackSize.x < MAXLONG) mmi.ptMaxTrackSize.x++; } if (get_orientation() == vertical) { lpmmi->ptMinTrackSize.y += mmi.ptMinTrackSize.y + divider_size; lpmmi->ptMinTrackSize.x = max(mmi.ptMinTrackSize.x, lpmmi->ptMinTrackSize.x); if (lpmmi->ptMaxTrackSize.y <= MAXLONG - mmi.ptMaxTrackSize.y && lpmmi->ptMaxTrackSize.y + mmi.ptMaxTrackSize.y <= MAXLONG - (long)divider_size) { lpmmi->ptMaxTrackSize.y += mmi.ptMaxTrackSize.y + divider_size; } else { lpmmi->ptMaxTrackSize.y = MAXLONG; } lpmmi->ptMaxTrackSize.x = min(mmi.ptMaxTrackSize.x, lpmmi->ptMaxTrackSize.x); } else { lpmmi->ptMinTrackSize.x += mmi.ptMinTrackSize.x + divider_size; lpmmi->ptMinTrackSize.y = max(mmi.ptMinTrackSize.y, lpmmi->ptMinTrackSize.y); if (lpmmi->ptMaxTrackSize.x <= MAXLONG - mmi.ptMaxTrackSize.x && lpmmi->ptMaxTrackSize.x + mmi.ptMaxTrackSize.x <= MAXLONG - (long)divider_size) { lpmmi->ptMaxTrackSize.x += mmi.ptMaxTrackSize.x + divider_size; } else { lpmmi->ptMaxTrackSize.x = MAXLONG; } lpmmi->ptMaxTrackSize.y = min(mmi.ptMaxTrackSize.y, lpmmi->ptMaxTrackSize.y); } } } if (b_found) { if (get_orientation() == vertical) lpmmi->ptMaxTrackSize.x = max(lpmmi->ptMaxTrackSize.x, lpmmi->ptMinTrackSize.x); else lpmmi->ptMaxTrackSize.y = max(lpmmi->ptMaxTrackSize.y, lpmmi->ptMinTrackSize.y); } else { if (get_orientation() == vertical) lpmmi->ptMaxTrackSize.y = MAXLONG; else lpmmi->ptMaxTrackSize.x = MAXLONG; } if (0) { lpmmi->ptMinTrackSize.y = 0; if (get_orientation() == horizontal) lpmmi->ptMaxTrackSize.x = 0; lpmmi->ptMinTrackSize.x = 0; if (get_orientation() == vertical) lpmmi->ptMaxTrackSize.y = 0; } } return 0; case WM_MOUSEHOVER: { POINT pt = { GET_X_LPARAM(lp), GET_Y_LPARAM(lp) }; HWND child = RealChildWindowFromPoint(wnd, pt); if (child == wnd) { unsigned p_panel = -1; bool b_have_next = false; bool b_on_divider = false; b_on_divider = find_by_divider_pt(pt, p_panel); if (b_on_divider) { if (p_panel < m_panels.get_count()) { b_have_next = (p_panel + 1 < m_panels.get_count()); } if (is_index_valid(p_panel)) start_autohide_dehide(p_panel); } } } break; case WM_LBUTTONDOWN: case WM_MOUSEMOVE: { if (m_panels.get_count()) { POINT pt = { GET_X_LPARAM(lp), GET_Y_LPARAM(lp) }; HWND child = RealChildWindowFromPoint(wnd, pt); if (child == wnd) { unsigned p_panel = -1; bool b_have_next = false; bool b_on_divider = false; if (m_panel_dragging_valid) { b_on_divider = true; p_panel = m_panel_dragging; } else b_on_divider = find_by_divider_pt(pt, p_panel); if (b_on_divider) { if (p_panel < m_panels.get_count()) { b_have_next = (p_panel + 1 < m_panels.get_count()); } if (msg == WM_MOUSEMOVE && ((is_index_valid(p_panel) && m_panels[p_panel]->m_autohide) || (b_have_next && m_panels[p_panel + 1]->m_autohide))) { if (cfg_sidebar_use_custom_show_delay && !cfg_sidebar_show_delay) { if ((is_index_valid(p_panel))) { start_autohide_dehide(p_panel); } } else { TRACKMOUSEEVENT tme; memset(&tme, 0, sizeof(TRACKMOUSEEVENT)); tme.cbSize = sizeof(TRACKMOUSEEVENT); tme.dwFlags = TME_QUERY; tme.hwndTrack = wnd; _TrackMouseEvent(&tme); if (!(tme.dwFlags & TME_HOVER)) { memset(&tme, 0, sizeof(TRACKMOUSEEVENT)); tme.cbSize = sizeof(TRACKMOUSEEVENT); tme.hwndTrack = wnd; tme.dwHoverTime = cfg_sidebar_use_custom_show_delay ? cfg_sidebar_show_delay : HOVER_DEFAULT; tme.dwFlags = TME_HOVER; _TrackMouseEvent(&tme); } } } } if (b_on_divider && is_index_valid(p_panel) && can_resize_divider(p_panel)) { SetCursor(LoadCursor(0, get_orientation() == horizontal ? IDC_SIZEWE : IDC_SIZENS)); if (msg == WM_LBUTTONDOWN) { save_sizes(); m_panel_dragging = p_panel; SetCapture(wnd); m_last_position = (get_orientation() == vertical ? pt.y : pt.x); m_panel_dragging_valid = true; } } else { if (!(wp & MK_LBUTTON)) SetCursor(LoadCursor(0, IDC_ARROW)); m_panel_dragging_valid = false; } } if (m_panel_dragging_valid && wp & MK_LBUTTON && is_index_valid(m_panel_dragging)) { int new_height = m_last_position - (get_orientation() == vertical ? pt.y : pt.x); int delta = (get_orientation() == vertical ? pt.y : pt.x) - m_last_position; //console::formatter() << "before or: pt = " << pt.y << "," << pt.x << " lastpos: " << m_last_position << " enddelta: " << delta; auto & p_panel = m_panels[m_panel_dragging]; if (p_panel->m_hidden && delta) { p_panel->m_hidden = false; p_panel->m_size = 0; get_host()->on_size_limit_change(get_wnd(), uie::size_limit_all); } int delta_changed = override_size(m_panel_dragging, delta); m_last_position = (get_orientation() == vertical ? pt.y : pt.x) + delta_changed; on_size_changed(); if (delta + delta_changed) start_autohide_dehide(m_panel_dragging); } } //msg_last = msg; //lp_last = lp; //wp_last = wp; } break; case WM_LBUTTONDBLCLK: { POINT pt = { GET_X_LPARAM(lp), GET_Y_LPARAM(lp) }; HWND child = ChildWindowFromPoint(wnd, pt); if (child == wnd) { unsigned p_panel = -1; if (find_by_divider_pt(pt, p_panel) && is_index_valid(p_panel)) { bool b_have_next = is_index_valid(p_panel + 1); if (m_panels[p_panel]->m_locked && !m_panels[p_panel]->m_autohide && (!b_have_next || !m_panels[p_panel + 1]->m_locked)) { m_panels[p_panel]->m_hidden = !m_panels[p_panel]->m_hidden; get_host()->on_size_limit_change(get_wnd(), uie::size_limit_all); on_size_changed(); } else if (!m_panels[p_panel]->m_locked && b_have_next && m_panels[p_panel]->m_locked && !m_panels[p_panel]->m_autohide) { m_panels[p_panel + 1]->m_hidden = !m_panels[p_panel]->m_hidden; get_host()->on_size_limit_change(get_wnd(), uie::size_limit_all); on_size_changed(); } } } } break; case WM_LBUTTONUP: if (m_panel_dragging_valid) { m_panel_dragging_valid = false; if (GetCapture() == wnd) ReleaseCapture(); //SetCursor(LoadCursor(0, IDC_ARROW)); } break; #if 0 case WM_PAINT: { PAINTSTRUCT ps; BeginPaint(wnd, &ps); COLORREF cr = GetSysColor(COLOR_3DFACE); gdi_object_t<HBRUSH>::ptr_t br_line = CreateSolidBrush(/*RGB(226, 226, 226)*/cr); t_size n, count = m_panels.get_count(); for (n = 0; n + 1<count; n++) { pfc::refcounted_object_ptr_t<panel> p_item = m_panels.get_item(n); if (p_item->m_wnd_child) { RECT rc_area; GetRelativeRect(p_item->m_wnd_child, m_wnd, &rc_area); if (get_orientation() == vertical) { rc_area.top = rc_area.bottom; rc_area.bottom += 2; //FillRect(ps.hdc, &rc_area, GetSysColorBrush(COLOR_WINDOW)); //rc_area.top++; } else { rc_area.left = rc_area.right; rc_area.right += 2; //FillRect(ps.hdc, &rc_area, GetSysColorBrush(COLOR_WINDOW)); //rc_area.right--; } FillRect(ps.hdc, &rc_area, br_line); } } EndPaint(wnd, &ps); } ; #endif #if 0 case WM_CONTEXTMENU: if ((HWND)wp == wnd) { window_transparent_fill m_trans_fill; if (m_layout_editing_active) { RECT rc; GetRelativeRect(wnd, HWND_DESKTOP, &rc); ShowWindow(m_trans_fill.create(get_wnd(), 0, ui_helpers::window_position_t(rc)), SW_SHOWNORMAL); POINT pt = { GET_X_LPARAM(lp), GET_Y_LPARAM(lp) }; HMENU menu = CreatePopupMenu(); HMENU menu_add = CreatePopupMenu(); uie::window_info_list_simple panels; g_get_panel_list(panels); enum { ID_CLOSE = 1, ID_ADD_BASE = 2 }; g_append_menu_panels(menu_add, panels, ID_ADD_BASE); pfc::string8 temp; get_name(temp); uAppendMenu(menu, MF_STRING | MF_GRAYED, (UINT_PTR)0, temp); uAppendMenu(menu, MF_MENUBREAK, (UINT_PTR)0, NULL); AppendMenu(menu, MF_STRING | MF_POPUP, (UINT_PTR)menu_add, L"Add panel"); int cmd = TrackPopupMenu(menu, TPM_RIGHTBUTTON | TPM_NONOTIFY | TPM_RETURNCMD, pt.x, pt.y, 0, m_trans_fill.get_wnd(), 0); DestroyMenu(menu); m_trans_fill.destroy(); if (cmd) { if (cmd >= ID_ADD_BASE && cmd < panels.get_count() + ID_ADD_BASE) { pfc::refcounted_object_ptr_t<panel> ptr = new panel; ptr->m_guid = panels[cmd - ID_ADD_BASE].guid; m_panels.add_item(ptr); refresh_children(); get_host()->on_size_limit_change(get_wnd(), uie::size_limit_all); uie::splitter_window_v2_ptr sw2; if (ptr->m_child.is_valid() && ptr->m_child->service_query_t(sw2)) { sw2->enter_layout_editing_mode(); } } } } return 0; } break; #endif } return DefWindowProc(wnd, msg, wp, lp); }