Screen capture from windows service

前端 未结 3 1074
滥情空心
滥情空心 2020-12-01 09:54

I\'ve got DirectShow based screen capture software. Internally it calls CopyScreenToBitmap function to grab screen. Then the picture is compressed by ffdshow. It works fine

3条回答
  •  栀梦
    栀梦 (楼主)
    2020-12-01 10:34

    Try this in addition to allowing access to the desktop:

    1. Enumerate all Window Stations: EnumWindowStations
    2. Find the window station for the logged on user, and make it your process' window station: SetProcessWindowStation - see example in this thread
    3. Then set the desktop for your current thread to the default desktop of the window station also here
    4. Then get the DC of the desktop using one of a few methods, including

      CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL)

      Good luck

提交回复
热议问题