I have created the bitmap and picture frame resources in the RC file, and assigned the bitmap to the frame in the above line. When I run the program, the image displays, but if I change the image and restart the program, it stays the same when the program displays it. How do I make it refresh the image?
Thanks.
Last edited by george7378; June 24th, 2010 at 10:10 AM.
I didn't look at your code, but what do you mean by "change the image"? Do you change it in the resource editor, or with some external program? If with an external program, do you recompile after changing the image? The image that resides in the res folder is linked into the program resources at compile time. Once compiled, the image is ignored by the program until you recompile.
I tried to find the button for code tags, but I couldn't. Do I have to put them in manually?
Anyway, yes - that's what I mean, and that explains why it doesn't change when I use paint to modify it. Are there any commands I can use to make it read from the image instead of keeping the image it integrated while compiling?
I think size of your static IDC_SUNFRAME remains unchanged in rc-file.
You change latest.bmp file, but VC resource editor does not know it.
Possible solutions:
1. [simple] Update rc-file after any bmp-file modification.
2. [complex] Update size of IDC_SUNFRAME dynamically at runtime. Inside WM_INITDIALOG for example.
Thanks for the advice - the idea of the program is that it downloads a picture of the Sun from a set URL (http://sohowww.nascom.nasa.gov/data/...024/latest.jpg) and displays it when the window is opened. I have got it to downlod, and, now I know that I need to recompile every time I want to view the new image.
Can you offer any help on the WM_INITDIALOG option?
Loading an image has its own complications due to the fact that files are stored as device independent bitmaps (DIBs) and windows drawing uses DDBs internally. This article should give you a place to start:
Here is WM_INITDIALOG implementation plan:
1. Handle WM_INITDAILOG message in your dialog procedure.
2. Inside WM_INITDIALOG handler detect your bitmap size.
3. Use GetDlgItem to detect IDC_SUNFRAME HWND.
4. Call SetWindowPos or MoveWindow to set its size.
I hope it works.
Bookmarks