当前位置: 首页>>代码示例>>C++>>正文


C++ GetWindowPlacement函数代码示例

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


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

示例1: GetWindowPlacement

void DX10App::Start()
{
	if(!mShowMouse)
	{
		WINDOWPLACEMENT wPos;
		GetWindowPlacement( hMainWnd, &wPos );
		SetCursorPos(wPos.rcNormalPosition.left + 100, wPos.rcNormalPosition.top + 100);
	}

	mSwapBuffers->begin();

	
	//gDevice->ClearDepthStencilView( mSwapBuffers->getRenderTargets()->DSV, D3D10_CLEAR_DEPTH|D3D10_CLEAR_STENCIL, 1.0f, 0);

	float blendFactor[] = {0.0f, 0.0f, 0.0f, 0.0f};
	gDevice->OMSetBlendState(0, blendFactor, 0xffffffff);
}
开发者ID:GustavPersson,项目名称:miniature-dubstep,代码行数:17,代码来源:DX10App.cpp

示例2: AfxGetApp

void CMainFrame::OnClose() 
{
	// TODO: Add your message handler code here and/or call default
	CMyCommApp * myApp = (CMyCommApp *)AfxGetApp();
	AfxGetApp()->WriteProfileString("Version","VER",myApp->m_AppVersion);

	WINDOWPLACEMENT   WndStatus;  
	GetWindowPlacement(&WndStatus);  
	AfxGetApp()->WriteProfileInt("Layout","FLAG",WndStatus.flags);  
	AfxGetApp()->WriteProfileInt("Layout","SHOWCMD",WndStatus.showCmd);  
	AfxGetApp()->WriteProfileInt("Layout","LEFT",WndStatus.rcNormalPosition.left);  
	AfxGetApp()->WriteProfileInt("Layout","RIGHT",WndStatus.rcNormalPosition.right);  
	AfxGetApp()->WriteProfileInt("Layout","TOP",WndStatus.rcNormalPosition.top);  
	AfxGetApp()->WriteProfileInt("Layout","BOTTOM",WndStatus.rcNormalPosition.bottom); 
	
	CFrameWnd::OnClose();
}
开发者ID:liquanhai,项目名称:LSDComm,代码行数:17,代码来源:MainFrm.cpp

示例3: SetWindowLongPtr

LRESULT CALLBACK CWindow::stWinMsgHandler(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    CWindow * pWnd = nullptr;

    if (uMsg == WM_NCCREATE)
    {
        // get the pointer to the window from lpCreateParams which was set in CreateWindow
        SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)((LPCREATESTRUCT(lParam))->lpCreateParams));
    }

    // get the pointer to the window
    pWnd = GetObjectFromWindow(hwnd);

    // if we have the pointer, go to the message handler of the window
    // else, use DefWindowProc
    if (pWnd)
    {
        switch (uMsg)
        {
        case WM_ACTIVATE:
            if ((wParam == WA_ACTIVE)&&(!pWnd->bWindowRestored)&&(!pWnd->sRegistryPath.empty()))
            {
                WINDOWPLACEMENT wpl = {0};
                DWORD size = sizeof(wpl);
                if (SHGetValue(HKEY_CURRENT_USER, pWnd->sRegistryPath.c_str(), pWnd->sRegistryValue.c_str(), REG_NONE, &wpl, &size) == ERROR_SUCCESS)
                    SetWindowPlacement(hwnd, &wpl);
                else
                    ShowWindow(hwnd, SW_SHOW);
                pWnd->bWindowRestored = true;
            }
            break;
        case WM_CLOSE:
            if (!pWnd->sRegistryPath.empty())
            {
                WINDOWPLACEMENT wpl = {0};
                wpl.length = sizeof(WINDOWPLACEMENT);
                GetWindowPlacement(hwnd, &wpl);
                SHSetValue(HKEY_CURRENT_USER, pWnd->sRegistryPath.c_str(), pWnd->sRegistryValue.c_str(), REG_NONE, &wpl, sizeof(wpl));
            }
            break;
        }
        return pWnd->WinMsgHandler(hwnd, uMsg, wParam, lParam);
    }
    else
        return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
开发者ID:hfeeki,项目名称:TortoiseGit,代码行数:46,代码来源:BaseWindow.cpp

示例4: force_normal

void force_normal(HWND hwnd)
{
    static int recurse = 0;

    WINDOWPLACEMENT wp;

    if (recurse)
	return;
    recurse = 1;

    wp.length = sizeof(wp);
    if (GetWindowPlacement(hwnd, &wp) && wp.showCmd == SW_SHOWMAXIMIZED) {
	wp.showCmd = SW_SHOWNORMAL;
	SetWindowPlacement(hwnd, &wp);
    }
    recurse = 0;
}
开发者ID:autoandshare,项目名称:putty-toolpakcloud,代码行数:17,代码来源:windlg.c

示例5: CDialogManage

/*
** Dialog procedure for the Manage dialog.
**
*/
INT_PTR CALLBACK CDialogManage::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	if (!c_Dialog)
	{
		if (uMsg == WM_INITDIALOG)
		{
			c_Dialog = new CDialogManage(hWnd);
			return c_Dialog->OnInitDialog(wParam, lParam);
		}
	}
	else
	{
		switch (uMsg)
		{
		case WM_ACTIVATE:
			return c_Dialog->OnActivate(wParam, lParam);

		case WM_COMMAND:
			return c_Dialog->OnCommand(wParam, lParam);

		case WM_NOTIFY:
			return c_Dialog->OnNotify(wParam, lParam);

		case WM_CLOSE:
			PostMessage(hWnd, WM_DELAYED_CLOSE, 0, 0);
			return TRUE;

		case WM_DESTROY:
			delete c_Dialog;
			c_Dialog = NULL;
			return FALSE;

		case WM_DELAYED_CLOSE:
			GetWindowPlacement(hWnd, &c_WindowPlacement);
			if (c_WindowPlacement.showCmd == SW_SHOWMINIMIZED)
			{
				c_WindowPlacement.showCmd = SW_SHOWNORMAL;
			}
			DestroyWindow(hWnd);
			return TRUE;
		}
	}

	return FALSE;
}
开发者ID:JamesAC,项目名称:rainmeter,代码行数:49,代码来源:DialogManage.cpp

示例6: RedrawTitleBar

void RedrawTitleBar( HWND hWnd, bool active )
{
	if ( !pShared )
		return;

	WaitForSingleObject( CommMutex, INFINITE );
	if ( pShared->TitleBar[0] == 0 )
	{
		ReleaseMutex( CommMutex );
		return;
	}

	int len = (int)strlen( pShared->TitleBar );
	if ( len >= 1024 )
		len = 1023;

	WINDOWPLACEMENT place;
	RECT rect;
	HDC hDC = GetWindowDC( hWnd );//WINDOW dc allows us to draw on the non client area
	
	GetWindowPlacement( hWnd, &place );
	GetWindowRect( hWnd, &rect );

	// Change the coords (believe me, okay?)
	rect.top = GetSystemMetrics(SM_CYFRAME);
	rect.bottom = rect.top + GetSystemMetrics(SM_CYCAPTION);

	rect.right = ( rect.right - rect.left ) - ( 4*GetSystemMetrics(SM_CXSIZE) + GetSystemMetrics(SM_CXFRAME) );
	rect.left = GetSystemMetrics(SM_CXSIZEFRAME) + GetSystemMetrics(SM_CXSMICON) + 5;

	if ( hThemes )
	{
		HTHEME hTheme = zOpenThemeData( hWnd, L"WINDOW" );
		DrawColorTitleBar( hTheme, hWnd, hDC, active, place.showCmd == SW_MAXIMIZE, pShared->TitleBar, len, rect );
		zCloseThemeData( hTheme );
	}
	else
	{
		rect.left += GetSystemMetrics(SM_CXFRAME);
		DrawColorTitleBar( NULL, hWnd, hDC, active, place.showCmd == SW_MAXIMIZE, pShared->TitleBar, len, rect );
	}

	ReleaseDC( hWnd, hDC );
	ReleaseMutex( CommMutex );
}
开发者ID:WildGenie,项目名称:Razor,代码行数:45,代码来源:gfx.cpp

示例7: GetWindowPlacement

void Window::SaveWindowState()
{
    WINDOWPLACEMENT wp;
    wp.length=sizeof(WINDOWPLACEMENT);
    GetWindowPlacement(hWnd,&wp);

    if (Flags & W_SAVESTATE)
    {
        char *temp="Normal";
        BOOL RestToMax=wp.flags & WPF_RESTORETOMAXIMIZED;
        if (wp.showCmd==SW_SHOWMAXIMIZED ||
                ( wp.showCmd==SW_SHOWMINIMIZED && !(Flags & W_SAVEMIN) && RestToMax ) ) temp="Maximized";
        else if ( (Flags & W_SAVEMIN) && (wp.showCmd==SW_SHOWMINIMIZED)) temp= RestToMax ? "MinFromMax" : "Minimized";
        else if ( wp.showCmd==SW_HIDE) temp="Hidden";
        WriteIniString(Name,"State",temp);
    }
    WriteIniString(Name,"Window",	String()<< (int) wp.rcNormalPosition.left << ',' << (int) wp.rcNormalPosition.top << ',' << (int) wp.rcNormalPosition.right  << ',' << (int) wp.rcNormalPosition.bottom);
}
开发者ID:DavidKinder,项目名称:Level9,代码行数:18,代码来源:window.cpp

示例8: SaveWindowPosition

static INT_PTR SaveWindowPosition(WPARAM, LPARAM lParam)
{
	SAVEWINDOWPOS *swp = (SAVEWINDOWPOS*)lParam;
	WINDOWPLACEMENT wp;
	char szSettingName[64];

	wp.length = sizeof(wp);
	GetWindowPlacement(swp->hwnd, &wp);
	mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sx", swp->szNamePrefix);
	db_set_dw(swp->hContact, swp->szModule, szSettingName, wp.rcNormalPosition.left);
	mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sy", swp->szNamePrefix);
	db_set_dw(swp->hContact, swp->szModule, szSettingName, wp.rcNormalPosition.top);
	mir_snprintf(szSettingName, SIZEOF(szSettingName), "%swidth", swp->szNamePrefix);
	db_set_dw(swp->hContact, swp->szModule, szSettingName, wp.rcNormalPosition.right-wp.rcNormalPosition.left);
	mir_snprintf(szSettingName, SIZEOF(szSettingName), "%sheight", swp->szNamePrefix);
	db_set_dw(swp->hContact, swp->szModule, szSettingName, wp.rcNormalPosition.bottom-wp.rcNormalPosition.top);
	return 0;
}
开发者ID:martok,项目名称:miranda-ng,代码行数:18,代码来源:utils.cpp

示例9: GetWindowPlacement

BOOL CDlgScraperOutput::DestroyWindow()
{
	WINDOWPLACEMENT		wp;
	CMainFrame			*pMyMainWnd  = (CMainFrame *) (theApp.m_pMainWnd);

	// Save settings to registry
	GetWindowPlacement(&wp);
	prefs.set_scraper_x(wp.rcNormalPosition.left);
	prefs.set_scraper_y(wp.rcNormalPosition.top);
	prefs.set_scraper_dx(wp.rcNormalPosition.right - wp.rcNormalPosition.left);
	prefs.set_scraper_dy(wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
	prefs.set_scraper_zoom(m_Zoom.GetCurSel());

	// Uncheck scraper output button on main toolbar
	pMyMainWnd->m_MainToolBar.GetToolBarCtrl().CheckButton(ID_MAIN_TOOLBAR_SCRAPER_OUTPUT, false);

	return CDialog::DestroyWindow();
}
开发者ID:buranela,项目名称:OpenHoldemV12,代码行数:18,代码来源:DialogScraperOutput.cpp

示例10: sizeof

void CAllToolSetupSheet::OnPaint() 
{
	WINDOWPLACEMENT wp;
	RECT rect;

	wp.length = sizeof(WINDOWPLACEMENT);  //not sure if this is still required, but what the hey 
	GetWindowPlacement(&wp);

	if (InitDialogComplete && wp.showCmd!=SW_SHOWMAXIMIZED && wp.showCmd!=SW_SHOWMINIMIZED)  // save the dialog window position
	{
        GetWindowRect(&rect);
		LastMoveX = rect.left;
		LastMoveY = rect.top;
		LastSizeX = rect.right - rect.left;
		LastSizeY = rect.bottom - rect.top;
	}
	CMySheet::OnPaint();
}
开发者ID:TomKerekes,项目名称:KMotionX,代码行数:18,代码来源:AllToolSetupSheet.cpp

示例11: MonitorFromWindow

/***********************************************************************
 *		MonitorFromWindow ([email protected])
 */
HMONITOR WINAPI MonitorFromWindow(HWND hWnd, DWORD dwFlags)
{
    RECT rect;
    WINDOWPLACEMENT wp;

    TRACE("(%p, 0x%08x)\n", hWnd, dwFlags);

    if (IsIconic(hWnd) && GetWindowPlacement(hWnd, &wp))
        return MonitorFromRect( &wp.rcNormalPosition, dwFlags );

    if (GetWindowRect( hWnd, &rect ))
        return MonitorFromRect( &rect, dwFlags );

    if (!(dwFlags & (MONITOR_DEFAULTTOPRIMARY|MONITOR_DEFAULTTONEAREST))) return 0;
    /* retrieve the primary */
    SetRect( &rect, 0, 0, 1, 1 );
    return MonitorFromRect( &rect, dwFlags );
}
开发者ID:kholia,项目名称:wine,代码行数:21,代码来源:misc.c

示例12: if

BOOL CWnd::SavePosition(HKEY hRootKey,LPCSTR lpKey,LPCSTR lpSubKey) const
{
	CRegKey RegKey;
	if (lpKey==NULL)
		RegKey.m_hKey=hRootKey;
	else if (RegKey.OpenKey(hRootKey,lpKey,CRegKey::createNew|CRegKey::samAll)!=ERROR_SUCCESS)
		return FALSE;
	
	WINDOWPLACEMENT wp;
	wp.length=sizeof(WINDOWPLACEMENT);
	GetWindowPlacement(&wp);
	
	BOOL bRet=RegKey.SetValue(lpSubKey,LPSTR(&wp),sizeof(WINDOWPLACEMENT),REG_BINARY)==ERROR_SUCCESS;

	if (lpKey==NULL)
		RegKey.m_hKey=NULL;
	return bRet;
}
开发者ID:eladkarako,项目名称:locate32,代码行数:18,代码来源:WindowClasses.cpp

示例13: ActivateExistingTab

int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild)
{
	TWindowData *dat = (TWindowData*) GetWindowLongPtr(hwndChild, GWLP_USERDATA);	// needed to obtain the hContact for the message window
	if (!dat || !pContainer)
		return FALSE;

	NMHDR nmhdr = { 0 };
	nmhdr.code = TCN_SELCHANGE;
	if (TabCtrl_GetItemCount(GetDlgItem(pContainer->hwnd, IDC_MSGTABS)) > 1 && !(pContainer->dwFlags & CNT_DEFERREDTABSELECT)) {
		TabCtrl_SetCurSel(GetDlgItem(pContainer->hwnd, IDC_MSGTABS), GetTabIndexFromHWND(GetDlgItem(pContainer->hwnd, IDC_MSGTABS), hwndChild));
		SendMessage(pContainer->hwnd, WM_NOTIFY, 0, (LPARAM)&nmhdr);	// just select the tab and let WM_NOTIFY do the rest
	}
	if (dat->bType == SESSIONTYPE_IM)
		SendMessage(pContainer->hwnd, DM_UPDATETITLE, dat->hContact, 0);
	if (IsIconic(pContainer->hwnd)) {
		SendMessage(pContainer->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
		SetForegroundWindow(pContainer->hwnd);
	}
	//MaD - hide on close feature
	if (!IsWindowVisible(pContainer->hwnd)) {
		WINDOWPLACEMENT wp={0};
		wp.length = sizeof(wp);
		GetWindowPlacement(pContainer->hwnd, &wp);

		/*
		 * all tabs must re-check the layout on activation because adding a tab while
		 * the container was hidden can make this necessary
		 */
		BroadCastContainer(pContainer, DM_CHECKSIZE, 0, 0);
		if (wp.showCmd == SW_SHOWMAXIMIZED)
			ShowWindow(pContainer->hwnd, SW_SHOWMAXIMIZED);
		else {
			ShowWindow(pContainer->hwnd, SW_SHOWNA);
			SetForegroundWindow(pContainer->hwnd);
		}
		SendMessage(pContainer->hwndActive, WM_SIZE, 0, 0);			// make sure the active tab resizes its layout properly
	}
	//MaD_
	else if (GetForegroundWindow() != pContainer->hwnd)
		SetForegroundWindow(pContainer->hwnd);
	if (dat->bType == SESSIONTYPE_IM)
		SetFocus(GetDlgItem(hwndChild, IDC_MESSAGE));
	return TRUE;
}
开发者ID:slotwin,项目名称:miranda-ng,代码行数:44,代码来源:msgs.cpp

示例14: GetWindowPlacement

bool CTSExecutorChildFrame::GetConfigurationData(xmlNodePtr& pxmlNodePtr)
{
    WINDOWPLACEMENT wndPlacement;
    GetWindowPlacement(&wndPlacement);

    const char* omcVarChar ;
    pxmlNodePtr = xmlNewNode(nullptr, BAD_CAST DEF_TS_EXECUTOR);
    m_ouTSExecutor.GetConfigurationData(pxmlNodePtr);

    //Window position


    xmlNodePtr pNodeWndPos = xmlNewNode(nullptr, BAD_CAST DEF_WND_POS);
    xmlAddChild(pxmlNodePtr, pNodeWndPos);

    if(IsWindowVisible() == FALSE)
    {
        wndPlacement.showCmd = SW_HIDE;
    }

    xmlUtils::CreateXMLNodeFrmWindowsPlacement(pNodeWndPos,wndPlacement);

    //splitter position-------------------------
    INT nCxCur, nCxMin;
    m_omSplitterWnd.GetColumnInfo(0, nCxCur, nCxMin);

    xmlNodePtr pNodeSplitterWnd = xmlNewNode(nullptr, BAD_CAST DEF_SPLITTER_WINDOW);
    xmlAddChild(pxmlNodePtr, pNodeSplitterWnd);

    //<CxIdeal />
    CString  csCxIdeal;
    csCxIdeal.Format("%d", nCxCur );
    omcVarChar = csCxIdeal;
    xmlNodePtr pCxIdeal = xmlNewChild(pNodeSplitterWnd, nullptr, BAD_CAST DEF_CX_IDEAL, BAD_CAST omcVarChar);
    xmlAddChild(pNodeSplitterWnd, pCxIdeal);

    // <CxMin />
    CString  csCxMin;
    csCxMin.Format("%d",nCxMin );
    omcVarChar = csCxMin;
    xmlNodePtr pcsCxMin = xmlNewChild(pNodeSplitterWnd, nullptr, BAD_CAST DEF_CX_MIN, BAD_CAST omcVarChar);
    xmlAddChild(pNodeSplitterWnd, pcsCxMin);
    return true;
}
开发者ID:BlackVodka,项目名称:busmaster,代码行数:44,代码来源:TSExecutorGUI_ChildFrame.cpp

示例15: SavePreferences

//-------------------------------------------------------------------------
void SavePreferences(void)
{
    int i;
    char name[256];
    WINDOWPLACEMENT wp;
    FILE *out;
    GetUserDataPath(name);
    strcat(name, PREFFILE);
    out = fopen(name, "w");
    if (!out)
        return;
    fprintf(out, "<UIPREFS>\n");
    fprintf(out, "\t<VERSION ID=\"%d\"/>\n", PREFVERS);
    wp.length = sizeof(wp);
    GetWindowPlacement(hwndFrame, &wp);
    fprintf(out, "\t<PLACEMENT VALUE=\"%d %d %d %d %d %d %d %d %d %d\"/>\n",
        wp.flags, wp.showCmd, wp.ptMinPosition.x, wp.ptMinPosition.y,
        wp.ptMaxPosition.x, wp.ptMaxPosition.y, wp.rcNormalPosition.left,
        wp.rcNormalPosition.top, wp.rcNormalPosition.right,
        wp.rcNormalPosition.bottom);
    fprintf(out, "\t<CUSTOMCOLORS>\n\t\t");
    for (i = 0; i < 16; i++)
    {
        fprintf(out, "%d ", custColors[i]);
        if (i == 7)
            fprintf(out, "\n\t\t");
    }
    fprintf(out, "\n\t</CUSTOMCOLORS>\n");
    fprintf(out, "\t<MEMWND WORDSIZE=\"%d\"/>\n", memoryWordSize);
    fprintf(out, "\t<FIND FMODE=\"%d\" RMODE=\"%d\" FIFFINDMODE=\"%d\" FIFREPLACEMODE=\"%d\">\n", findmode, replacemode, fiffindmode, fifreplacemode);
    for (i=0; i < F_M_MAX; i++)
    {
        fprintf(out, "\t\t<MODE INDEX=\"%d\" FIND=\"%d\" REPLACE=\"%d\"/>\n", i, findflags[i], replaceflags[i]);
    }			
    fprintf(out, "\t</FIND>\n");
    fprintf(out, "\t<PROPERTIES>\n");
    SaveProps(out, generalProject.profiles->debugSettings, 2);
    fprintf(out, "\t</PROPERTIES>\n");
    fprintf(out, "\t<RULES>\n");
    SaveBuildRules(out);
    fprintf(out, "\t</RULES>\n");
    fprintf(out, "</UIPREFS>\n");
    fclose(out);
}
开发者ID:jossk,项目名称:OrangeC,代码行数:45,代码来源:slprefs.c


注:本文中的GetWindowPlacement函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。