本程序以后可能要写入手记,故不能用mfc,真烦!
  求高手指教
                       郁闷的人.

解决方案 »

  1.   

    写入手机?用API?
    你是说wince的吧?MFC也可以啊.呵呵有for ce的MFC可以在wm_paint中把位图bitblt到窗口的DC上
    也可以在WM_ERASEBKGND中做.
      

  2.   

    侠哥我照您说的做了,但还是没有显示出来图片.
    BOOL CMainForm::Process(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
         int nRet = 0;     switch (message)
         {
            case  ......
                ....          case  WM_ERASEBKGND :
      {
                  HDC  hdc = ::GetDC(this->mhWnd); // handle to device context
             HBITMAP hbitmap = ::LoadBitmap(CGlobal::gInstance,(LPCTSTR)IDB_BKGMAP);       HDC hCompadc  =  ::CreateCompatibleDC(hdc);
                    ::SelectObject(hCompadc,hbitmap); 
                    ::GetClientRect(this->mhWnd,&rect);
                    ::BitBlt(hdc,0,0,rect.right,rect.top,hCompadc,0,0,SRCCOPY);
                     ::StretchBlt(::GetDC(this->mhWnd),0,0,rect.right,rect.top,hCompadc,0,0, );
                  }          }
    .........;........;
    }
      

  3.   

    在 paint 事件中用bitblt 畫一個位圖上去
      

  4.   

    诸侠我也试过了,仍显示不出来.     case  WM_ERASEBKGND :
      {
                  HDC  hdc = ::GetDC(this->mhWnd); // handle to device context
             HBITMAP hbitmap = ::LoadBitmap(CGlobal::gInstance,(LPCTSTR)IDB_BKGMAP);       HDC hCompadc  =  ::CreateCompatibleDC(hdc);
                    ::SelectObject(hCompadc,hbitmap); 
                    ::GetClientRect(this->mhWnd,&rect);
                    ::BitBlt(hdc,0,0,rect.right,rect.top,hCompadc,0,0,SRCCOPY);
               }
      

  5.   

    诸侠我也试过了,仍显示不出来.     case  WM_PAINT :
      {
                  HDC  hdc = ::GetDC(this->mhWnd); // handle to device context
             HBITMAP hbitmap = ::LoadBitmap(CGlobal::gInstance,(LPCTSTR)IDB_BKGMAP);       HDC hCompadc  =  ::CreateCompatibleDC(hdc);
                    ::SelectObject(hCompadc,hbitmap); 
                    ::GetClientRect(this->mhWnd,&rect);
                    ::BitBlt(hdc,0,0,rect.right,rect.top,hCompadc,0,0,SRCCOPY);
               }
      

  6.   

    rect.right,rect.top这两个有问题吧?
      

  7.   

    最好响应WM_ERASEBKGND事件,在这个函数里直接画图,才不会闪
    HDC  hdc = ::GetDC(hWnd);         HBITMAP hbitmap = ::LoadBitmap(CGlobal::gInstance,(LPCTSTR)IDB_BKGMAP);       HDC hCompadc  =  ::CreateCompatibleDC(hdc);
                    ::SelectObject(hCompadc,hbitmap); 
                    ::GetClientRect(hWnd,&rect);
                    ::BitBlt(hdc,0,0,rect.right,rect.top,hCompadc,0,0,SRCCOPY);
      

  8.   

    scxy哥,
         小弟在WM_ERASEBKGND,WM_PAINT 中均试过了.就是显示不出来.不知为何.难到
    脱离了微软的MFC,程序员对windows界面开发就这么难!
      

  9.   

    我特地试了,把rect.right和rect.top改为常数就OK,可能是Screen跟client的关系吧?
      

  10.   

    多谢诸侠相助:
                已经解决问题,正如(_foo(void)//莫名函数)兄所言,
                "rect.right,rect.top 有问题"            正确应是,rect.right-rect.left, rect.bottom-rect.top
                原来用MFC 只需rect.Width(),rect.Height()即可.
                但现在用api就不行了.其主要原因是英语还需加强.
                BOOL BitBlt(
      HDC hdcDest, // handle to destination device context
      int nXDest,  // x-coordinate of destination rectangle's upper-left 
                   // corner
      int nYDest,  // y-coordinate of destination rectangle's upper-left 
                   // corner
      int nWidth,  // width of destination rectangle
      int nHeight, // height of destination rectangle
      HDC hdcSrc,  // handle to source device context
      int nXSrc,   // x-coordinate of source rectangle's upper-left 
                   // corner
      int nYSrc,   // y-coordinate of source rectangle's upper-left 
                   // corner
      DWORD dwRop  // raster operation code
    );
       真诚感谢大家再次相助,特别是(_foo(void)//莫名函数)大侠.
     
                                                             常见.
                                                              快乐的人.