本文整理汇总了C++中NzString::GetWideString方法的典型用法代码示例。如果您正苦于以下问题:C++ NzString::GetWideString方法的具体用法?C++ NzString::GetWideString怎么用?C++ NzString::GetWideString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NzString
的用法示例。
在下文中一共展示了NzString::GetWideString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Create
bool NzWindowImpl::Create(const NzVideoMode& mode, const NzString& title, nzUInt32 style)
{
bool fullscreen = (style & nzWindowStyle_Fullscreen) != 0;
DWORD win32Style, win32StyleEx;
unsigned int x, y;
unsigned int width = mode.width;
unsigned int height = mode.height;
if (fullscreen)
{
DEVMODE win32Mode;
std::memset(&win32Mode, 0, sizeof(DEVMODE));
win32Mode.dmBitsPerPel = mode.bitsPerPixel;
win32Mode.dmPelsHeight = mode.height;
win32Mode.dmPelsWidth = mode.width;
win32Mode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
win32Mode.dmSize = sizeof(DEVMODE);
if (ChangeDisplaySettings(&win32Mode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
{
// Situation extrêmement rare grâce à NzVideoMode::IsValid appelé par NzWindow
NazaraError("Failed to change display settings for fullscreen, this video mode is not supported by your computer");
fullscreen = false;
}
}
// Testé une seconde fois car sa valeur peut changer
if (fullscreen)
{
x = 0;
y = 0;
win32Style = WS_CLIPCHILDREN | WS_POPUP;
// Pour cacher la barre des tâches
// http://msdn.microsoft.com/en-us/library/windows/desktop/ff700543(v=vs.85).aspx
win32StyleEx = WS_EX_APPWINDOW;
fullscreenWindow = this;
}
else
{
win32Style = WS_VISIBLE;
if (style & nzWindowStyle_Titlebar)
{
win32Style |= WS_CAPTION | WS_MINIMIZEBOX;
if (style & nzWindowStyle_Closable)
win32Style |= WS_SYSMENU;
if (style & nzWindowStyle_Resizable)
win32Style |= WS_MAXIMIZEBOX | WS_SIZEBOX;
}
else
win32Style |= WS_POPUP;
win32StyleEx = 0;
RECT rect = {0, 0, static_cast<LONG>(width), static_cast<LONG>(height)};
AdjustWindowRect(&rect, win32Style, false);
width = rect.right-rect.left;
height = rect.bottom-rect.top;
x = (GetSystemMetrics(SM_CXSCREEN) - width)/2;
y = (GetSystemMetrics(SM_CYSCREEN) - height)/2;
}
m_callback = 0;
#if NAZARA_UTILITY_THREADED_WINDOW
NzMutex mutex;
NzConditionVariable condition;
m_threadActive = true;
// On attend que la fenêtre soit créée
mutex.Lock();
m_thread = NzThread(WindowThread, &m_handle, win32StyleEx, title.GetWideString().data(), win32Style, x, y, width, height, this, &mutex, &condition);
condition.Wait(&mutex);
mutex.Unlock();
#else
m_handle = CreateWindowExW(win32StyleEx, className, title.GetWideString().data(), win32Style, x, y, width, height, nullptr, nullptr, GetModuleHandle(nullptr), this);
#endif
if (!m_handle)
{
NazaraError("Failed to create window: " + NzError::GetLastSystemError());
return false;
}
if (fullscreen)
{
SetForegroundWindow(m_handle);
ShowWindow(m_handle, SW_SHOW);
}
m_eventListener = true;
m_ownsWindow = true;
#if !NAZARA_UTILITY_THREADED_WINDOW
m_sizemove = false;
#endif
m_style = style;
// Récupération de la position/taille de la fenêtre (Après sa création)
//.........这里部分代码省略.........
示例2: SetTitle
void NzWindowImpl::SetTitle(const NzString& title)
{
SetWindowTextW(m_handle, title.GetWideString().data());
}