为什么会出现“ excepted a ')'”的错误,下面是代码

问题描述 投票:0回答:1
if (this->m_hWnd = CreateWindowEx(
    0,
    this->m_szClassName.c_str(),
    this->m_szAppName.c_str(),
    WS_DLGFRAME | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZE,
    (GetSystemMetrics(SM_CXSCREEN) - _windowRC.right) / 2,
    (GetSystemMetrics(SM_CXSCREEN) - _windowRC.bottom) / 2,
    _windowRC.right, _windowRC.bottom, nullptr, nullptr, nullptr, this
);/*';' underlined in red*/ !this->m_hWnd)
    throw runtime_error("Error, can't create main window!"s);

我正在重写YouTube代码,试图弄清楚它是如何工作的,我之前写过类似的条件,但没有发生这样的错误

if-statement error-handling syntax-error this
1个回答
0
投票
if (this->m_hWnd = CreateWindowEx(
    0,
    this->m_szClassName.c_str(),
    this->m_szAppName.c_str(),
    WS_DLGFRAME | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZE,
    (GetSystemMetrics(SM_CXSCREEN) - _windowRC.right) / 2,
    (GetSystemMetrics(SM_CXSCREEN) - _windowRC.bottom) / 2,
    _windowRC.right, _windowRC.bottom, nullptr, nullptr, nullptr, this
)

插入

); if (

!this->m_hWnd)
        throw runtime_error("Error, can't create main window!"s);

...或类似的,那就有意义了。

© www.soinside.com 2019 - 2024. All rights reserved.