本文整理汇总了C++中ClientToScreen函数的典型用法代码示例。如果您正苦于以下问题:C++ ClientToScreen函数的具体用法?C++ ClientToScreen怎么用?C++ ClientToScreen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ClientToScreen函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pt
void CAnimationEditorDlg::OnMouseMove(UINT nFlags, CPoint point)
{
//While the mouse is moving, this routine is called.
//This routine will redraw the drag image at the present
// mouse location to display the dragging.
//Also, while over a CListCtrl, this routine will highlight
// the item we are hovering over.
//// If we are in a drag/drop procedure (m_bDragging is true)
if (m_bDragging)
{
//// Move the drag image
CPoint pt(point); //get our current mouse coordinates
ClientToScreen(&pt); //convert to screen coordinates
m_pDragImage->DragMove(pt); //move the drag image to those coordinates
// Unlock window updates (this allows the dragging image to be shown smoothly)
m_pDragImage->DragShowNolock(false);
//// Get the CWnd pointer of the window that is under the mouse cursor
CWnd* pDropWnd = WindowFromPoint (pt);
ASSERT(pDropWnd); //make sure we have a window
//// If we drag outside current window we need to adjust the highlights displayed
if (pDropWnd != m_pDropWnd)
{
if (m_nDropIndex != -1) //If we drag over the CListCtrl header, turn off the hover highlight
{
TRACE("m_nDropIndex is -1\n");
CListCtrl* pList = (CListCtrl*)m_pDropWnd;
VERIFY (pList->SetItemState (m_nDropIndex, 0, LVIS_DROPHILITED));
// redraw item
VERIFY (pList->RedrawItems (m_nDropIndex, m_nDropIndex));
pList->UpdateWindow ();
m_nDropIndex = -1;
}
else //If we drag out of the CListCtrl altogether
{
TRACE("m_nDropIndex is not -1\n");
CListCtrl* pList = (CListCtrl*)m_pDropWnd;
int i = 0;
int nCount = pList->GetItemCount();
for(i = 0; i < nCount; i++)
{
pList->SetItemState(i, 0, LVIS_DROPHILITED);
}
pList->RedrawItems(0, nCount);
pList->UpdateWindow();
}
}
// Save current window pointer as the CListCtrl we are dropping onto
m_pDropWnd = pDropWnd;
// Convert from screen coordinates to drop target client coordinates
pDropWnd->ScreenToClient(&pt);
//If we are hovering over a CListCtrl we need to adjust the highlights
if(pDropWnd->IsKindOf(RUNTIME_CLASS (CListCtrl)))
{
//Note that we can drop here
SetCursor(LoadCursor(NULL, IDC_ARROW));
UINT uFlags;
CListCtrl* pList = (CListCtrl*)pDropWnd;
// Turn off hilight for previous drop target
pList->SetItemState (m_nDropIndex, 0, LVIS_DROPHILITED);
// Redraw previous item
pList->RedrawItems (m_nDropIndex, m_nDropIndex);
// Get the item that is below cursor
m_nDropIndex = ((CListCtrl*)pDropWnd)->HitTest(pt, &uFlags);
// Highlight it
if(m_nDropIndex >= 0)
pList->SetItemState(m_nDropIndex, LVIS_DROPHILITED, LVIS_DROPHILITED);
// Redraw item
pList->RedrawItems(m_nDropIndex, m_nDropIndex);
pList->UpdateWindow();
}
else
{
//If we are not hovering over a CListCtrl, change the cursor
// to note that we cannot drop here
SetCursor(LoadCursor(NULL, IDC_NO));
}
// Lock window updates
m_pDragImage->DragShowNolock(true);
}
CDialog::OnMouseMove(nFlags, point);
}
示例2: PaintDefaultIMEWnd
/*****
* Internal functions to help with IME window management
*/
static void PaintDefaultIMEWnd(HIMC hIMC, HWND hwnd)
{
PAINTSTRUCT ps;
RECT rect;
HDC hdc;
LPCOMPOSITIONSTRING compstr;
LPBYTE compdata = NULL;
HMONITOR monitor;
MONITORINFO mon_info;
INT offX=0, offY=0;
LPINPUTCONTEXT lpIMC;
lpIMC = LockRealIMC(hIMC);
if (lpIMC == NULL)
return;
hdc = BeginPaint(hwnd,&ps);
GetClientRect(hwnd,&rect);
FillRect(hdc, &rect, (HBRUSH)(COLOR_WINDOW + 1));
compdata = ImmLockIMCC(lpIMC->hCompStr);
compstr = (LPCOMPOSITIONSTRING)compdata;
if (compstr->dwCompStrLen && compstr->dwCompStrOffset)
{
SIZE size;
POINT pt;
HFONT oldfont = NULL;
LPWSTR CompString;
LPIMEPRIVATE myPrivate;
CompString = (LPWSTR)(compdata + compstr->dwCompStrOffset);
myPrivate = ImmLockIMCC(lpIMC->hPrivate);
if (myPrivate->textfont)
oldfont = SelectObject(hdc,myPrivate->textfont);
ImmUnlockIMCC(lpIMC->hPrivate);
GetTextExtentPoint32W(hdc, CompString, compstr->dwCompStrLen, &size);
pt.x = size.cx;
pt.y = size.cy;
LPtoDP(hdc,&pt,1);
/*
* How this works based on tests on windows:
* CFS_POINT: then we start our window at the point and grow it as large
* as it needs to be for the string.
* CFS_RECT: we still use the ptCurrentPos as a starting point and our
* window is only as large as we need for the string, but we do not
* grow such that our window exceeds the given rect. Wrapping if
* needed and possible. If our ptCurrentPos is outside of our rect
* then no window is displayed.
* CFS_FORCE_POSITION: appears to behave just like CFS_POINT
* maybe because the default MSIME does not do any IME adjusting.
*/
if (lpIMC->cfCompForm.dwStyle != CFS_DEFAULT)
{
POINT cpt = lpIMC->cfCompForm.ptCurrentPos;
ClientToScreen(lpIMC->hWnd,&cpt);
rect.left = cpt.x;
rect.top = cpt.y;
rect.right = rect.left + pt.x;
rect.bottom = rect.top + pt.y;
monitor = MonitorFromPoint(cpt, MONITOR_DEFAULTTOPRIMARY);
}
else /* CFS_DEFAULT */
{
/* Windows places the default IME window in the bottom left */
HWND target = lpIMC->hWnd;
if (!target) target = GetFocus();
GetWindowRect(target,&rect);
rect.top = rect.bottom;
rect.right = rect.left + pt.x + 20;
rect.bottom = rect.top + pt.y + 20;
offX=offY=10;
monitor = MonitorFromWindow(target, MONITOR_DEFAULTTOPRIMARY);
}
if (lpIMC->cfCompForm.dwStyle == CFS_RECT)
{
RECT client;
client =lpIMC->cfCompForm.rcArea;
MapWindowPoints( lpIMC->hWnd, 0, (POINT *)&client, 2 );
IntersectRect(&rect,&rect,&client);
/* TODO: Wrap the input if needed */
}
if (lpIMC->cfCompForm.dwStyle == CFS_DEFAULT)
{
/* make sure we are on the desktop */
mon_info.cbSize = sizeof(mon_info);
GetMonitorInfoW(monitor, &mon_info);
if (rect.bottom > mon_info.rcWork.bottom)
//.........这里部分代码省略.........
示例3: MsgBoxProc
//.........这里部分代码省略.........
}
// increase width if info text requires more
if ((pMsgBox->uType&MB_INFOBAR) && pMsgBox->ptszInfoText && *pMsgBox->ptszInfoText) {
int multiline = 0;
RECT rcico; GetClientRect(GetDlgItem(hDlg, ICO_DLGLOGO), &rcico);
rcico.right = rcico.right * 100 / 66; // padding
for (rs = h = pMsgBox->ptszInfoText;; ++h) {
if (*h == '\n' || !*h) {
GetTextExtentPoint32(hDC, rs, h - rs, &ts);
ts.cx += rcico.right;
if (ts.cx > txtWidth)
txtWidth = ts.cx;
if (!*h)
break;
rs = h + 1;
++multiline;
}
}
if (!multiline)
SetWindowLongPtr(GetDlgItem(hDlg, TXT_NAME), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hDlg, TXT_NAME), GWL_STYLE) | SS_CENTERIMAGE);
}
ReleaseDC(hDlg, hDC);
// calc new dialog size
GetWindowRect(hDlg, &rcDlg);
GetWindowRect(GetDlgItem(hDlg, TXT_MESSAGE), &ws);
needX = txtWidth - (ws.right - ws.left) - icoWidth;
needY = max(0, txtHeight - (ws.bottom - ws.top) + 5);
rcDlg.left -= needX / 2; rcDlg.right += needX / 2;
rcDlg.top -= (needY - InfoBarHeight) / 2; rcDlg.bottom += (needY - InfoBarHeight) / 2;
// resize dialog window
MoveWindow(hDlg, rcDlg.left, rcDlg.top, rcDlg.right - rcDlg.left, rcDlg.bottom - rcDlg.top, FALSE);
ClientToScreen(hDlg, &mpt);
MoveCtrl(hDlg, STATIC_WHITERECT, -mpt.x, -mpt.y, needX, needY - InfoBarHeight);
MoveCtrl(hDlg, TXT_NAME, -mpt.x, -mpt.y, needX, 0);
MoveCtrl(hDlg, ICO_DLGLOGO, -mpt.x + needX, -mpt.y, 0, 0);
MoveCtrl(hDlg, ICO_MSGDLG, -mpt.x, -mpt.y - InfoBarHeight, 0, 0);
MoveCtrl(hDlg, TXT_MESSAGE, -mpt.x - icoWidth, -mpt.y - InfoBarHeight, needX, needY);
MoveCtrl(hDlg, STATIC_LINE2, -mpt.x, -mpt.y + needY - InfoBarHeight, needX, 0);
//
// Do pushbutton positioning
//
RECT rcOk, rcAll, rcNone, rcCancel;
// get button rectangles
GetWindowRect(GetDlgItem(hDlg, IDOK), &rcOk);
OffsetRect(&rcOk, -mpt.x, -mpt.y + needY - InfoBarHeight);
GetWindowRect(GetDlgItem(hDlg, IDALL), &rcAll);
OffsetRect(&rcAll, -mpt.x, -mpt.y + needY - InfoBarHeight);
GetWindowRect(GetDlgItem(hDlg, IDNONE), &rcNone);
OffsetRect(&rcNone, -mpt.x, -mpt.y + needY - InfoBarHeight);
GetWindowRect(GetDlgItem(hDlg, IDCANCEL), &rcCancel);
OffsetRect(&rcCancel, -mpt.x, -mpt.y + needY - InfoBarHeight);
LONG okWidth = rcOk.right - rcOk.left;
LONG allWidth = rcAll.right - rcAll.left;
LONG noneWidth = rcNone.right - rcNone.left;
LONG caWidth = rcCancel.right - rcCancel.left;
LONG dlgMid = (rcDlg.right - rcDlg.left) / 2;
示例4: OptionsProc
INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
{
switch(msg){
case WM_INITDIALOG:{
DWORD style;
g_opHdlg=hdlg;
bOptionsInit=TRUE;
TranslateDialogDefault(hdlg);
if(g_iButtonsCount!=db_get_b(NULL, PLGNAME,"ButtonsCount", 0))
{
LOGFONT logFont;
HFONT hFont;
bNeedRestart=TRUE;
EnableWindow(GetDlgItem(hdlg,IDC_BUTTONSLIST),FALSE);
EnableWindow(GetDlgItem(hdlg,IDC_BLISTADD),FALSE);
EnableWindow(GetDlgItem(hdlg,IDC_BLISTREMOVE),FALSE);
EnableWindow(GetDlgItem(hdlg,IDC_MENUTREE),FALSE);
EnableWindow(GetDlgItem(hdlg,IDC_MTREEADD),FALSE);
EnableWindow(GetDlgItem(hdlg,IDC_MTREEREMOVE),FALSE);
EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),FALSE);
EnableWindow(GetDlgItem(hdlg,IDC_BUTTONNAME),FALSE);
EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
EnableWindow(GetDlgItem(hdlg,IDC_MENUNAME),FALSE);
ShowWindow(GetDlgItem(hdlg,IDC_WARNING),SW_SHOW);
hFont = (HFONT)SendDlgItemMessage(hdlg, IDC_WARNING, WM_GETFONT, 0, 0);
GetObject(hFont, sizeof(logFont), &logFont);
logFont.lfWeight = FW_BOLD;
hFont = CreateFontIndirect(&logFont);
SendDlgItemMessage(hdlg, IDC_WARNING, WM_SETFONT, (WPARAM)hFont, 0);
break;
}
g_iOPButtonsCount=g_iButtonsCount;
hButtonsList=GetDlgItem(hdlg,IDC_BUTTONSLIST);
hMenuTree=GetDlgItem(hdlg,IDC_MENUTREE);
style = GetWindowLongPtr(hButtonsList,GWL_STYLE);
style |=TVS_NOHSCROLL;
SetWindowLongPtr(hButtonsList,GWL_STYLE, style);
style = GetWindowLongPtr(hMenuTree,GWL_STYLE);
style |=TVS_NOHSCROLL;
SetWindowLongPtr(hMenuTree,GWL_STYLE, style);
BuildButtonsList(hButtonsList);
if (!TreeView_GetCount(hButtonsList))
EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),FALSE);
mir_subclassWindow( GetDlgItem(hdlg,IDC_BUTTONNAME), EditSubclassProc);
mir_subclassWindow( GetDlgItem(hdlg,IDC_MENUNAME), EditSubclassProc);
EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE);
EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE);
EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE);
CheckDlgButton(hdlg,IDC_RAUTOSEND,(g_bRClickAuto=db_get_b(NULL,PLGNAME,"RClickAuto",0)) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hdlg,IDC_LAUTOSEND,(g_bLClickAuto=db_get_b(NULL,PLGNAME,"LClickAuto",0)) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hdlg,IDC_ENABLEQUICKMENU,(g_bQuickMenu=db_get_b(NULL, PLGNAME,"QuickMenu", 1)) ? BST_CHECKED : BST_UNCHECKED);
bOptionsInit=FALSE;
}break;
case WM_LBUTTONUP:
if(drag) {
TVHITTESTINFO hti;
HTREEITEM htiAfter=NULL;
ButtonData* bd=NULL;
TVITEM tvi;
RECT rc;
BYTE height;
BOOLEAN bAsChild = FALSE;
TreeView_SetInsertMark(hMenuTree, NULL, 0 );
ReleaseCapture();
SetCursor( LoadCursor( NULL, IDC_ARROW ));
hti.pt.x = ( SHORT )LOWORD( lparam );
hti.pt.y = ( SHORT )HIWORD( lparam );
ClientToScreen(hdlg,&hti.pt);
ScreenToClient(hMenuTree,&hti.pt);
TreeView_HitTest( hMenuTree, &hti );
if(TreeView_GetParent(hMenuTree,hti.hItem)&&TreeView_GetChild(hMenuTree,hDragItem))
break;
if(TreeView_GetChild(hMenuTree,hti.hItem)&&TreeView_GetChild(hMenuTree,hDragItem))
break;
if ( hti.flags & TVHT_ABOVE ) {
htiAfter = TVI_FIRST;
}
else
if ( hti.flags & ( TVHT_NOWHERE|TVHT_BELOW )) {
htiAfter = TVI_LAST;
}
else
//.........这里部分代码省略.........
示例5: CalendarProc
//.........这里部分代码省略.........
break;
case WM_RBUTTONDOWN:
case WM_LBUTTONDOWN:
{
POINT pt;
GetCursorPos(&pt);
m_iDay = (WORD)SelectDay(hDlg, &pt);
if (m_iDay == 0) {
return TRUE;
}
PaintCalc(hDlg);
if (uMsg == WM_RBUTTONDOWN) {
CString menu1, menu2, menu3, menu4;
if (fMealMap[m_iDay-1] == M000)
{
menu1.Format(_T("+Ôç²Í"));
menu2.Format(_T("+Îç²Í"));
menu3.Format(_T("+Íí²Í"));
menu4.Format(_T("*δ³Ô"));
}
else if (fMealMap[m_iDay-1] == M110)
{
menu1.Format(_T("-Ôç²Í"));
menu2.Format(_T("-Îç²Í"));
menu3.Format(_T("+Íí²Í"));
menu4.Format(_T("*ÔçÎç"));
}
else if (fMealMap[m_iDay-1] == M111)
{
menu1.Format(_T("-Ôç²Í"));
menu2.Format(_T("-Îç²Í"));
menu3.Format(_T("-Íí²Í"));
menu4.Format(_T("*È«³Ô"));
}
else if (fMealMap[m_iDay-1] == M100)
{
menu1.Format(_T("-Ôç²Í"));
menu2.Format(_T("+Îç²Í"));
menu3.Format(_T("+Íí²Í"));
menu4.Format(_T("*Ôç²Í"));
}
else if (fMealMap[m_iDay-1] == M010)
{
menu1.Format(_T("+Ôç²Í"));
menu2.Format(_T("-Îç²Í"));
menu3.Format(_T("+Íí²Í"));
menu4.Format(_T("*Îç²Í"));
}
else if (fMealMap[m_iDay-1] == M001)
{
menu1.Format(_T("+Ôç²Í"));
menu2.Format(_T("+Îç²Í"));
menu3.Format(_T("-Íí²Í"));
menu4.Format(_T("*Íí²Í"));
}
else if (fMealMap[m_iDay-1] == M101)
{
menu1.Format(_T("-Ôç²Í"));
menu2.Format(_T("+Îç²Í"));
menu3.Format(_T("-Íí²Í"));
menu4.Format(_T("*ÔçÍí"));
}
else if (fMealMap[m_iDay-1] == M011)
{
menu1.Format(_T("+Ôç²Í"));
menu2.Format(_T("-Îç²Í"));
menu3.Format(_T("-Íí²Í"));
menu4.Format(_T("*ÎçÍí"));
}
ClientToScreen(hDlg, &pt);
HMENU hMenu = CreatePopupMenu();
AppendMenu(hMenu, MF_STRING, IDM_EATZAC, menu1);
AppendMenu(hMenu, MF_STRING, IDM_EATWUC, menu2);
AppendMenu(hMenu, MF_STRING, IDM_EATWAC, menu3);
AppendMenu(hMenu, MF_STRING|MF_DISABLED|MF_GRAYED, IDM_EATNOW, menu4);
TrackPopupMenu(hMenu, TPM_RIGHTBUTTON, pt.x, pt.y, NULL, hDlg, NULL);
}
return TRUE;
}
break;
case WM_WINDOWPOSCHANGED:
PostMessage(hDlg, WM_SHOWCAL, 0, 0);
return TRUE;
break;
case WM_SHOWCAL:
PaintCalc(hDlg);
ShowMealData(hDlg);
return TRUE;
break;
case WM_CLOSE:
DestroyWindow(hDlg);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
}
return FALSE;
}
示例6: GetCellFromPt
void CBGridCtrl::OnLButtonDown(UINT nFlags, CPoint point)
{
HWND hOldFocusWnd = ::GetFocus();
nFlags=1;
BOOL m_IsSort=FALSE;
if(m_SortColumn!=-1)
m_IsSort=TRUE;
if(m_idCurrentCell.row>0)
m_CurrSortCell=m_idCurrentCell ;
m_CurrrSortClick=FALSE;
m_BeforeRow=m_idCurrentCell.row;
m_LeftClickDownPoint = point;
m_LeftClickDownCell = GetCellFromPt(point);
if (!IsValid(m_LeftClickDownCell)) return;
m_SelectionStartCell = (nFlags & MK_SHIFT)? m_idCurrentCell : m_LeftClickDownCell;
SetFocus();
if (m_LeftClickDownCell == m_idCurrentCell)
{
m_MouseMode = MOUSE_PREPARE_EDIT;
return;
} else {
SetFocusCell(-1,-1);
SetFocusCell(max(m_LeftClickDownCell.row, m_nFixedRows),
max(m_LeftClickDownCell.col, m_nFixedCols));//Do not modify the contents of this file.
}
if (m_bAllowDragAndDrop && hOldFocusWnd == GetSafeHwnd() &&
GetItemState(m_LeftClickDownCell.row, m_LeftClickDownCell.col) & GVNI_SELECTED)
{
m_MouseMode = MOUSE_PREPARE_DRAG;
return;
}
SetCapture();
// 股票列表视图的列变量定义,以及自定义列的表达式计算
if (m_MouseMode == MOUSE_OVER_COL_DIVIDE)
{
m_MouseMode = MOUSE_SIZING_COL;
CPoint start;
if (!GetCellOrigin(0, m_LeftClickDownCell.col, &start)) return;
CRect rect;
GetClientRect(rect);
CRect invertedRect(point.x, rect.top, point.x + 2, rect.bottom);
CDC* pDC = GetDC();
if (pDC) {
pDC->InvertRect(&invertedRect);
ReleaseDC(pDC);//Do not modify the contents of this file.
}
if (point.x - start.x <= m_nResizeCaptureRange)
if (!GetCellOrigin(0, --m_LeftClickDownCell.col, &start)) return;
rect.left = start.x;
ClientToScreen(rect);
ClipCursor(rect);
}
else if (m_MouseMode == MOUSE_OVER_ROW_DIVIDE)
{
m_MouseMode = MOUSE_SIZING_ROW;
CPoint start;
if (!GetCellOrigin(m_LeftClickDownCell, &start)) return;
CRect rect;
GetClientRect(rect);
CRect invertedRect(rect.left, point.y, rect.right, point.y + 2);
CDC* pDC = GetDC();
if (pDC) {
pDC->InvertRect(&invertedRect);
ReleaseDC(pDC);
}
if (point.y - start.y <= m_nResizeCaptureRange)
if (!GetCellOrigin(--m_LeftClickDownCell.row, 0, &start)) return;
rect.top = start.y;
ClientToScreen(rect);
ClipCursor(rect);//Do not modify the contents of this file.
}
else
{
if (m_LeftClickDownCell.row < GetFixedRowCount())
{
m_CurrrSortClick=TRUE;
OnFixedRowClick(m_LeftClickDownCell);// NOTE: the ClassWizard will add member functions here
}
//.........这里部分代码省略.........
示例7: User32DefWindowProc
LRESULT WINAPI
User32DefWindowProc(HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam,
BOOL bUnicode)
{
PWND pWnd = NULL;
if (hWnd)
{
pWnd = ValidateHwnd(hWnd);
if (!pWnd) return 0;
}
switch (Msg)
{
case WM_NCPAINT:
{
return DefWndNCPaint(hWnd, (HRGN)wParam, -1);
}
case WM_NCCALCSIZE:
{
return DefWndNCCalcSize(hWnd, (BOOL)wParam, (RECT*)lParam);
}
case WM_POPUPSYSTEMMENU:
{
/* This is an undocumented message used by the windows taskbar to
display the system menu of windows that belong to other processes. */
HMENU menu = GetSystemMenu(hWnd, FALSE);
if (menu)
TrackPopupMenu(menu, TPM_LEFTBUTTON|TPM_RIGHTBUTTON,
LOWORD(lParam), HIWORD(lParam), 0, hWnd, NULL);
return 0;
}
case WM_NCACTIVATE:
{
return DefWndNCActivate(hWnd, wParam, lParam);
}
case WM_NCHITTEST:
{
POINT Point;
Point.x = GET_X_LPARAM(lParam);
Point.y = GET_Y_LPARAM(lParam);
return (DefWndNCHitTest(hWnd, Point));
}
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_MBUTTONDOWN:
iF10Key = iMenuSysKey = 0;
break;
case WM_NCLBUTTONDOWN:
{
return (DefWndNCLButtonDown(hWnd, wParam, lParam));
}
case WM_LBUTTONDBLCLK:
return (DefWndNCLButtonDblClk(hWnd, HTCLIENT, lParam));
case WM_NCLBUTTONDBLCLK:
{
return (DefWndNCLButtonDblClk(hWnd, wParam, lParam));
}
case WM_NCRBUTTONDOWN:
return NC_HandleNCRButtonDown( hWnd, wParam, lParam );
case WM_RBUTTONUP:
{
POINT Pt;
Pt.x = GET_X_LPARAM(lParam);
Pt.y = GET_Y_LPARAM(lParam);
ClientToScreen(hWnd, &Pt);
lParam = MAKELPARAM(Pt.x, Pt.y);
if (bUnicode)
{
SendMessageW(hWnd, WM_CONTEXTMENU, (WPARAM)hWnd, lParam);
}
else
{
SendMessageA(hWnd, WM_CONTEXTMENU, (WPARAM)hWnd, lParam);
}
break;
}
case WM_NCRBUTTONUP:
/*
* FIXME : we must NOT send WM_CONTEXTMENU on a WM_NCRBUTTONUP (checked
* in Windows), but what _should_ we do? According to MSDN :
* "If it is appropriate to do so, the system sends the WM_SYSCOMMAND
* message to the window". When is it appropriate?
*/
break;
//.........这里部分代码省略.........
示例8: ClientToScreen
void CUIDesignerView::OnRButtonUp(UINT nFlags, CPoint point)
{
ClientToScreen(&point);
OnContextMenu(this, point);
}
示例9: PAGER_MouseMove
static LRESULT
PAGER_MouseMove (PAGER_INFO* infoPtr, INT keys, INT x, INT y)
{
POINT clpt, pt;
RECT wnrect;
BOOL topLeft = FALSE;
INT btnstate = 0;
INT hit;
HDC hdc;
pt.x = x;
pt.y = y;
TRACE("[%p] to (%d,%d)\n", infoPtr->hwndSelf, x, y);
ClientToScreen(infoPtr->hwndSelf, &pt);
GetWindowRect(infoPtr->hwndSelf, &wnrect);
if (PtInRect(&wnrect, pt)) {
RECT topleft, bottomright, *rect = NULL;
PAGER_GetButtonRects(infoPtr, &topleft, &bottomright, FALSE);
clpt = pt;
MapWindowPoints(0, infoPtr->hwndSelf, &clpt, 1);
hit = PAGER_HitTest(infoPtr, &clpt);
if ((hit == PGB_TOPORLEFT) && (infoPtr->TLbtnState == PGF_NORMAL))
{
topLeft = TRUE;
rect = &topleft;
infoPtr->TLbtnState = PGF_HOT;
btnstate = infoPtr->TLbtnState;
}
else if ((hit == PGB_BOTTOMORRIGHT) && (infoPtr->BRbtnState == PGF_NORMAL))
{
topLeft = FALSE;
rect = &bottomright;
infoPtr->BRbtnState = PGF_HOT;
btnstate = infoPtr->BRbtnState;
}
/* If in one of the buttons the capture and draw buttons */
if (rect)
{
TRACE("[%p] draw btn (%s), Capture %s, style %08x\n",
infoPtr->hwndSelf, wine_dbgstr_rect(rect),
(infoPtr->bCapture) ? "TRUE" : "FALSE",
infoPtr->dwStyle);
if (!infoPtr->bCapture)
{
TRACE("[%p] SetCapture\n", infoPtr->hwndSelf);
SetCapture(infoPtr->hwndSelf);
infoPtr->bCapture = TRUE;
}
if (infoPtr->dwStyle & PGS_AUTOSCROLL)
SetTimer(infoPtr->hwndSelf, TIMERID1, 0x3e, 0);
hdc = GetWindowDC(infoPtr->hwndSelf);
/* OffsetRect(wnrect, 0 | 1, 0 | 1) */
PAGER_DrawButton(hdc, infoPtr->clrBk, *rect,
infoPtr->dwStyle & PGS_HORZ, topLeft, btnstate);
ReleaseDC(infoPtr->hwndSelf, hdc);
return 0;
}
}
/* If we think we are captured, then do release */
if (infoPtr->bCapture && (WindowFromPoint(pt) != infoPtr->hwndSelf))
{
NMHDR nmhdr;
infoPtr->bCapture = FALSE;
if (GetCapture() == infoPtr->hwndSelf)
{
ReleaseCapture();
if (infoPtr->TLbtnState == PGF_GRAYED)
{
infoPtr->TLbtnState = PGF_INVISIBLE;
SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0,
SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE |
SWP_NOZORDER | SWP_NOACTIVATE);
}
else if (infoPtr->TLbtnState == PGF_HOT)
{
infoPtr->TLbtnState = PGF_NORMAL;
/* FIXME: just invalidate button rect */
RedrawWindow(infoPtr->hwndSelf, NULL, NULL, RDW_FRAME | RDW_INVALIDATE);
}
if (infoPtr->BRbtnState == PGF_GRAYED)
{
infoPtr->BRbtnState = PGF_INVISIBLE;
SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0,
SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE |
SWP_NOZORDER | SWP_NOACTIVATE);
}
else if (infoPtr->BRbtnState == PGF_HOT)
{
infoPtr->BRbtnState = PGF_NORMAL;
/* FIXME: just invalidate button rect */
RedrawWindow(infoPtr->hwndSelf, NULL, NULL, RDW_FRAME | RDW_INVALIDATE);
//.........这里部分代码省略.........
示例10: GetClientRect
void CResizeDlg::OnSize(UINT nType,int cx,int cy)
{
int nCount;
std::vector<CItemCtrl>::iterator it;
CDialog::OnSize(nType,cx,cy);
if((nCount = m_Items.size()) > 0) {
CRect cltRect;
GetClientRect(&cltRect);
ClientToScreen(cltRect);
HDWP hDWP;
int sizeType = WST_NONE;
#if 0
int deltaX = cltRect.Width() - m_cltRect.Width();
int deltaY = cltRect.Height()- m_cltRect.Height();
int midX = (cltRect.left + cltRect.right) / 2;
int midY = (cltRect.top + cltRect.bottom) / 2;
CPoint csrPt(::GetMessagePos());
if (deltaX) {
if (csrPt.x < midX)
sizeType |= WST_LEFT;
else
sizeType |= WST_RIGHT;
}
if (deltaY) {
if (csrPt.y < midY)
sizeType |= WST_TOP;
else
sizeType |= WST_BOTTOM;
}
#else
switch (m_nDelaySide) {
case WMSZ_BOTTOM:
sizeType = WST_BOTTOM;
break;
case WMSZ_BOTTOMLEFT:
sizeType = WST_BOTTOM|WST_LEFT;
break;
case WMSZ_BOTTOMRIGHT:
sizeType = WST_BOTTOM|WST_RIGHT;
break;
case WMSZ_LEFT:
sizeType = WST_LEFT;
break;
case WMSZ_RIGHT:
sizeType = WST_RIGHT;
break;
case WMSZ_TOP:
sizeType = WST_TOP;
break;
case WMSZ_TOPLEFT:
sizeType = WST_TOP|WST_LEFT;
break;
case WMSZ_TOPRIGHT:
sizeType = WST_TOP|WST_RIGHT;
break;
default:
break;
}
#endif
if (sizeType != WST_NONE) {
hDWP = ::BeginDeferWindowPos(nCount);
for (it = m_Items.begin(); it != m_Items.end(); it++)
hDWP = it->OnSize(hDWP, sizeType, &cltRect, &m_cltRect, &m_cltR0, this);
::EndDeferWindowPos(hDWP);
}
m_cltRect = cltRect;
}
m_nDelaySide = 0;
}
示例11: x11_copy_to_screen
/*****************************************************************************
* x11_copy_to_screen
*
* Helper function that blts the front buffer contents to the target window
*
* Params:
* This: Surface to copy from
* rc: Rectangle to copy
*
*****************************************************************************/
void x11_copy_to_screen(IWineD3DSwapChainImpl *This, const RECT *rc)
{
IWineD3DSurfaceImpl *front = This->front_buffer;
if(front->resource.usage & WINED3DUSAGE_RENDERTARGET) {
POINT offset = {0,0};
HWND hDisplayWnd;
HDC hDisplayDC;
HDC hSurfaceDC = 0;
RECT drawrect;
TRACE("(%p)->(%p): Copying to screen\n", front, rc);
hSurfaceDC = front->hDC;
hDisplayWnd = This->win_handle;
hDisplayDC = GetDCEx(hDisplayWnd, 0, DCX_CLIPSIBLINGS|DCX_CACHE);
if(rc) {
TRACE(" copying rect (%d,%d)->(%d,%d), offset (%d,%d)\n",
rc->left, rc->top, rc->right, rc->bottom, offset.x, offset.y);
}
/* Front buffer coordinates are screen coordinates. Map them to the destination
* window if not fullscreened
*/
if(This->presentParms.Windowed) {
ClientToScreen(hDisplayWnd, &offset);
}
#if 0
/* FIXME: This doesn't work... if users really want to run
* X in 8bpp, then we need to call directly into display.drv
* (or Wine's equivalent), and force a private colormap
* without default entries. */
if (front->palette) {
SelectPalette(hDisplayDC, front->palette->hpal, FALSE);
RealizePalette(hDisplayDC); /* sends messages => deadlocks */
}
#endif
drawrect.left = 0;
drawrect.right = front->currentDesc.Width;
drawrect.top = 0;
drawrect.bottom = front->currentDesc.Height;
#if 0
/* TODO: Support clippers */
if (front->clipper)
{
RECT xrc;
HWND hwnd = ((IWineD3DClipperImpl *) front->clipper)->hWnd;
if (hwnd && GetClientRect(hwnd,&xrc))
{
OffsetRect(&xrc,offset.x,offset.y);
IntersectRect(&drawrect,&drawrect,&xrc);
}
}
#endif
if (rc) {
IntersectRect(&drawrect,&drawrect,rc);
}
else {
/* Only use this if the caller did not pass a rectangle, since
* due to double locking this could be the wrong one ...
*/
if (front->lockedRect.left != front->lockedRect.right) {
IntersectRect(&drawrect,&drawrect,&front->lockedRect);
}
}
BitBlt(hDisplayDC,
drawrect.left-offset.x, drawrect.top-offset.y,
drawrect.right-drawrect.left, drawrect.bottom-drawrect.top,
hSurfaceDC,
drawrect.left, drawrect.top,
SRCCOPY);
ReleaseDC(hDisplayWnd, hDisplayDC);
}
}
示例12: ContactListSubclassProc
//.........这里部分代码省略.........
else {
TreeView_SetItemState(hWnd, hItem, 0, TVIS_SELECTED);
dat->SelectedItems.RemoveElem(nIndex);
}
dat->SelectGroups(hItem, nIndex == -1);
NMCLIST nm;
nm.hdr.code = MCLN_SELCHANGED;
nm.hdr.hwndFrom = hWnd;
nm.hdr.idFrom = GetDlgCtrlID(hWnd);
nm.OldSelection = &OldSelection;
nm.NewSelection = &dat->SelectedItems;
SendMessage(GetParent(hWnd), WM_NOTIFY, 0, (LPARAM)&nm);
return 0;
}
// if it was a click on the selected item and there's need to do something in this case, then send SELCHANGED notification by ourselves, as the tree control doesn't do anything
if (hItem == TreeView_GetSelection(hWnd) && (dat->SelectedItems.GetSize() != 1 || (dat->SelectedItems.GetSize() == 1 && dat->SelectedItems[0] != hItem))) {
TreeView_SetItemState(hWnd, hItem, TVIS_SELECTED, TVIS_SELECTED);
NMTREEVIEW nm = { 0 };
nm.hdr.code = TVN_SELCHANGED;
nm.hdr.hwndFrom = hWnd;
nm.hdr.idFrom = GetDlgCtrlID(hWnd);
nm.itemOld.hItem = TreeView_GetSelection(hWnd);
nm.itemOld.mask = TVIF_HANDLE | TVIF_STATE | TVIF_PARAM;
TreeView_GetItem(hWnd, &nm.itemOld);
nm.itemNew = nm.itemOld;
SendMessage(GetParent(hWnd), WM_NOTIFY, 0, (LPARAM)&nm);
}
}
}
break;
case WM_SETFOCUS:
case WM_KILLFOCUS:
for (int i = 0; i < dat->SelectedItems.GetSize(); i++) {
RECT rc;
if (TreeView_GetItemRect(hWnd, dat->SelectedItems[i], &rc, false))
InvalidateRect(hWnd, &rc, false);
}
break;
case WM_SIZE:
case WM_HSCROLL:
InvalidateRect(hWnd, NULL, false);
break;
case WM_MEASUREITEM:
if (!wParam) // if the message was sent by a menu
return Menu_MeasureItem((LPMEASUREITEMSTRUCT)lParam);
break;
case WM_DRAWITEM:
if (!wParam) // if the message was sent by a menu
return Menu_DrawItem((LPDRAWITEMSTRUCT)lParam);
break;
case WM_CONTEXTMENU:
{
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
HTREEITEM hItem = NULL;
if (pt.x == -1 && pt.y == -1) {
if (dat->SelectedItems.GetSize() == 1) {
hItem = dat->SelectedItems[0];
TreeView_EnsureVisible(hWnd, hItem);
RECT rc;
TreeView_GetItemRect(hWnd, hItem, &rc, true);
pt.x = rc.left;
pt.y = rc.bottom;
}
}
else {
DWORD hitFlags;
ScreenToClient(hWnd, &pt);
hItem = dat->HitTest(&pt, &hitFlags);
if (!(hitFlags & MCLCHT_ONITEM))
hItem = NULL;
}
if (hItem) {
MCONTACT hContact = dat->GetItemData(hItem).hContact;
if (IsHContactContact(hContact)) {
HMENU hMenu = Menu_BuildContactMenu(hContact);
if (hMenu) {
ClientToScreen(hWnd, &pt);
CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hWnd, NULL), MPCF_CONTACTMENU), hContact);
DestroyMenu(hMenu);
return 0;
}
}
}
}
break;
case WM_DESTROY:
if (dat->ExtraImageList)
ImageList_Destroy(dat->ExtraImageList);
dat->SelectedItems.RemoveAll();
dat->Items.RemoveAll();
break;
}
return CallWindowProc(dat->OrigTreeViewProc, hWnd, Msg, wParam, lParam);
}
示例13: GetClientRect
LRESULT CMainWindow::Splitter_OnLButtonUp(HWND hwnd, UINT /*iMsg*/, WPARAM /*wParam*/, LPARAM lParam)
{
HDC hdc;
RECT rect;
RECT clientrect;
POINT pt;
pt.x = (short)LOWORD(lParam); // horizontal position of cursor
pt.y = (short)HIWORD(lParam);
if (bDragMode == FALSE)
return 0;
GetClientRect(hwnd, &clientrect);
GetWindowRect(hwnd, &rect);
POINT zero = {0,0};
ClientToScreen(hwnd, &zero);
OffsetRect(&clientrect, zero.x-rect.left, zero.y-rect.top);
ClientToScreen(hwnd, &pt);
pt.x -= rect.left;
pt.y -= rect.top;
OffsetRect(&rect, -rect.left, -rect.top);
if (pt.x < 0)
pt.x = 0;
if (pt.x > rect.right-4)
pt.x = rect.right-4;
if (pt.y < 0)
pt.y = 0;
if (pt.y > rect.bottom-4)
pt.y = rect.bottom-4;
hdc = GetWindowDC(hwnd);
if (bVertical)
DrawXorBar(hdc, clientrect.left, oldy+2, clientrect.right-clientrect.left-2, 4);
else
DrawXorBar(hdc, oldx+2, clientrect.top, 4, clientrect.bottom-clientrect.top-2);
ReleaseDC(hwnd, hdc);
oldx = pt.x;
oldy = pt.y;
bDragMode = false;
//convert the splitter position back to screen coords.
GetWindowRect(hwnd, &rect);
pt.x += rect.left;
pt.y += rect.top;
//now convert into CLIENT coordinates
ScreenToClient(hwnd, &pt);
GetClientRect(hwnd, &rect);
#define MINWINSIZE 10
if (bVertical)
{
if (bDrag2)
{
if (pt.y < (nSplitterPos+MINWINSIZE))
pt.y = nSplitterPos+MINWINSIZE;
nSplitterPos2 = pt.y;
}
else
{
if (pt.y > (nSplitterPos2-MINWINSIZE))
pt.y = nSplitterPos2-MINWINSIZE;
nSplitterPos = pt.y;
}
}
else
{
if (bDrag2)
{
if (pt.x < (nSplitterPos+MINWINSIZE))
pt.x = nSplitterPos+MINWINSIZE;
nSplitterPos2 = pt.x;
}
else
{
if (pt.x > (nSplitterPos2-MINWINSIZE))
pt.x = nSplitterPos2-MINWINSIZE;
nSplitterPos = pt.x;
}
}
ReleaseCapture();
//position the child controls
PositionChildren(&rect);
return 0;
}
示例14: switch
//.........这里部分代码省略.........
break; }
case TVN_SELCHANGING: {
result = FALSE;
break; }
case TVN_BEGINDRAG: {
result = FALSE;
/*
if (m_currentDropObject != NULL) { //currently only one queued DnD op is supported
result = FALSE;
break;
}
NMTREEVIEW * pnmtv = (NMTREEVIEW*)lParam;
HTREEITEM hti = pnmtv->itemNew.hItem;
FileObject * fo = m_treeview.GetItemFileObject(hti);
if (fo != NULL) {
m_currentDropObject = fo;
m_dndWindow.Create(m_hwnd);
::PostMessage(m_dndWindow.GetHWND(), WM_DND, 0, 0);
result = TRUE;
}
*/
break; }
default: {
doDefaultProc = true;
break; }
}
} else if (nmh.hwndFrom == m_rebar.GetHWND()) {
switch(nmh.code) {
case RBN_CHEVRONPUSHED: {
NMREBARCHEVRON * lpnm = (NMREBARCHEVRON*) lParam;
POINT pt;
pt.x = lpnm->rc.left;//right;
pt.y = lpnm->rc.bottom;
ClientToScreen(m_rebar.GetHWND(), &pt);
m_toolbar.DoPopop(pt);
result = TRUE;
break; }
default: {
doDefaultProc = true;
break; }
}
} else {
switch(nmh.code) {
case TTN_GETDISPINFO: {
LPTOOLTIPTEXT lpttt = (LPTOOLTIPTEXT) lParam;
lpttt->hinst = NULL;
lpttt->lpszText = (TCHAR*)m_toolbar.GetTooltip(lpttt->hdr.idFrom);
result = TRUE;
break; }
default: {
doDefaultProc = true;
break; }
}
}
break; }
case WM_CONTEXTMENU: {
HWND hWinContext = (HWND)wParam;
HMENU hContext = NULL;
POINT menuPos;
menuPos.x = GET_X_LPARAM(lParam);
menuPos.y = GET_Y_LPARAM(lParam);
bool fromKeyboard = (menuPos.x == -1 && menuPos.y == -1);
if (fromKeyboard) { //keyboard activation
DWORD pos = GetMessagePos();
menuPos.x = GET_X_LPARAM(pos);
示例15: GetWindowLong
//.........这里部分代码省略.........
int index = ListView_HitTest ( nav->mTree, &info );
if ( index != -1 )
{
RECT rItem;
int offset;
ListView_GetItemRect ( nav->mTree, index, &rItem, LVIR_BOUNDS );
LVITEM item;
item.mask = LVIF_PARAM;
item.iItem = index;
ListView_GetItem ( nav->mTree, &item );
idWindow* window = (idWindow*)item.lParam;
rvGEWindowWrapper* wrapper = rvGEWindowWrapper::GetWrapper(window);
offset = wrapper->GetDepth ( ) * 10 + 1;
if ( info.pt.x < GENAV_ITEMHEIGHT )
{
if ( !rvGEWindowWrapper::GetWrapper(window)->IsHidden ( ) )
{
nav->mWorkspace->HideWindow ( window );
}
else
{
nav->mWorkspace->UnhideWindow ( window );
}
}
else if ( info.pt.x > GENAV_ITEMHEIGHT + offset && info.pt.x < GENAV_ITEMHEIGHT + offset + 16 )
{
if ( wrapper->CanHaveChildren ( ) && window->GetChildCount ( ) )
{
if ( wrapper->IsExpanded ( ) )
{
wrapper->Collapse ( );
nav->Update ( );
}
else
{
wrapper->Expand ( );
nav->Update ( );
}
}
}
else if ( nh->code == NM_DBLCLK )
{
SendMessage ( gApp.GetMDIFrame ( ), WM_COMMAND, MAKELONG(ID_GUIED_ITEM_PROPERTIES,0), 0 );
}
}
break;
}
case NM_RCLICK:
{
DWORD dwpos = GetMessagePos();
LVHITTESTINFO info;
info.pt.x = LOWORD(dwpos);
info.pt.y = HIWORD(dwpos);
MapWindowPoints(HWND_DESKTOP, nh->hwndFrom, &info.pt, 1);
int index = ListView_HitTest ( nav->mTree, &info );
if ( index != -1 )
{
ClientToScreen ( hWnd, &info.pt );
HMENU menu = GetSubMenu ( LoadMenu ( gApp.GetInstance(), MAKEINTRESOURCE(IDR_GUIED_ITEM_POPUP) ), 0 );
TrackPopupMenu ( menu, TPM_RIGHTBUTTON|TPM_LEFTALIGN, info.pt.x, info.pt.y, 0, gApp.GetMDIFrame ( ), NULL );
DestroyMenu ( menu );
}
break;
}
case LVN_ITEMCHANGED:
{
NMLISTVIEW* nml = (NMLISTVIEW*) nh;
if ( (nml->uNewState & LVIS_SELECTED) != (nml->uOldState & LVIS_SELECTED) )
{
LVITEM item;
item.iItem = nml->iItem;
item.mask = LVIF_PARAM;
ListView_GetItem ( nav->mTree, &item );
if ( nml->uNewState & LVIS_SELECTED )
{
nav->mWorkspace->GetSelectionMgr().Add ( (idWindow*)item.lParam, false );
}
else
{
nav->mWorkspace->GetSelectionMgr().Remove ( (idWindow*)item.lParam );
}
}
break;
}
}
break;
}
}
return DefWindowProc ( hWnd, msg, wParam, lParam );
}