简体   繁体   English

hwnd 是 winuser.h 的 udefined c++ 导入

[英]hwnd is udefined c++ import of winuser.h

#include "stdafx.h"
#include <winuser.h>
#include <iostream>
#define WIN32_LEAN_AND_MEAN

using namespace std;

typedef struct tagRECT
{
    LONG    left;
    LONG    top;
    LONG    right;
    LONG    bottom;
} RECT, *PRECT, NEAR *NPRECT, FAR *LPRECT;

int main()
{
    RECT newrect;
    AdjustWindowRect(&newrect, WS_BORDER, true);
    cout << "Hello, world, from Visual C++!" << endl;

}

This code cann't be compiled, it has more than 500 errors The most occurring is HWND is undefined .这段代码无法编译,它有 500 多个错误,出现最多的是HWND 是 undefined I am confused because winuser is standard header.我很困惑,因为 winuser 是标准标题。 How to fix it please?请问怎么修? Main goal is to program code that will be giving me size of window of hwnd, this was some first sample how to get near the goal with AdjustWindowRect function.主要目标是编写将给出 hwnd 窗口大小的代码,这是如何使用 AdjustWindowRect 函数接近目标的第一个示例。

永远不要直接包含<winuser.h> ,而是包含<windows.h> ,也许首先定义WIN32_LEAN_AND_MEAN以减少该标题带来的所有内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM