Desktop wallpaper/background
-
Hi gentlemen, is there an option how to obtain desktop wallpaper/background. I need to use it in the BitBlt function. I need to copy part of Desktop wallpaper/background to my appl. I've tried: hDesktopWindow = GetDesktopWindow(); HDC hdc = GetDC(hDesktopWindow) or HDC hdc = GetDC(NULL) and than I used hdc in the BitBlt function as source hdc - but It doesn't work because I got desktop with all opened windows - I need only wallpaer without windows. I've also tried PaintDesktop() function. It gets me the same result - results desktop with all windows. or HDC hdc = GetDC(GetDesktopWindow()) int iResult = GetObject(hdc,sizeof(HBITMAP), &hBitmap) iResult is allways 0 and GetLastError gets 6 = ERROR_INVALID_HANDLE Any idea? Thanks.
-
Hi gentlemen, is there an option how to obtain desktop wallpaper/background. I need to use it in the BitBlt function. I need to copy part of Desktop wallpaper/background to my appl. I've tried: hDesktopWindow = GetDesktopWindow(); HDC hdc = GetDC(hDesktopWindow) or HDC hdc = GetDC(NULL) and than I used hdc in the BitBlt function as source hdc - but It doesn't work because I got desktop with all opened windows - I need only wallpaer without windows. I've also tried PaintDesktop() function. It gets me the same result - results desktop with all windows. or HDC hdc = GetDC(GetDesktopWindow()) int iResult = GetObject(hdc,sizeof(HBITMAP), &hBitmap) iResult is allways 0 and GetLastError gets 6 = ERROR_INVALID_HANDLE Any idea? Thanks.
daavena wrote:
HDC hdc = GetDC(GetDesktopWindow())
Try
HDC hdc = CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL)
instead. This will simply capture the existing screen on all monitors. If you want to get the desktop wallpaper you should useSystemParametersInfo(SPI_GETDESKWALLPAPER, ...
Look at the documentation of SystemParametersInfo Function[^]«_Superman_» I love work. It gives me something to do between weekends.
-
daavena wrote:
HDC hdc = GetDC(GetDesktopWindow())
Try
HDC hdc = CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL)
instead. This will simply capture the existing screen on all monitors. If you want to get the desktop wallpaper you should useSystemParametersInfo(SPI_GETDESKWALLPAPER, ...
Look at the documentation of SystemParametersInfo Function[^]«_Superman_» I love work. It gives me something to do between weekends.
Hi, thanks for your reply, Try HDC hdc = CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL) instead but as you said this capture whole screen with all windows - I do not need this. What I need is screen backgroud without any windows. Because I need copy a part of screen backgroud to my window. I know SystemParametersInfo function. It gives me the name of wallpaper only.