操作桌面 dc控制
::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);
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);
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.