Visual c++ 为什么CreateSolidBrush在c+中返回随机数而不是常量数+;?

Visual c++ 为什么CreateSolidBrush在c+中返回随机数而不是常量数+;?,visual-c++,random,Visual C++,Random,这是我的密码: int clrresult = (int)CreateSolidBrush(RGB(20, 30, 40)); std::wstringstream wss; wss << clrresult; Edit_SetText(CLtbx,wss.str().c_str()); intclresult=(int)CreateSolidBrush(RGB(20,30,40)); std::wstringstream wss; wss根据MSD

这是我的密码:

    int clrresult = (int)CreateSolidBrush(RGB(20, 30, 40));
    std::wstringstream wss;
    wss << clrresult;
    Edit_SetText(CLtbx,wss.str().c_str());
intclresult=(int)CreateSolidBrush(RGB(20,30,40));
std::wstringstream wss;

wss根据MSDN文档,CreateSolidBrush返回一个HBRUSH对象,它是笔刷的句柄,不是有意义的值。您不需要直接使用它的数值。它本质上是指向由Windows管理的实际笔刷对象的指针。

不是
int
,句柄通常是指针。原因大致相同,
(int)(new int(42))
每次运行时都会产生不同的值。