• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ MoveWindow函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中MoveWindow函数的典型用法代码示例。如果您正苦于以下问题:C++ MoveWindow函数的具体用法?C++ MoveWindow怎么用?C++ MoveWindow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了MoveWindow函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: MainDlgProc

/*
 * Dialog-box function for the main PuTTYgen dialog box.
 */
static int CALLBACK MainDlgProc(HWND hwnd, UINT msg,
				WPARAM wParam, LPARAM lParam)
{
    static const char generating_msg[] =
	"Please wait while a key is generated...";
    static const char entropy_msg[] =
	"Please generate some randomness by moving the mouse over the blank area.";
    struct MainDlgState *state;

    switch (msg) {
      case WM_INITDIALOG:
        if (has_help())
            SetWindowLongPtr(hwnd, GWL_EXSTYLE,
			     GetWindowLongPtr(hwnd, GWL_EXSTYLE) |
			     WS_EX_CONTEXTHELP);
        else {
            /*
             * If we add a Help button, this is where we destroy it
             * if the help file isn't present.
             */
        }
	SendMessage(hwnd, WM_SETICON, (WPARAM) ICON_BIG,
		    (LPARAM) LoadIcon(hinst, MAKEINTRESOURCE(200)));

	state = snew(struct MainDlgState);
	state->generation_thread_exists = FALSE;
	state->collecting_entropy = FALSE;
	state->entropy = NULL;
	state->key_exists = FALSE;
	SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) state);
	{
	    HMENU menu, menu1;

	    menu = CreateMenu();

	    menu1 = CreateMenu();
	    AppendMenu(menu1, MF_ENABLED, IDC_LOAD, "&Load private key");
	    AppendMenu(menu1, MF_ENABLED, IDC_SAVEPUB, "Save p&ublic key");
	    AppendMenu(menu1, MF_ENABLED, IDC_SAVE, "&Save private key");
	    AppendMenu(menu1, MF_SEPARATOR, 0, 0);
	    AppendMenu(menu1, MF_ENABLED, IDC_QUIT, "E&xit");
	    AppendMenu(menu, MF_POPUP | MF_ENABLED, (UINT) menu1, "&File");
	    state->filemenu = menu1;

	    menu1 = CreateMenu();
	    AppendMenu(menu1, MF_ENABLED, IDC_GENERATE, "&Generate key pair");
	    AppendMenu(menu1, MF_SEPARATOR, 0, 0);
	    AppendMenu(menu1, MF_ENABLED, IDC_KEYSSH1, "SSH-&1 key (RSA)");
	    AppendMenu(menu1, MF_ENABLED, IDC_KEYSSH2RSA, "SSH-2 &RSA key");
	    AppendMenu(menu1, MF_ENABLED, IDC_KEYSSH2DSA, "SSH-2 &DSA key");
	    AppendMenu(menu, MF_POPUP | MF_ENABLED, (UINT) menu1, "&Key");
	    state->keymenu = menu1;

	    menu1 = CreateMenu();
	    AppendMenu(menu1, MF_ENABLED, IDC_IMPORT, "&Import key");
	    AppendMenu(menu1, MF_SEPARATOR, 0, 0);
	    AppendMenu(menu1, MF_ENABLED, IDC_EXPORT_OPENSSH,
		       "Export &OpenSSH key");
	    AppendMenu(menu1, MF_ENABLED, IDC_EXPORT_SSHCOM,
		       "Export &ssh.com key");
	    AppendMenu(menu, MF_POPUP | MF_ENABLED, (UINT) menu1,
		       "Con&versions");
	    state->cvtmenu = menu1;

	    menu1 = CreateMenu();
	    AppendMenu(menu1, MF_ENABLED, IDC_ABOUT, "&About");
	    if (has_help())
		AppendMenu(menu1, MF_ENABLED, IDC_GIVEHELP, "&Help");
	    AppendMenu(menu, MF_POPUP | MF_ENABLED, (UINT) menu1, "&Help");

	    SetMenu(hwnd, menu);
	}

	/*
	 * Centre the window.
	 */
	{			       /* centre the window */
	    RECT rs, rd;
	    HWND hw;

	    hw = GetDesktopWindow();
	    if (GetWindowRect(hw, &rs) && GetWindowRect(hwnd, &rd))
		MoveWindow(hwnd,
			   (rs.right + rs.left + rd.left - rd.right) / 2,
			   (rs.bottom + rs.top + rd.top - rd.bottom) / 2,
			   rd.right - rd.left, rd.bottom - rd.top, TRUE);
	}

	{
	    struct ctlpos cp, cp2;

	    /* Accelerators used: acglops1rbd */

	    ctlposinit(&cp, hwnd, 4, 4, 4);
	    beginbox(&cp, "Key", IDC_BOX_KEY);
	    cp2 = cp;
	    statictext(&cp2, "No key.", 1, IDC_NOKEY);
//.........这里部分代码省略.........
开发者ID:rlugojr,项目名称:portaputty,代码行数:101,代码来源:winpgen.c


示例2: ReadFile

/*** Will be called before the first display of the dialog *******************/
BOOL CCalendarDlg2::OnInitDialog()
{
    m_mcMonthCal.SetHolidaysFromFile(_T("HOLIDAYS.INI"));
    m_mcMonthCal.pDelegates=this;
    CResizeableDialog::OnInitDialog();
    // ֿאנסטל פאיכ
    CString sContent;
    ReadFile(sMainFile,sContent);
    sContent.Replace("\r\n","\n");
    sContent=CString("\n")+sContent+"\n";
    while(sContent!="") {
        CString sLine=sContent.SpanExcluding("\n");
        if(sLine!="") {
            aItems.Add(sLine);
            if(sContent.GetLength()>sLine.GetLength()) {
                sContent=sContent.Mid(sLine.GetLength()+1);
            } else {
                sContent="";
            }
        }
        sContent.TrimLeft();
    }
    LRESULT lRes=0;
    NMDAYSTATE pDayState;
    SYSTEMTIME stMinRange, stMaxRange;
    memset(&pDayState,0,sizeof(pDayState));
    m_mcMonthCal.GetMonthRange(&stMinRange, &stMaxRange, GMR_DAYSTATE);
    pDayState.cDayState=(stMaxRange.wYear - stMinRange.wYear) * 12 + stMaxRange.wMonth - stMinRange.wMonth + 1;
    memcpy(&pDayState.stStart,&stMinRange,sizeof(SYSTEMTIME));
    OnGetdaystate((NMHDR*)&pDayState,&lRes);
    //pDayState.prgDayState[0]=0xffff;
    //memset(pDayState.prgDayState,555,5*sizeof(MONTHDAYSTATE));
    m_mcMonthCal.SetDayState(pDayState.cDayState,pDayState.prgDayState);
    m_mcMonthCal.Invalidate();

    //-----------------------------------
    // Set the icon for this dialog.  The framework does this automatically
    //  when the application's main window is not a dialog
    SetIcon(m_hIcon, TRUE);			// Set big icon
    SetIcon(m_hIcon, FALSE);		// Set small icon
    GetDlgItem(IDC_STATIC1)->SetWindowText(_l(sStatic1));
    GetDlgItem(IDC_STATIC2)->SetWindowText(_l(sStatic2));
    SetWindowText(_l(sTitle));
    GetDlgItem(IDOK)->SetWindowText(_l(sButton));
    GetDlgItem(IDCLEAR)->SetWindowText(_l("Clear field"));
    // Register resizable controls
    RegisterControl(IDC_STATIC1, ATTACH_TO_TOP_EDGE | ATTACH_TO_VERTICAL_EDGES);
    RegisterControl(IDC_MONTHCALENDAR1, ATTACH_TO_TOP_EDGE | ATTACH_TO_VERTICAL_EDGES);
    RegisterControl(IDC_STATIC2, ATTACH_TO_TOP_EDGE | ATTACH_TO_VERTICAL_EDGES);
    RegisterControl(IDC_EDIT_TXT, ATTACH_TO_TOP_EDGE | ATTACH_TO_VERTICAL_EDGES);
    RegisterControl(IDC_STATIC3, ATTACH_TO_BOTTOM_EDGE | ATTACH_TO_LEFT_EDGE);
    RegisterControl(IDCLEAR, ATTACH_TO_BOTTOM_EDGE | ATTACH_TO_LEFT_EDGE);
    RegisterControl(IDOK, ATTACH_TO_BOTTOM_EDGE | ATTACH_TO_RIGHT_EDGE);
    // Calculate minimum and maximum size of calendar window
    CRect rect;
    m_mcMonthCal.GetClientRect(rect);
    int nWidth  = rect.Width();
    int nHeight = rect.Height();

    if (m_mcMonthCal.GetMinReqRect(rect))
    {
        int   nMinWidth   = rect.Width();
        int   nMinHeight  = rect.Height();
        int   nDiffWidth  = nMinWidth  - nWidth;
        int   nDiffHeight = nMinHeight - nHeight;
        CRect rectOffset(nDiffWidth/2, nDiffHeight/2, nDiffWidth/2 + nDiffWidth%2,
                         nDiffHeight/2 + nDiffHeight%2);

        GetWindowRect(rect);
        rect += rectOffset;
        MoveWindow(rect);
        ThisSizeIsMinSize();

        int nMaxWidth  = nMinWidth  * 2 +  6*(3-1);
        int nMaxHeight = nMinHeight * 2 + 13*(4-1);

        nDiffWidth  = nMaxWidth  - nWidth;
        nDiffHeight = nMaxHeight - nHeight;
        rectOffset  = CRect(nDiffWidth/2, nDiffHeight/2,
                            nDiffWidth/2 + nDiffWidth%2,
                            nDiffHeight/2 + nDiffHeight%2);

        GetWindowRect(rect);
        rect += rectOffset;

        int nScreenWidth  = GetSystemMetrics(SM_CXSCREEN);
        int nScreenHeight = GetSystemMetrics(SM_CYSCREEN);
        if (rect.Width() > nScreenWidth)
        {
            rect.left  = 0;
            rect.right = nScreenWidth-1;
        }
        if (rect.Height() > nScreenHeight)
        {
            rect.top    = 0;
            rect.bottom = nScreenHeight-1;
        }
        m_nMaxWidth  = m_nMinWidth*2;
        m_nMaxHeight = m_nMinHeight;
//.........这里部分代码省略.........
开发者ID:calupator,项目名称:wiredplane-wintools,代码行数:101,代码来源:CalendarDlg2.cpp


示例3: resize_template_hook

static UINT_PTR WINAPI resize_template_hook(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
    static RECT initrc, rc;
    static int index, count;
    static int gotSWP_bottom, gotShowWindow;
    HWND parent = GetParent( dlg);
    int resize;
#define MAXNRCTRLS 30
    static RECT ctrlrcs[MAXNRCTRLS];
    static int ctrlids[MAXNRCTRLS];
    static HWND ctrls[MAXNRCTRLS];
    static int nrctrls;

    switch( msg)
    {
        case WM_INITDIALOG:
        {
            DWORD style;

            index = ((OPENFILENAME*)lParam)->lCustData;
            count = 0;
            gotSWP_bottom = gotShowWindow = 0;
            /* test style */
            style = GetWindowLong( parent, GWL_STYLE);
            if( resize_testcases[index].flags & OFN_ENABLESIZING)
                if( !(style & WS_SIZEBOX)) {
                    win_skip( "OFN_ENABLESIZING flag not supported.\n");
                    resizesupported = FALSE;
                    PostMessage( parent, WM_COMMAND, IDCANCEL, 0);
                } else
                    ok( style & WS_SIZEBOX,
                            "testid %d: dialog should have a WS_SIZEBOX style.\n", index);
            else
                ok( !(style & WS_SIZEBOX),
                        "testid %d: dialog should not have a WS_SIZEBOX style.\n", index);
            break;
        }
        case WM_NOTIFY:
        {
            if(( (LPNMHDR)lParam)->code == CDN_FOLDERCHANGE){
                GetWindowRect( parent, &initrc);
                if( (resize  = resize_testcases[index].resize_folderchange)){
                    MoveWindow( parent, initrc.left,initrc.top, initrc.right - initrc.left + resize,
                            initrc.bottom - initrc.top + resize, TRUE);
                }
                SetTimer( dlg, 0, 100, 0);
            }
            break;
        }
        case WM_TIMER:
        {
            if( count == 0){
                /* store the control rectangles */
                if( resize_testcases[index].testcontrols) {
                    HWND ctrl;
                    int i;
                    for( i = 0, ctrl = GetWindow( parent, GW_CHILD);
                            i < MAXNRCTRLS && ctrl;
                            i++, ctrl = GetWindow( ctrl, GW_HWNDNEXT)) {
                        ctrlids[i] = GetDlgCtrlID( ctrl);
                        GetWindowRect( ctrl, &ctrlrcs[i]);
                        MapWindowPoints( NULL, parent, (LPPOINT) &ctrlrcs[i], 2);
                        ctrls[i] = ctrl;
                    }
                    nrctrls = i;
                }
                if( (resize  = resize_testcases[index].resize_timer1)){
                    GetWindowRect( parent, &rc);
                    MoveWindow( parent, rc.left,rc.top, rc.right - rc.left + resize,
                            rc.bottom - rc.top + resize, TRUE);
                }
            } else if( count == 1){
                resize  = resize_testcases[index].resize_check;
                GetWindowRect( parent, &rc);
                if( resize_testcases[index].todo){
                    todo_wine {
                        ok( resize == rc.right - rc.left - initrc.right + initrc.left,
                            "testid %d size-x change %d expected %d\n", index,
                            rc.right - rc.left - initrc.right + initrc.left, resize);
                        ok( resize == rc.bottom - rc.top - initrc.bottom + initrc.top,
                            "testid %d size-y change %d expected %d\n", index,
                            rc.bottom - rc.top - initrc.bottom + initrc.top, resize);
                    }
                }else{
                    ok( resize == rc.right - rc.left - initrc.right + initrc.left,
                        "testid %d size-x change %d expected %d\n", index,
                        rc.right - rc.left - initrc.right + initrc.left, resize);
                    ok( resize == rc.bottom - rc.top - initrc.bottom + initrc.top,
                        "testid %d size-y change %d expected %d\n", index,
                        rc.bottom - rc.top - initrc.bottom + initrc.top, resize);
                }
                if( resize_testcases[index].testcontrols) {
                    int i;
                    RECT rc;
                    for( i = 0; i < nrctrls; i++) {
                        GetWindowRect( ctrls[i], &rc);
                        MapWindowPoints( NULL, parent, (LPPOINT) &rc, 2);
                        switch( ctrlids[i]){

/* test if RECT R1, moved and sized result in R2 */
//.........这里部分代码省略.........
开发者ID:Fredz66,项目名称:wine,代码行数:101,代码来源:filedlg.c


示例4: WndProc


//.........这里部分代码省略.........
                case WM_LBUTTONDOWN:
                    if (!IsWindowVisible(hWnd))
                    {
                        if (IsZoomed(hWnd))
                            ShowWindow(hWnd, SW_MAXIMIZE);
                        else
                            ShowWindow(hWnd, SW_RESTORE);
                        SetForegroundWindow(hWnd);
                    }
                    else if (GetForegroundWindow() == hWnd)
                        ShowWindow(hWnd, SW_HIDE);
                    else
                        SetForegroundWindow(hWnd);
                    break;
            }
            break;
        case WM_ACTIVATE:
            if (LOWORD(wParam) != WA_INACTIVE)
                refresh();
            break;
        case WM_SIZE:   //zdarzenie zmienienia rozmiaru
            int szer, wys;

            if (wParam & SIZE_MINIMIZED)
                ShowWindow(hWnd, SW_HIDE);

            szer = (int)LOWORD(lParam);
            wys = (int)HIWORD(lParam );

            /*
               Poni¿ze linijki pozwalaj¹ przestawiaæ kontrolki tak, by
               dopasowa ich pozycjê/rozmiar do rozmiaru okna g³ównego
            */
            MoveWindow(hList, 0, 0, szer, wys-23, false);
            MoveWindow(hShow, 20, wys-21, 120, 20, false);
            MoveWindow(hRefresh, szer-310, wys-21, 120, 20, false);
            MoveWindow(hInfo, szer-140, wys-21, 120, 20, false);
            break;
        case WM_SIZING: //zdarzenie zmieniania rozmiaru
            RECT* rc;
            rc = (RECT*)lParam;
            /*
               Poni¿sze linie pozwalaj¹ ograniczyc rozmiar okna - jako, ¿e to zdarzenie jest
               wywo³ywane w trakcie zmiany rozmiaru, warunki s¹ sprawdzane nie po puszczeniu
               przycisku myszy, a jeszcze w trakcie jego trzymania. Dziêki temu okno nie
               nigdy nie bêdzie mia³o rozmiarów mniejszych ni¿ 500x100 pikseli.
            */
            if (rc->right - rc->left <= 500)
                rc->right = rc->left + 500;
            if (rc->bottom - rc->top <= 100)
                rc->bottom = rc->top + 100;
            break;
        case WM_DESTROY:    //zdarzenie niszczenia okna
            CloseHandle(proces);
            Shell_NotifyIcon(NIM_DELETE, &nim);
            PostQuitMessage(0);
            break;

        case WM_NOTIFY: //obs³uga komunikatów od kontrolki ListView
            if (((LPNMHDR)lParam)->hwndFrom == hList && ((LPNMHDR)lParam)->code == (unsigned int)NM_DBLCLK)
                SendMessage(hShow, BM_CLICK, 0, 0);
            else if (((LPNMHDR)lParam)->hwndFrom == hList && ((LPNMHDR)lParam)->code == (unsigned int)NM_CLICK)
            {
                char buf[10];
                int poz = ListView_GetNextItem(hList, (WPARAM)-1, LVNI_SELECTED);
开发者ID:FeniXb3,项目名称:manipulator,代码行数:66,代码来源:main.cpp


示例5: AdjustDisplayRectangle

int COXListPopup::Pick(CRect rect, CRect rectParent)
{
	AdjustDisplayRectangle(rect, rectParent);

	MoveWindow(rect);
	ShowWindow(SW_SHOWNA);
	SetCapture();

	// init message loop
	bool bBreak = false;
	int iReturnItemIdx = -1;
	while (!bBreak)
	{
		MSG msg;
		VERIFY(::GetMessage(&msg, NULL, 0, 0));
		if (msg.message == WM_LBUTTONUP)
		{
			// Get the item under the mouse cursor
			int xPos = GET_X_LPARAM(msg.lParam); 
			int yPos = GET_Y_LPARAM(msg.lParam);

			BOOL bOutside;
			UINT nIndex = ItemFromPoint(CPoint(xPos, yPos), bOutside);
			if (!bOutside)
				iReturnItemIdx = (int) nIndex;
			bBreak = true;
		}
		else if (msg.message == WM_KEYDOWN)
		{
			// Handle ESCAPE, UP, DOWN and ENTER
			if (msg.wParam == VK_ESCAPE)
				bBreak = true;
			else if (msg.wParam == VK_UP)
			{
				int iSel = GetCurSel();
				if (iSel == -1 || iSel == 0)
					SetCurSel(0);
				else
					SetCurSel(iSel - 1);
			}
			else if (msg.wParam == VK_DOWN)
			{
				// Move the selection 1 item down
				int iSel = GetCurSel();
				if (iSel == -1)
					SetCurSel(0);
				else if (iSel == GetCount() - 1)
				{
					// Do nothing
				}
				else
					SetCurSel(iSel + 1);
			}
			else if (msg.wParam == VK_RETURN)
			{
				iReturnItemIdx = GetCurSel();
				bBreak = true;
			}
		}
		else if (msg.message == WM_LBUTTONDOWN)
		{
			// Do nothing				
		}
		else if (msg.message == WM_MOUSEMOVE)
		{
			// Select the item under the mouse cursor
			int xPos = GET_X_LPARAM(msg.lParam); 
			int yPos = GET_Y_LPARAM(msg.lParam);

			BOOL bOutside;
			UINT nIndex = ItemFromPoint(CPoint(xPos, yPos), bOutside);
			if (!bOutside)
				SetCurSel((int) nIndex);
		}
		else
		{
			DispatchMessage(&msg);
		}
	}

	ReleaseCapture();
	ShowWindow(SW_HIDE);

	return iReturnItemIdx;
}
开发者ID:Spritutu,项目名称:AiPI-1,代码行数:85,代码来源:OXListEdit.cpp


示例6: switch

LRESULT
CArchConsoleWindows::wndProc(HWND hwnd,
				UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
	case WM_CLOSE:
		ShowWindow(m_frame, FALSE);
		m_show = false;
		return 0;

	case SYNERGY_MSG_CONSOLE_OPEN:
		return 0;

	case SYNERGY_MSG_CONSOLE_CLOSE:
		SendMessage(m_frame, WM_CLOSE, 0, 0);
		m_show = false;
		return 0;

	case SYNERGY_MSG_CONSOLE_SHOW:
		m_show = true;
		if (wParam != 0 || !m_buffer.empty()) {
			ShowWindow(m_frame, TRUE);
		}
		return 0;

	case SYNERGY_MSG_CONSOLE_WRITE:
		appendBuffer(reinterpret_cast<const char*>(wParam));
		return 0;

	case SYNERGY_MSG_CONSOLE_CLEAR:
		clearBuffer();
		return 0;

	case WM_SIZE:
		if (hwnd == m_frame) {
			MoveWindow(m_hwnd, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
		}
		break;

	case WM_SIZING:
		if (hwnd == m_frame) {
			// get window vs client area info
			int wBase = 40 * m_wChar;
			int hBase = 40 * m_hChar;
			DWORD style   = GetWindowLong(m_frame, GWL_STYLE);
			DWORD exStyle = GetWindowLong(m_frame, GWL_EXSTYLE);
			RECT rect;
			rect.left   = 100;
			rect.top    = 100;
			rect.right  = rect.left + wBase;
			rect.bottom = rect.top + hBase;
			AdjustWindowRectEx(&rect, style, FALSE, exStyle);
			wBase = rect.right - rect.left - wBase;
			hBase = rect.bottom - rect.top - hBase;

			// get closest size that's a multiple of the character size
			RECT* newRect = (RECT*)lParam;
			int width  = (newRect->right - newRect->left - wBase) / m_wChar;
			int height = (newRect->bottom - newRect->top - hBase) / m_hChar;
			width  = width  * m_wChar + wBase;
			height = height * m_hChar + hBase;

			// adjust sizing rect
			switch (wParam) {
			case WMSZ_LEFT:
			case WMSZ_TOPLEFT:
			case WMSZ_BOTTOMLEFT:
				newRect->left = newRect->right - width;
				break;

			case WMSZ_RIGHT:
			case WMSZ_TOPRIGHT:
			case WMSZ_BOTTOMRIGHT:
				newRect->right = newRect->left + width;
				break;
			}
			switch (wParam) {
			case WMSZ_TOP:
			case WMSZ_TOPLEFT:
			case WMSZ_TOPRIGHT:
				newRect->top = newRect->bottom - height;
				break;

			case WMSZ_BOTTOM:
			case WMSZ_BOTTOMLEFT:
			case WMSZ_BOTTOMRIGHT:
				newRect->bottom = newRect->top + height;
				break;
			}
			return TRUE;
		}
		break;

	default:
		break;
	}

	return DefWindowProc(hwnd, msg, wParam, lParam);
}
开发者ID:JueSungMun,项目名称:SPWC,代码行数:99,代码来源:CArchConsoleWindows.cpp


示例7: EnableStackedTabs

BOOL CTreePropSheet::OnInitDialog()
{
	if (m_bTreeViewMode)
	{
		// be sure, there are no stacked tabs, because otherwise the
		// page caption will be to large in tree view mode
		EnableStackedTabs(FALSE);

		// Initialize image list.
		if (m_DefaultImages.GetSafeHandle())
		{
			IMAGEINFO	ii;
			m_DefaultImages.GetImageInfo(0, &ii);
			if (ii.hbmImage) DeleteObject(ii.hbmImage);
			if (ii.hbmMask) DeleteObject(ii.hbmMask);
			m_Images.Create(ii.rcImage.right-ii.rcImage.left, ii.rcImage.bottom-ii.rcImage.top, ILC_COLOR32|ILC_MASK, 0, 1);
		}
		else
			m_Images.Create(16, 16, ILC_COLOR32|ILC_MASK, 0, 1);
	}

	// perform default implementation
	BOOL bResult = CPropertySheet::OnInitDialog();
	HighColorTab::UpdateImageList(*this);

	if (!m_bTreeViewMode)
		// stop here, if we would like to use tabs
		return bResult;

	// Get tab control...
	CTabCtrl	*pTab = GetTabControl();
	if (!IsWindow(pTab->GetSafeHwnd()))
	{
		ASSERT(FALSE);
		return bResult;
	}

	// ... and hide it
	pTab->ShowWindow(SW_HIDE);
	pTab->EnableWindow(FALSE);

	// Place another (empty) tab ctrl, to get a frame instead
	CRect	rectFrame;
	pTab->GetWindowRect(rectFrame);
	ScreenToClient(rectFrame);

	m_pFrame = CreatePageFrame();
	if (!m_pFrame)
	{
		ASSERT(FALSE);
		AfxThrowMemoryException();
	}
	m_pFrame->Create(WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, rectFrame, this, 0xFFFF);
	m_pFrame->ShowCaption(m_bPageCaption);

	// Lets make place for the tree ctrl
	const int	nTreeWidth = m_nPageTreeWidth;
	const int	nTreeSpace = 5;

	CRect	rectSheet;
	GetWindowRect(rectSheet);
	rectSheet.right+= nTreeWidth;
	SetWindowPos(NULL, -1, -1, rectSheet.Width(), rectSheet.Height(), SWP_NOZORDER|SWP_NOMOVE);
	CenterWindow();

	MoveChildWindows(nTreeWidth, 0);

	// Lets calculate the rectangle for the tree ctrl
	CRect	rectTree(rectFrame);
	rectTree.right = rectTree.left + nTreeWidth - nTreeSpace;

	// calculate caption height
	CTabCtrl	wndTabCtrl;
	wndTabCtrl.Create(WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, rectFrame, this, 0x1234);
	wndTabCtrl.InsertItem(0, _T(""));
	CRect	rectFrameCaption;
	wndTabCtrl.GetItemRect(0, rectFrameCaption);
	wndTabCtrl.DestroyWindow();
	m_pFrame->SetCaptionHeight(rectFrameCaption.Height());

	// if no caption should be displayed, make the window smaller in
	// height
	if (!m_bPageCaption)
	{
		// make frame smaller
		m_pFrame->GetWnd()->GetWindowRect(rectFrame);
		ScreenToClient(rectFrame);
		rectFrame.top+= rectFrameCaption.Height();
		m_pFrame->GetWnd()->MoveWindow(rectFrame);

		// move all child windows up
		MoveChildWindows(0, -rectFrameCaption.Height());

		// modify rectangle for the tree ctrl
		rectTree.bottom-= rectFrameCaption.Height();

		// make us smaller
		CRect	rect;
		GetWindowRect(rect);
		rect.top+= rectFrameCaption.Height()/2;
//.........这里部分代码省略.........
开发者ID:15375514460,项目名称:TortoiseGit,代码行数:101,代码来源:TreePropSheet.cpp


示例8: dc

// Works out an appropriate size and position of this window
void CColorPopup::SetWindowSize()
{
    CSize TextSize;

    // If we are showing a custom or default text area, get the font and text size.
    if (m_strCustomText.GetLength() || m_strDefaultText.GetLength())
    {
        CClientDC dc(this);
        CFont* pOldFont = (CFont*) dc.SelectObject(&m_Font);

        // Get the size of the custom text (if there IS custom text)
        TextSize = CSize(0,0);
        if (m_strCustomText.GetLength())
            TextSize = dc.GetTextExtent(m_strCustomText);

        // Get the size of the default text (if there IS default text)
        if (m_strDefaultText.GetLength())
        {
            CSize DefaultSize = dc.GetTextExtent(m_strDefaultText);
            if (DefaultSize.cx > TextSize.cx) TextSize.cx = DefaultSize.cx;
            if (DefaultSize.cy > TextSize.cy) TextSize.cy = DefaultSize.cy;
        }

        dc.SelectObject(pOldFont);
        TextSize += CSize(2*m_nMargin,2*m_nMargin);

        // Add even more space to draw the horizontal line
        TextSize.cy += 2*m_nMargin + 2;
    }

    // Get the number of columns and rows
    //m_nNumColumns = (int) sqrt((double)m_nNumColors);    // for a square window (yuk)
    m_nNumColumns = 8;
    m_nNumRows = m_nNumColors / m_nNumColumns;
    if (m_nNumColors % m_nNumColumns) m_nNumRows++;

    // Get the current window position, and set the new size
    CRect rect;
    GetWindowRect(rect);

    m_WindowRect.SetRect(rect.left, rect.top, 
                         rect.left + m_nNumColumns*m_nBoxSize + 2*m_nMargin,
                         rect.top  + m_nNumRows*m_nBoxSize + 2*m_nMargin);

    // if custom text, then expand window if necessary, and set text width as
    // window width
    if (m_strDefaultText.GetLength()) 
    {
        if (TextSize.cx > m_WindowRect.Width())
            m_WindowRect.right = m_WindowRect.left + TextSize.cx;
        TextSize.cx = m_WindowRect.Width()-2*m_nMargin;

        // Work out the text area
        m_DefaultTextRect.SetRect(m_nMargin, m_nMargin, 
                                  m_nMargin+TextSize.cx, 2*m_nMargin+TextSize.cy);
        m_WindowRect.bottom += m_DefaultTextRect.Height() + 2*m_nMargin;
    }

    // if custom text, then expand window if necessary, and set text width as
    // window width
    if (m_strCustomText.GetLength()) 
    {
        if (TextSize.cx > m_WindowRect.Width())
            m_WindowRect.right = m_WindowRect.left + TextSize.cx;
        TextSize.cx = m_WindowRect.Width()-2*m_nMargin;

        // Work out the text area
        m_CustomTextRect.SetRect(m_nMargin, m_WindowRect.Height(), 
                                 m_nMargin+TextSize.cx, 
                                 m_WindowRect.Height()+m_nMargin+TextSize.cy);
        m_WindowRect.bottom += m_CustomTextRect.Height() + 2*m_nMargin;
   }

    // Need to check it'll fit on screen: Too far right?
    CSize ScreenSize(::GetSystemMetrics(SM_CXSCREEN), ::GetSystemMetrics(SM_CYSCREEN));
    if (m_WindowRect.right > ScreenSize.cx)
        m_WindowRect.OffsetRect(-(m_WindowRect.right - ScreenSize.cx), 0);

    // Too far left?
    if (m_WindowRect.left < 0)
        m_WindowRect.OffsetRect( -m_WindowRect.left, 0);

    // Bottom falling out of screen?
    if (m_WindowRect.bottom > ScreenSize.cy)
    {
        CRect ParentRect;
        m_pParent->GetWindowRect(ParentRect);
        m_WindowRect.OffsetRect(0, -(ParentRect.Height() + m_WindowRect.Height()));
    }

    // Set the window size and position
    MoveWindow(m_WindowRect, TRUE);
}
开发者ID:Qeeet,项目名称:nz-software,代码行数:94,代码来源:ColorPopup.cpp


示例9: guiMoveWindow

static void guiMoveWindow(HWND hwnd, RECT* r)
{
	MoveWindow(hwnd, r->left, r->top, r->right-r->left, r->bottom-r->top, TRUE);
}
开发者ID:BackupTheBerlios,项目名称:pvpgn-svn,代码行数:4,代码来源:winmain.cpp


示例10: WindowProcedure


//.........这里部分代码省略.........

        case SC_MAXIMIZE:
        {
            double i = 20;
            while (i < 330)
            {
                SetWindowPos(hwnd, HWND_TOP, 411, i,544, 375, SWP_SHOWWINDOW);
                i = i + 0.1;
            }
            while (i > 20)
            {
                SetWindowPos(hwnd, HWND_TOP, 411, i,544, 375, SWP_SHOWWINDOW);
                i = i - 0.1;
            }
            break;
        }


        case SC_CLOSE:
        {
            if(MessageBox(hwnd, "Do you want to close the program?", "Alert", MB_YESNO) == IDYES)
            {
                exit(1);
            }
            break;
        }


        default:
            return DefWindowProc(hwnd, message, wParam, lParam);
        }
        break;


        case WM_SIZE:
        {
            cxCoord = LOWORD(lParam); // 544
            cyCoord = HIWORD(lParam); // 375
            MoveWindow(textArea1, 20, 45, cxCoord-40, cyCoord/2-97, TRUE);
            MoveWindow(buttonSubmit, 20, cyCoord/2-40, cxCoord-430, cyCoord/2-144, TRUE);
            MoveWindow(buttonClear, 411, cyCoord/2-40, cxCoord-430, cyCoord/2-144, TRUE);
            MoveWindow(textArea2, 20, cyCoord-170, cxCoord-40, cyCoord/2-97, TRUE);
            MoveWindow(buttonRed, 20, (cyCoord-200) + cyCoord/2-55, cxCoord-425, cyCoord/2-135, TRUE);
            MoveWindow(buttonBlue, 406, (cyCoord-200) + cyCoord/2-55, cxCoord-425, cyCoord/2-135, TRUE);
            MoveWindow(buttonGreen, 213, (cyCoord-200) + cyCoord/2-55, cxCoord-425, cyCoord/2-135, TRUE);
            break;
        }


        case WM_CTLCOLOREDIT:
        {
            if(IDC_TEXT1 == GetDlgCtrlID((HWND)lParam))
            {
                textArea1Brush = CreateSolidBrush(RGB(198, 226, 255));
                SetBkMode((HDC)wParam, TRANSPARENT);
                return(INT_PTR)textArea1Brush;
            }
            break;
        }


        case WM_CTLCOLORSTATIC:
        {
            if(textFlagRed == true && (HWND)lParam == textArea2)
            {
                HBRUSH hbr = (HBRUSH) DefWindowProc(hwnd, message, wParam, lParam);
                SetTextColor((HDC) wParam, RGB(255, 0, 0));
                return (BOOL) hbr;
            }
            else if(textFlagBlue == true && (HWND)lParam == textArea2)
            {
                HBRUSH hbr = (HBRUSH) DefWindowProc(hwnd, message, wParam, lParam);
                SetTextColor((HDC) wParam, RGB(0, 0, 255));
                return (BOOL) hbr;
            }
            else if(textFlagGreen == true && (HWND)lParam == textArea2)
            {
                HBRUSH hbr = (HBRUSH) DefWindowProc(hwnd, message, wParam, lParam);
                SetTextColor((HDC) wParam, RGB(0, 255, 0));
                return (BOOL) hbr;
            }
            break;
        }


        case WM_DESTROY:
        {
            PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
            break;
        }


        default:                      /* for messages that we don't deal with */
            return DefWindowProc (hwnd, message, wParam, lParam);
        }


        return 0;
    }
}
开发者ID:TUM-FAF,项目名称:FAF-141-Bega-Valeria,代码行数:101,代码来源:main.cpp


示例11: WndProc

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
     static HWND      hwndSmaller, hwndLarger ;
     static int       cxClient, cyClient, cxChar, cyChar ;
     int              cx, cy ;
     LPDRAWITEMSTRUCT pdis ;
     POINT            pt[3] ;
     RECT             rc ;
     
     switch (message)
     {
     case WM_CREATE :
          cxChar = LOWORD (GetDialogBaseUnits ()) ;
          cyChar = HIWORD (GetDialogBaseUnits ()) ;
          
               // Create the owner-draw pushbuttons
          
          hwndSmaller = CreateWindow (TEXT ("button"), TEXT (""),
                                      WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
                                      0, 0, BTN_WIDTH, BTN_HEIGHT,
                                      hwnd, (HMENU) ID_SMALLER, hInst, NULL) ;
          
          hwndLarger  = CreateWindow (TEXT ("button"), TEXT (""),
                                      WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
                                      0, 0, BTN_WIDTH, BTN_HEIGHT,
                                      hwnd, (HMENU) ID_LARGER, hInst, NULL) ;
          return 0 ;
          
     case WM_SIZE :
          cxClient = LOWORD (lParam) ;
          cyClient = HIWORD (lParam) ;
          
               // Move the buttons to the new center
          
          MoveWindow (hwndSmaller, cxClient / 2 - 3 * BTN_WIDTH  / 2,
                                   cyClient / 2 -     BTN_HEIGHT / 2,
                      BTN_WIDTH, BTN_HEIGHT, TRUE) ;
          
          MoveWindow (hwndLarger,  cxClient / 2 +     BTN_WIDTH  / 2,
                                   cyClient / 2 -     BTN_HEIGHT / 2,
                      BTN_WIDTH, BTN_HEIGHT, TRUE) ;
          return 0 ;
          
     case WM_COMMAND :
          GetWindowRect (hwnd, &rc) ;
          
               // Make the window 10% smaller or larger
          
          switch (wParam)
          {
          case ID_SMALLER :
               rc.left   += cxClient / 20 ;
               rc.right  -= cxClient / 20 ;
               rc.top    += cyClient / 20 ;
               rc.bottom -= cyClient / 20 ;
               break ;
               
          case ID_LARGER :
               rc.left   -= cxClient / 20 ;
               rc.right  += cxClient / 20 ;
               rc.top    -= cyClient / 20 ;
               rc.bottom += cyClient / 20 ;
               break ;
          }
          
          MoveWindow (hwnd, rc.left, rc.top, rc.right  - rc.left,
                            rc.bottom - rc.top, TRUE) ;
          return 0 ;
          
     case WM_DRAWITEM :
          pdis = (LPDRAWITEMSTRUCT) lParam ;
          
               // Fill area with white and frame it black
          
          FillRect (pdis->hDC, &pdis->rcItem,
                    (HBRUSH) GetStockObject (WHITE_BRUSH)) ;
          
          FrameRect (pdis->hDC, &pdis->rcItem,
                     (HBRUSH) GetStockObject (BLACK_BRUSH)) ;
          
               // Draw inward and outward black triangles
          
          cx = pdis->rcItem.right  - pdis->rcItem.left ;
          cy = pdis->rcItem.bottom - pdis->rcItem.top  ;
          
          switch (pdis->CtlID)
          {
          case ID_SMALLER :
               pt[0].x = 3 * cx / 8 ;  pt[0].y = 1 * cy / 8 ;
               pt[1].x = 5 * cx / 8 ;  pt[1].y = 1 * cy / 8 ;
               pt[2].x = 4 * cx / 8 ;  pt[2].y = 3 * cy / 8 ;
               
               Triangle (pdis->hDC, pt) ;
               
               pt[0].x = 7 * cx / 8 ;  pt[0].y = 3 * cy / 8 ;
               pt[1].x = 7 * cx / 8 ;  pt[1].y = 5 * cy / 8 ;
               pt[2].x = 5 * cx / 8 ;  pt[2].y = 4 * cy / 8 ;
               
               Triangle (pdis->hDC, pt) ;
               
//.........这里部分代码省略.........
开发者ID:Jeanhwea,项目名称:petzold-pw5e,代码行数:101,代码来源:OwnDraw.c


示例12: ContainerDlgProc

BOOL CALLBACK ContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	ChatContainer *container;
	container = (ChatContainer *) GetWindowLong(hwndDlg, GWL_USERDATA);
	if (container==NULL && msg!=WM_INITDIALOG) return FALSE;
	switch (msg) {
		case WM_INITDIALOG:
			SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) muccIcon[MUCC_IDI_CHAT]);
			container = (ChatContainer *) lParam;
			container->setHWND(hwndDlg);
			SetWindowLong(hwndDlg, GWL_USERDATA, (LONG) container);
			ShowWindow(hwndDlg, SW_SHOW);
			SetEvent(container->getEvent());
			return TRUE;
		case WM_GETMINMAXINFO:
			MINMAXINFO *mmi;
			RECT rcChild, rcWindow;
			mmi = (MINMAXINFO *) lParam;
			GetWindowRect(hwndDlg, &rcWindow);
			container->getChildWindowRect(&rcChild);
			mmi->ptMinTrackSize.x = 380;
			mmi->ptMinTrackSize.y = 130 + (rcWindow.bottom - rcWindow.top) - (rcChild.bottom - rcChild.top);
			return FALSE;
		case WM_SIZE:
			if (IsIconic(hwndDlg) || wParam == SIZE_MINIMIZED) break;
			{
				RECT rc, rcChild, rcWindow;
				GetClientRect(hwndDlg, &rc);
				HWND hwndTabs = GetDlgItem(hwndDlg, IDC_TABS);
				MoveWindow(hwndTabs, 0, 0, (rc.right - rc.left), (rc.bottom - rc.top) - 0,	FALSE);
				RedrawWindow(hwndTabs, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_ERASE);
				container->getChildWindowRect(&rcChild);
				if ((rcChild.bottom-rcChild.top) < 130 || (rcChild.right-rcChild.left) < 380) {
					GetWindowRect(hwndDlg, &rcWindow);
					if ((rcChild.bottom-rcChild.top) < 130) {
						rcWindow.bottom = rcWindow.top + 130 + (rcWindow.bottom - rcWindow.top) - (rcChild.bottom - rcChild.top);
					} 
					if ((rcChild.right-rcChild.left) < 380) {
						rcWindow.right = rcWindow.left + 380;
					}
					MoveWindow(hwndDlg, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, TRUE);
					container->getChildWindowRect(&rcChild);
				}
				if (container->getActive()!=NULL) {
					MoveWindow(container->getActive()->getHWND(), rcChild.left, rcChild.top, rcChild.right-rcChild.left, rcChild.bottom - rcChild.top, TRUE);
				}
			}
			return TRUE;
		case DM_CREATECHILD:
			SetWindowLong(hwndDlg, DWL_MSGRESULT, (LONG)CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_GROUPCHAT_LOG), hwndDlg, (DLGPROC) wParam, (LPARAM) lParam));
			return TRUE;
		case DM_ADDCHILD:
			container->addChild((ChatWindow *) lParam);
			return TRUE;
		case DM_REMOVECHILD:
			container->removeChild((ChatWindow *) lParam);
			return TRUE;
		case DM_CHANGECHILDDATA:
			container->removeChild((ChatWindow *) lParam);
			return TRUE;
		case WM_NOTIFY:
			{
				NMHDR* pNMHDR = (NMHDR*) lParam;
				switch (pNMHDR->code) {
				case TCN_SELCHANGE:
					{
						TCITEM tci = {0};
						HWND hwndTabs = GetDlgItem(hwndDlg, IDC_TABS);
						int iSel = TabCtrl_GetCurSel(hwndTabs);
						tci.mask = TCIF_PARAM;
						if (TabCtrl_GetItem(hwndTabs, iSel, &tci)) {
							ChatWindow * chatWindow = (ChatWindow *) tci.lParam;
							container->activateChild(chatWindow);
						}
					}
					break;
				case NM_CLICK:
					{
						FILETIME ft;
						TCHITTESTINFO thinfo;
						int tabId;
						HWND hwndTabs = GetDlgItem(hwndDlg, IDC_TABS);
						GetSystemTimeAsFileTime(&ft);
						GetCursorPos(&thinfo.pt);
						ScreenToClient(hwndTabs, &thinfo.pt);
						tabId = TabCtrl_HitTest(hwndTabs, &thinfo);
						if (tabId != -1 && tabId == container->lastClickTab &&
							(ft.dwLowDateTime - container->lastClickTime) < (GetDoubleClickTime() * 10000)) {
							SendMessage(container->getChildFromTab(tabId)->getHWND(), WM_CLOSE, 0, 0);
							container->lastClickTab = -1;
						} else {
							container->lastClickTab = tabId;
						}
						container->lastClickTime = ft.dwLowDateTime;
					}
					break;
				}

			}
			break;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:mtlen-svn,代码行数:101,代码来源:ChatContainer.cpp


示例13: PluginEditorComponent

//==============================================================================
VstPluginExternalEditor::VstPluginExternalEditor (BasePlugin* plugin_,
                                                  VstPluginWindow* window_)
  : PluginEditorComponent (plugin_),
#if defined(LINUX)
    eventProc (0),
#endif
    handle (0),
    window (window_),
    editorWidth (0),
    editorHeight (0),
    offsetX (0),
    offsetY (0)
#ifdef JUCE_MAC && 0
	, vstGuiWindow(0)
#endif
{
    DBG ("VstPluginExternalEditor::VstPluginExternalEditor");
    
    setWantsKeyboardFocus (true);
    setVisible (true);

#if defined(LINUX)
    plugin->openEditor (window->getWindowHandle (), display);

    handle = getChildWindow ((Window) window->getWindowHandle ());
    if (handle)
        eventProc = (EventProcPtr) obtainPropertyFromXWindow (handle,
                                                              XInternAtom (display, "_XEventProc", false));

#elif defined(_WIN32)
    plugin->openEditor (window->getWindowHandle (), (void*) 0);

	handle = GetWindow ((HWND) window->getWindowHandle(), GW_CHILD);
#endif

    if (editorWidth <= 0 || editorHeight <= 0)
        plugin->getEditorSize (editorWidth, editorHeight);

    jassert (editorWidth > 0 && editorHeight > 0);
    setSize (editorWidth, editorHeight);

    offsetX = window->getBorderThickness().getLeft ();
    offsetY = window->getTitleBarHeight()
              + window->getMenuBarHeight()
              + window->getBorderThickness().getTop ();
    
    if (handle)
    {
#if defined(LINUX)
        XResizeWindow (display, handle, editorWidth, editorHeight);
        XMoveWindow (display, handle, offsetX, offsetY);
#elif defined (_WIN32)
		MoveWindow (handle, offsetX, offsetY, editorWidth, editorHeight, true); 
#endif
    }
    
//#ifdef JUCE_MAC
#if 0
    setGuiWindow(new MacVSTGUIPositionHelperWindow(plugin, window->getX() + offsetX, window->getY() + offsetY));
    showGUI(true);
#endif

	repaint ();

	startTimer (1000 / 10);
}
开发者ID:christianscheuer,项目名称:jivemodular,代码行数:67,代码来源:VstPluginExternalEditor.cpp


示例14: Docking_ProcessWindowMessage

int Docking_ProcessWindowMessage(WPARAM wParam,LPARAM lParam)
{
	APPBARDATA abd;
	static int draggingTitle;
	MSG *msg=(MSG*)wParam;

	if(msg->message==WM_DESTROY) 
		ModernWriteSettingByte(NULL,"CList","Docked",(BYTE)g_CluiData.fDocked);

	if(!g_CluiData.fDocked && msg->message!=WM_CREATE && msg->message!=WM_MOVING && msg->message!=WM_CREATEDOCKED && msg->message != WM_MOVE && msg->message != WM_SIZE) return 0;
	switch(msg->message) {
		case WM_CREATE:
			//if(GetSystemMetrics(SM_CMONITORS)>1) return 0;
			if(ModernGetSettingByte(NULL,"CList","Docked",0) && ModernGetSettingByte(NULL,"CLUI","DockToSides",SETTING_DOCKTOSIDES_DEFAULT)) 
			{
				PostMessage(msg->hwnd,WM_CREATEDOCKED,0,0);
			}
			draggingTitle=0;
			return 0;

		case WM_CREATEDOCKED:
			//we need to post a message just after creation to let main message function do some work
			g_CluiData.fDocked=(BOOL)ModernGetSettingByte(NULL,"CList","Docked",0);
			if(IsWindowVisible(msg->hwnd) && !IsIconic(msg->hwnd)) {
				RECT rc, rcMonitor;
				ZeroMemory(&abd,sizeof(abd));
				abd.cbSize=sizeof(abd);
				abd.hWnd=msg->hwnd;
				abd.lParam=0;
				abd.uCallbackMessage=WM_DOCKCALLBACK;
				SHAppBarMessage(ABM_NEW,&abd);
				GetWindowRect(msg->hwnd,&rc);
				Docking_GetMonitorRectFromWindow(msg->hwnd,&rcMonitor);
				Docking_AdjustPosition(msg->hwnd,&rcMonitor,&rc);
				MoveWindow(msg->hwnd,rc.left,rc.top,rc.right-rc.left,rc.bottom-rc.top,TRUE);
				g_CluiData.mutexPreventDockMoving=0;
				Sync(CLUIFrames_OnMoving,msg->hwnd,&rc);
				g_CluiData.mutexPreventDockMoving=1;
				ModernSkinButton_ReposButtons( msg->hwnd, SBRF_DO_NOT_DRAW, NULL );
			}
			break;
		case WM_CAPTURECHANGED:
			ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW,NULL);
			return 0;
		case WM_ACTIVATE:
			ZeroMemory(&abd,sizeof(abd));
			abd.cbSize=sizeof(abd);
			abd.hWnd=msg->hwnd;
			SHAppBarMessage(ABM_ACTIVATE,&abd);
			return 0;
		case WM_SIZE:
			ModernSkinButton_ReposButtons( msg->hwnd, SBRF_DO_REDRAW_ALL, NULL );
			return 0;

		case WM_WINDOWPOSCHANGED:
			{
				if (g_CluiData.fDocked) ModernSkinButton_ReposButtons( msg->hwnd,SBRF_DO_NOT_DRAW, NULL );
				return 0;
				ZeroMemory(&abd,sizeof(abd));
				abd.cbSize=sizeof(abd);
				abd.hWnd=msg->hwnd;
				SHAppBarMessage(ABM_WINDOWPOSCHANGED,&abd);
				ModernSkinButton_ReposButtons( msg->hwnd, SBRF_DO_NOT_DRAW, NULL );
				return 0;
			}
		case WM_MOVING:
			{
				RECT rcMonitor;
				RECT rcWindow;
				RECT *rc;
				int dx=0;
				POINT ptCursor;
				if (g_CluiData.fDocked) return 0;
				// stop early
				BOOL bControlled = (BOOL)(GetAsyncKeyState(VK_CONTROL)&0x8000);

				// GetMessagePos() is no good, position is always unsigned
				GetCursorPos(&ptCursor);
				GetWindowRect(msg->hwnd,&rcWindow);
				dock_drag_dx=rcWindow.left-ptCursor.x;
				dock_drag_dy=rcWindow.top-ptCursor.y;
				Docking_GetMonitorRectFromPoint(ptCursor,&rcMonitor);

				if(((ptCursor.x<rcMonitor.left+EDGESENSITIVITY) 
					|| (ptCursor.x>=rcMonitor.right-EDGESENSITIVITY))
					&& ModernGetSettingByte(NULL,"CLUI","DockToSides",SETTING_DOCKTOSIDES_DEFAULT))
				{
					ZeroMemory(&abd,sizeof(abd));
					abd.cbSize=sizeof(abd);
					abd.hWnd=msg->hwnd;
					abd.lParam=0;
					abd.uCallbackMessage=WM_DOCKCALLBACK;
					SHAppBarMessage(ABM_NEW,&abd);
					if(ptCursor.x<rcMonitor.left+EDGESENSITIVITY) g_CluiData.fDocked=DOCKED_LEFT;
					else g_CluiData.fDocked=DOCKED_RIGHT;
					//	TempDock=1;				
					GetWindowRect(msg->hwnd,(LPRECT)msg->lParam);
					rc=(RECT*)msg->lParam;
					if (g_CluiData.fDocked==DOCKED_RIGHT)
						dx=(rc->right>rcMonitor.right)?rc->right-rcMonitor.right:0;
//.........这里部分代码省略.........
开发者ID:dineshkummarc,项目名称:miranda-im-v0.9.47-src,代码行数:101,代码来源:modern_docking.cpp


示例15: WndProc


//.........这里部分代码省略.........
                    }
                }
            }
        }

         

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MovementFlags函数代码示例发布时间:2022-05-30
下一篇:
C++ MoveUp函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap