本文整理汇总了C++中CPUTOSServices::GetDesktopDimensions方法的典型用法代码示例。如果您正苦于以下问题:C++ CPUTOSServices::GetDesktopDimensions方法的具体用法?C++ CPUTOSServices::GetDesktopDimensions怎么用?C++ CPUTOSServices::GetDesktopDimensions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPUTOSServices
的用法示例。
在下文中一共展示了CPUTOSServices::GetDesktopDimensions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitInstance
//
// FUNCTION: InitInstance(HINSTANCE, int)
// PURPOSE: Saves instance handle and creates main window
// COMMENTS:
// In this function, we save the instance handle in a global variable and
// create and display the main program window.
//-----------------------------------------------------------------------------
BOOL WindowWinCPRTViewer::InitInstance(HINSTANCE hInstance, int nCmdShow, int windowWidth, int windowHeight)
{
m_hInst = hInstance; // Store instance handle in our global variable
LPCSTR lpTitle = m_AppTitle;
if( (0==windowWidth) || (0==windowHeight) )
{
// zero sized windows means - you choose the size. :)
CPUTOSServices* pServices = CPUTOSServices::GetOSServices();
pServices->GetDesktopDimensions(windowWidth, windowHeight);
// default window size will be 1/3 of the screen size
windowWidth/=3;
windowHeight/=3;
}
m_hWnd = CreateWindow("CPRTChildWindowClass", lpTitle, //APPTITLE, APPTITLE, //szWindowClass, szTitle,
WS_CHILDWINDOW | WS_VISIBLE,
CW_USEDEFAULT,
CW_USEDEFAULT,
100,
100,
parentHWnd,
NULL,
(HINSTANCE)GetWindowLongPtr(parentHWnd, GWLP_HINSTANCE),
NULL);
if (!m_hWnd)
{
return FALSE;
}
ShowWindow(m_hWnd, nCmdShow);
UpdateWindow(m_hWnd);
CPUTOSServices* pServices = CPUTOSServices::GetOSServices();
pServices->SethWnd(m_hWnd);
return TRUE;
}
示例2: InitInstance
// InitInstance
// Saves the windows instance handle, creates, and displays the main program
// window
//-----------------------------------------------------------------------------
BOOL CPUTWindowWin::InitInstance(int nCmdShow, int windowWidth, int windowHeight, int windowX, int windowY)
{
// assure we have a valid hInstance
ASSERT(NULL!=mhInst, _L(""));
// zero sized windows means - you choose the size. :)
if( (0==windowWidth) || (0==windowHeight) )
{
CPUTOSServices *pServices = CPUTOSServices::GetOSServices();
pServices->GetDesktopDimensions(&windowWidth, &windowHeight);
// default window size 1280x720
// but if screen is smaller than 1280x720, then pick 1/3 the screen size
// so that it doesn't appear off the edges
if(1280>windowWidth)
{
windowWidth = (2*windowWidth)/3;
windowHeight = (2*windowHeight)/3;
}
else
{
windowWidth=1280;
windowHeight=720;
}
}
// set up size structure
RECT rc = { 0, 0, windowWidth, windowHeight };
AdjustWindowRect( &rc, WS_OVERLAPPEDWINDOW, FALSE );
// if x = -1, then let windows decide where to put it
if(-1==windowX)
{
windowX = CW_USEDEFAULT;
}
// create the window
mhWnd = CreateWindow(mAppTitle.c_str(), mAppTitle.c_str(),
WS_OVERLAPPEDWINDOW,
windowX, //CW_USEDEFAULT,
windowY, //CW_USEDEFAULT,
rc.right - rc.left,
rc.bottom - rc.top,
NULL,
NULL,
mhInst,
NULL);
if (!mhWnd)
{
return FALSE;
}
ShowWindow(mhWnd, nCmdShow);
UpdateWindow(mhWnd);
// initialize the OS services with the hWND so you can make
// reference to this object
CPUTOSServices *pServices = CPUTOSServices::GetOSServices();
pServices->SethWnd(mhWnd);
return TRUE;
}