操作桌面 dc控制

来源:互联网 发布:备案域名租用 编辑:程序博客网 时间:2024/05/16 02:35
::TextOut(::GetDC(0),0,0,"显示在屏幕左上角",16);
  HWND   hDesktop=HWND_DESKTOP;  
      HDC   hDC   =     ::GetDC(hDesktop);  
      TextOut(hDC,10,10,"Hello",5);

CWnd   *pDesktop=GetDesktopWindow();  
  CDC   *pDC=pDesktop->GetWindowDC();  
   
  pDC->MoveTo(0,   0);  
  pDC->LineTo(100,   100);  
   
  pDesktop->ReleaseDC(pDC);‘


    static int a=0;
    a+=30;
    if(a>1000) a=0;
    HWND   hDesktop=HWND_DESKTOP; 
    HDC   hDC   =       ::GetDC(hDesktop)  ;
    ::SetBkMode(hDC,TRANSPARENT);
    ::SetTextColor(hDC,RGB(60,120,240));

    //::TextOut(hDC,a,10," ",1);  
    CWnd   *wnd=GetDesktopWindow();
    wnd->SendMessage(WM_PAINT,(WPARAM)hDC,0);
    ::TextOut(hDC,30+a,10,"Hello",5);  
    CView::OnTimer(nIDEvent);


//刷新desktop
      HWND   hDesktop; 
  
      hDesktop   =   ::FindWindow("Progman",   "Program   Manager"); 
      hDesktop   =   ::FindWindowEx(hDesktop,   0,   "SHELLDLL_DefView",   ""); 
      hDesktop   =   ::FindWindowEx(hDesktop,   0,   "SysListView32",   ""); 
  
      ::InvalidateRect(hDesktop,NULL,true); 
      ::SendMessage(hDesktop,WM_PAINT,0,0);  
原创粉丝点击