将 void 转换为字节

Convert void to byte

本文关键字:字节 转换 void      更新时间:2023-10-16

请帮助我。

class TLECustomControl
{
    private:
        ...
        HDC _hDC;
        HGLRC _hRC;
        void _stdcall MakeCurrent(void);
        void _stdcall GetSize(int* width, int* height);
    public:
        ...
        int Initialize(HWND handle);
};
void _stdcall TLECustomControl::MakeCurrent(void)
{
    wglMakeCurrent(this->_hDC, this->_hRC);
}
void _stdcall TLECustomControl::GetSize(int* width, int* height)
{
    this->MakeCurrent();
    int vPort[4];
    glGetIntegerv(GL_VIEWPORT, vPort);
    *width = vPort[2];
    *height = vPort[3];
}
int TLECustomControl::Initialize(HWND handle)
{
    ...
    //Create a custom buffer
    this->_customBuffer = LE::CreateCustomBuffer((byte*)this->GetSize,(byte*)this->MakeCurrent);
}
/

/错误列表

错误

2 错误 C2440:"类型转换":无法从"void"转换 (__stdcall TLECustomControl::* )(void)' 到 'byte *' d:\leadwerks\projects\userwindow\LECustomControl.h

102 错误 1 错误 C2440:"类型转换":无法从"void"转换

(__stdcall TLECustomControl::* )(int *,int *)' to 'byte *' d:\leadwerks\projects\userwindow\LECustomControl.h 101

我猜是这一行

this->_customBuffer = LE::CreateCustomBuffer((byte*)this->GetSize,(byte*)this->MakeCurrent);

问题是您将成员函数作为参数传递,实际上并没有调用GetSizeMakeCurrent函数。

但它无论如何都不起作用,因为这些函数都没有返回任何内容,但预期的参数是 byte*