Drawing to the desktop via injection

二次信任 提交于 2019-12-30 05:29:12

问题


I'd like to draw to the desktop wallpaper area with directX 9 in particular. Under the icons and text above the wallpaper. Similar to Okozo or one of VLC's modes, or Dreamscene.

So there's a lot of similar questions to this but no working examples or tutorials.This A simmilar question but different approach seems pretty useful. A few years ago I was searching and found this site and code.

It's perfect aside from one big issue the icon text gets blocky even with alpha blending. I tried a few fixes but I wasn't able to find any helpful documentation maybe I just wasn't using the right words for searching, maybe it's proprietary. I think I fixed that with a call to invalidate the desktop area but I can't really tell as in the process I messed up the alpha values for the text so it doesn't properly draw the font color. So how do I alter the text for proper alpha blending?

Pouet's links are all dead I know I should post a snippet but I can't pin down where the problem is as it's more an unexpected feature.


回答1:


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.



来源:https://stackoverflow.com/questions/34952967/drawing-to-the-desktop-via-injection

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