hi is there some one out there who would know how to a set a background image in win32 api.thanks
hi is there some one out there who would know how to a set a background image in win32 api.thanks
http://msdn.microsoft.com/library/de...metersinfo.aspCode:SystemParametersInfo( SPI_SETDESKWALLPAPER, 0, "C:\\wallpaper.jpg", 0 );
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
sorry
i ment for the actual program like a bitmap file , not the desktop
Easiest way is to do it in the registering of the window class
wncl.hbrBackground = CreatePatternBrush( LoadBitmap( hInstance, MAKEINTRESOURCE( your_bitmap ) ) );
this did not workCode:wincl.hbrBackground = CreatePatternBrush( LoadBitmap( hThisInstance, MAKEINTRESOURCE(BACKGROUND) ) );
Bear in mind that under Win9x, CreatePatternBrush will only use a max 8x8 bitmap for a pattern brush. If compatibility with this platform is required, then modification of the window's WM_PAINT message will be necessary (Some BitBlting required).
CreatePatternBrush is ok for win98; it's only win95 that limits the size to 8x8.Bear in mind that under Win9x, CreatePatternBrush will only use a max 8x8 bitmap for a pattern brush
This doesn't help us to help you. If you got an error what error was reported?this did not work
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
i didnt get a error and im on XP
its just not showing the picture
and yes its all setup right in the resource file
There are two likely problems then:
1. hThisInstance is not valid. Try using GetModuleHandle(0) instead.
2. You're passing a string resource identifier to MAKEINTRESOURCE rather than a short int resource identifier (check value of 'BACKGROUND' - substitute in the numerical value in place of MAKEINTRESOURCE(...) in your LoadBitmap call.
If that fails to identify the source of the problem then it might be a good idea to break the bitmap and brush creation line into separate parts, checking the return values from LoadBitmap and CreatePatternBrush to check for non-NULL values. If either is NULL then use GetLastError to give you some better idea of why.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
did not work it compiled and still nothingCode:wincl.hbrBackground = CreatePatternBrush( LoadBitmap( GetModuleHandle(0), MAKEINTRESOURCE(700) ) );
...and the result of trying that is...?Originally Posted by Ken Fitlike
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
well i dont get a background or color it just paints wat window was over it say if explorer was over it then it will paint what was over it.
sorry on the late reply
i have it defined asCode:#include <windows.h> #include "manifest.h" MANIFEST_RESOURCE_ID MANIFEST "client.exe.manifest" 500 ICON "main.ico" 600 ICON "app.ico" 800 ICON "tray.ico" 700 BACKGROUND BITMAP "background.bmp"up the topCode:#define BACKGROUND 700
when i open it it paints the current window that was above the app
say if i have msn messenger over it.it will paint that to it.please help.thanks
should be:Code:700 BACKGROUND BITMAP "background.bmp"
orCode:700 BITMAP "background.bmp"
--Code:BACKGROUND BITMAP "background.bmp"
Typically, we create a header file "resource.h" with:
and then we #include that file in both the resource file and the project:Code:#define IDI_APPICON 1001 #define IDI_TRAYICON 1002 #define IDB_BACKGROUND 2001
The numbers are only used once, in the header file.Code:#include <windows.h> #include "resource.h" IDI_APPICON ICON "app.ico" IDI_TRAYICON ICON "tray.ico" IDB_BACKGROUND BITMAP "background.bmp"