【问题标题】:How to create small window (32x32) on Windows?如何在 Windows 上创建小窗口(32x32)?
【发布时间】:2012-04-20 05:37:02
【问题描述】:

这是创建窗口的方式。但是当我 GetClientRect 时,rcClient 比 32x32 大得多。

int nDefaultWidth = 32;
int nDefaultHeight = 32;

UINT32 winStyle = 0;

RECT rc;
SetRect( &rc, 0, 0, nDefaultWidth, nDefaultHeight );
AdjustWindowRect( &rc, winStyle, ( hMenu != NULL ) ? true : false );


// Create the render window
HWND hWnd = CreateWindow( L"Direct3DWindowClass", NULL, winStyle,
                          x, y, ( rc.right - rc.left ), ( rc.bottom - rc.top ), 0,
                          hMenu, hInstance, 0 );

RECT rcClient;
GetClientRect( hWnd, &rcClient );

【问题讨论】:

    标签: windows winapi createwindow


    【解决方案1】:

    您将0 作为dwStyle 参数传递给AdjustWindowRect。该值等于WS_OVERLAPPED,而AdjustWindowRect 明确禁止您传递该特定值。

    由于您想创建一个 32x32 的窗口(即完全没有 chrome,纯客户区),您应该放弃 AdjustWindowRect 调用,因为它根本没有任何作用,并将 WS_POPUP 作为窗口样式传递给 @987654330 @。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-09-11
      • 1970-01-01
      • 2010-10-30
      • 2015-11-21
      • 2020-10-22
      • 2011-01-22
      • 2014-02-01
      • 1970-01-01
      相关资源
      最近更新 更多