有个DX说用COleControl::TranslateColor,我用COleControl olecontrl实例化的时候
提示说是纯虚函数不能这样实例化,不知道该怎么做了,求DX们帮忙.

解决方案 »

  1.   

    COleControl 是有纯虚函数的抽象类,所以必须找一个从它继承的子类来实例化
      

  2.   

    可以使用OleTranslateColor#include "olectl.h"
      

  3.   

    你在哪里用的呀?
    如果你的类继承自COleControl,
    你直接写TranslateColor就可以了
      

  4.   

    STDAPI OleTranslateColor (
      OLE_COLOR clr,       //Color to be converted into a COLORREF
      HPALETTE hpal,       //Palette used for conversion
      COLORREF *pcolorref  //Pointer to the caller's variable that
                           // receives the converted result
    );
    hpal 可以为 NULL
      

  5.   

    多谢各位DX,我是在程序中用了一个控件,想把控件窗口的背景颜色读出来在一个对话框中显示,然后再将对话框中设置的颜色设置给控件窗口的背景.我已经用OleTranslateColor成功的转换了ole_color,谢谢大家的帮助,现在又需要从COLORREF转换到OLE_COLOR,我又不知道用什么函数了,再次麻烦大家指点.谢谢
      

  6.   

    刚刚知道了OLE_COLOR原来是BGR, 这样就可以自己转换了.
    再次谢谢各位的帮助,结贴了.