我想把CFileDialog 的“文件名”等静态文本 替换成图片,于是从CFileDialog 派生一个类CFileDialogEX
,添加ONINITDIALOG函数,将静态文本的属性改为 SS_BITMAP ,然后SETBITMAP;结果得到一个空白区。
于是我想在ONPAINT里头SETBITMAP, 但是DEBUG发现根本没有调用我的ONPAINT函数(ONPAINT函数是通过向导添加的),我试着用向导添加了一些其他鼠标响应函数,发现DEBUG时同样不会被调用。请教各位:这是否是要用到传说的钩子才能解决?我对钩子一窍不通,恳请圣人指点。

解决方案 »

  1.   

    CFileDialog是一个非常奇怪的类,有些消息很难捕捉到,比如WM_SIZE等消息
      

  2.   

    If you derive a new class from CFileDialog, you can use a message map to handle any messages. To extend the default message handling, derive a class from CWnd, add a message map to the new class, and provide member functions for the new messages. You do not need to provide a hook function to customize the dialog box.To customize the dialog box, derive a class from CFileDialog, provide a custom dialog template, and add a message map to process the notification messages from the extended controls. Any unprocessed messages should be passed to the base class.Customizing the hook function is not required.这段msdn的东东似乎能够回答你的某些问题
      

  3.   

    你确定你是这么做的么?
    class CFileDialogEx : public CFileDialog
    {
     DECLARE_DYNAMIC(CFileDialogEx) // 只有加了这个CFileDialogEx才
                                    // 能拥有了CFileDialog的消息
      

  4.   

    哦,还有那个 IMPLEMENT_DYNCREATE 宏:IMPLEMENT_DYNCREATE(CFileDialogEx,CFileDialog)
      

  5.   

    TO fansfly(飞翔引擎)  :我按照我对那段文字的理解做了,但还没成功,能否解释通俗一点?谢谢了。
    TO  I_Love_CPP(我爱C++) :我有加的。
      

  6.   

    我现在只是想知道如何将我派生的CFileDialogEx对话框的静态文本替换成BITMAP ,谢谢。