Drawing to the desktop via injection

旧时模样 提交于 2019-11-30 16:31:06

I've been searching for this code for too long.

I'd like to write a Dreamscene like app witch can render dynamic contents other than just video files, and this one may be the most hopful solution.

I compiled your code in VS2010 Win7x64 and found:


Desktop icon text become transparent just like Dreamscene do when the window is like:

  • 0x00150138 "Program Manager" Progman
    • 0x000605D6 "" SHELLDLL_DefView
      • 0x000C05BA "FolderView" SysListView32

Desktop icon text become normal but not clear enough when the window is like:

  • 0x000B007C "" WorkerW
    • 0x000605D6 "" SHELLDLL_DefView
      • 0x000C05BA "FolderView" SysListView32
    • 0x000C05BA "FolderView" SysListView32
  • 0x000511E2 "" WorkerW
  • 0x00150138 "Program Manager" Progman

I tried this method Draw Behind Desktop Icons in Windows 8 to make the window status always be like the second condition; and tried to draw on WorkerW window above Progman window with D3D, but got nothing rendered out.

So far there's nothing helpful, dumping the bitmap used by memoryDC may help, which I'll try latter.

If you got any further approach, please let me know.

It has been long time since I last use English, Sorry for my mistake if any.

Update:Clear Icon Text got!

add this under d3ddev->BeginScene();

d3ddev->SetSamplerState(0,D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
d3ddev->SetSamplerState(0,D3DSAMP_MAGFILTER, D3DTEXF_GAUSSIANQUAD);

and this:

HWND desktop = GetDesktopWindow();
HWND explorer = FindWindowEx(desktop, 0, _T("Progman"), _T("Program Manager"));

SendMessageTimeout(explorer, 0x052C, 0, 0, SMTO_NORMAL, 3000, NULL);

HWND defView = 0;
HWND worker = 0;
while(!defView) {
    worker = FindWindowEx(desktop, worker, _T("WorkerW"), 0);
    if(worker) {
        defView = FindWindowEx(worker, 0, _T("SHELLDLL_DefView"), 0);
    }
    else break;
}
if (!worker){ /*DBG("First WorkerW failed");*/ return 0;}

worker = FindWindowEx(desktop, (HWND)worker, _T("WorkerW"), 0); //find the next WorkerW
if (!worker){ /*DBG("Created WorkerW not found");*/ return 0;}

Still drawing on the listView, but worker window must exist. This code runs with Aero Theme enabled only.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!