将void转换为byte

时间:2013-11-06 06:28:09

标签: c++

请帮助我。

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:'type cast':无法转换为'void   (__stdcall TLECustomControl :: *)(void)'到'字节   *'d:\ leadwerks \ projects \ userwindow \ LECustomControl.h

102错误1错误C2440:'type cast':无法从'void

转换
  

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

1 个答案:

答案 0 :(得分:1)

我猜这就是这条线

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

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

但它无论如何都行不通,因为这些functins都没有返回任何内容,但预期的参数类型为byte*